/* =====================================================================
   LIFE DROP - Design tokens
   Palette derived from the logo: deep navy droplet + gold gradient rim
   ===================================================================== */
:root {
    --navy-900: #0A1830;
    --navy-800: #0B1E3D;
    --navy-700: #122B54;
    --navy-600: #1B3A6B;
    --gold-500: #D4AF37;
    --gold-400: #E8C766;
    --gold-300: #F3DA97;
    --white: #FFFFFF;
    --off-white: #F7F8FA;
    --grey-200: #E7E9EE;
    --grey-400: #B6BCC8;
    --grey-600: #6B7280;
    --ink: #14213A;
    --success: #1E8E5A;
    --danger: #C4432B;
    --warning: #C98A1E;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --shadow-soft: 0 8px 24px rgba(10, 24, 48, 0.10);
    --shadow-lift: 0 14px 34px rgba(10, 24, 48, 0.16);

    --font-display: 'Poppins', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: var(--font-body);
    background: var(--off-white);
    color: var(--ink);
    -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--navy-800); margin: 0 0 8px; }
a { color: var(--navy-700); text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 18px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 22px; border-radius: var(--radius-sm);
    font-family: var(--font-display); font-weight: 600; font-size: 15px;
    border: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
    text-align: center;
}
.btn-gold {
    background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
    color: var(--navy-900);
    box-shadow: 0 6px 16px rgba(212,175,55,0.35);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(212,175,55,0.45); }
.btn-navy {
    background: var(--navy-800); color: var(--white);
}
.btn-navy:hover { background: var(--navy-700); }
.btn-outline {
    background: transparent; border: 1.5px solid var(--navy-800); color: var(--navy-800);
}
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Auth pages (login/register/forgot) ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at top left, var(--navy-700), var(--navy-900) 65%);
    padding: 24px 16px;
}
.auth-card {
    width: 100%; max-width: 430px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    padding: 34px 28px 28px;
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: "";
    position: absolute; top: -60px; right: -60px;
    width: 160px; height: 160px; border-radius: 50%;
    background: radial-gradient(circle, rgba(212,175,55,0.18), transparent 70%);
}
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo img { height: 58px; margin: 0 auto 6px; border-radius: 10px; }
.auth-tagline { text-align:center; color: var(--gold-500); font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 22px;}
.auth-title { text-align: center; font-size: 21px; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--grey-600); font-size: 13.5px; margin-bottom: 22px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--navy-800); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
    border: 1.5px solid var(--grey-200); font-size: 14.5px; font-family: var(--font-body);
    background: var(--off-white); transition: border-color .15s ease, background .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--gold-500); background: var(--white);
}
.field-hint { font-size: 12px; color: var(--grey-600); margin-top: 5px; }
.field-error { font-size: 12.5px; color: var(--danger); margin-top: 5px; }

.auth-links { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--grey-600); }
.auth-links a { color: var(--navy-700); font-weight: 600; }
.divider-line { text-align:center; color: var(--grey-400); font-size: 12px; margin: 18px 0; position: relative; }
.divider-line::before, .divider-line::after {
    content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--grey-200);
}
.divider-line::before { left: 0; } .divider-line::after { right: 0; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; }
.alert-success { background: #E6F4EC; color: var(--success); border: 1px solid #B9E3C8; }
.alert-error { background: #FBEAE6; color: var(--danger); border: 1px solid #F2C3B8; }
.alert-info { background: #EAF1FB; color: var(--navy-700); border: 1px solid #C9DBF3; }

/* ---------- App shell (post-login) ---------- */
.app-header {
    background: var(--navy-800); color: var(--white);
    padding: 12px 0; position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow-soft);
}
.app-header .container { display: flex; align-items: center; justify-content: space-between; }
.app-brand { display: flex; align-items: center; gap: 10px; }
.app-brand img { height: 34px; border-radius: 10px; background: #fff; padding: 3px 8px; }
.app-brand span { font-family: var(--font-display); font-weight: 700; letter-spacing: 1px; color: var(--gold-400); }
.app-header nav { display: flex; gap: 4px; }
.app-header nav a {
    color: var(--grey-200); font-size: 13.5px; font-weight: 600; padding: 8px 12px; border-radius: 8px;
}
.app-header nav a.active, .app-header nav a:hover { background: rgba(255,255,255,0.08); color: var(--gold-400); }
.header-icon-btn {
    background: rgba(255,255,255,0.08); border: none; color: var(--white); border-radius: 50%;
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}

.page-wrap { padding: 22px 0 100px; }
.page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px;}
.page-title h1 { font-size: 22px; }

.card {
    background: var(--white); border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft); padding: 20px;
}
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card { display: flex; flex-direction: column; gap: 6px; position: relative; }
.stat-card .stat-label { font-size: 12.5px; color: var(--grey-600); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--navy-800); font-family: var(--font-display); }
.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
    background: #FFFFFF; border: 1px solid var(--grey-200);
    box-shadow: 0 3px 10px rgba(10,24,48,0.08);
    font-size: 21px; margin-bottom: 4px;
}

/* Clickable stat / summary cards - clear affordance + nice touch feedback on mobile */
a.stat-card-link {
    display: block; text-decoration: none; color: inherit;
    transition: transform .15s ease, box-shadow .15s ease;
}
a.stat-card-link .card { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
a.stat-card-link:hover .card { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--gold-300); }
a.stat-card-link:active .card { transform: translateY(-1px) scale(0.98); box-shadow: var(--shadow-soft); }
a.stat-card-link .card { border: 1px solid transparent; }
a.stat-card-link .stat-card::after {
    content: "\203A"; position: absolute; top: 14px; right: 4px; font-size: 18px; color: var(--grey-400);
    font-weight: 700; transition: color .15s ease, transform .15s ease;
}
a.stat-card-link:hover .stat-card::after { color: var(--gold-500); transform: translateX(2px); }

.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; }
.badge-good, .badge-completed, .badge-active { background: #E6F4EC; color: var(--success); }
.badge-due, .badge-pending, .badge-in_progress { background: #FBF1DD; color: var(--warning); }
.badge-overdue, .badge-cancelled, .badge-blocked { background: #FBEAE6; color: var(--danger); }
.badge-new, .badge-assigned { background: #EAF1FB; color: var(--navy-700); }

table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th { text-align: left; color: var(--grey-600); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 10px 12px; border-bottom: 2px solid var(--grey-200); white-space: nowrap; }
table.table td { padding: 12px; border-bottom: 1px solid var(--grey-200); vertical-align: middle; }
table.table tr:hover td { background: var(--off-white); }

/* Horizontal-scroll wrapper so wide tables never break mobile layout */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}
.table-responsive::-webkit-scrollbar { height: 6px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--grey-400); border-radius: 4px; }

/* ---------- Gift slot icons (the 6-shade referral reward row) ---------- */
.gift-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; padding: 8px 0; }
.gift-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 68px; }
.gift-slot .gift-icon {
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 24px;
    transition: transform .2s ease;
}
.gift-slot.locked .gift-icon { background: var(--grey-200); color: var(--grey-400); }
.gift-slot.unlocked .gift-icon {
    background: linear-gradient(135deg, var(--navy-700), var(--navy-900) 55%, var(--gold-500));
    color: var(--gold-300);
    box-shadow: 0 6px 16px rgba(212,175,55,0.4);
}
.gift-slot.unlocked .gift-icon:hover { transform: scale(1.08); }
.gift-slot .gift-label { font-size: 11px; color: var(--grey-600); font-weight: 600; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: var(--white); border-top: 1px solid var(--grey-200);
    display: none; justify-content: space-around; padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--grey-600); font-weight: 600; }
.bottom-nav a.active { color: var(--navy-800); }
.bottom-nav a .nav-icon { font-size: 19px; }

/* ---------- Install PWA banner ---------- */
.install-banner {
    position: fixed; bottom: 14px; left: 14px; right: 14px; z-index: 100;
    background: var(--navy-800); color: #fff; border-radius: var(--radius-md);
    padding: 14px 16px; display: none; align-items: center; gap: 12px;
    box-shadow: var(--shadow-lift);
}
.install-banner img { height: 30px; }
.install-banner .txt { flex: 1; font-size: 13px; }
.install-banner .txt b { color: var(--gold-400); display:block; font-size: 13.5px; }

/* ---------- Landing / index (public) ---------- */
.hero {
    background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
    color: #fff; padding: 70px 0 90px; text-align: center; position: relative; overflow: hidden;
}
.hero h1 { color: #fff; font-size: 34px; }
.hero p { color: var(--grey-200); max-width: 480px; margin: 10px auto 26px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
    .app-header nav { display: none; }
    .bottom-nav { display: flex; }
    .page-wrap { padding-bottom: 90px; }
    .auth-card { padding: 28px 20px 22px; }
    .hero h1 { font-size: 26px; }
    .card { padding: 16px; }
    .container { padding: 0 14px; }
    .page-title { flex-direction: column; align-items: stretch; }
    .page-title h1 { font-size: 19px; }
    .page-title form { flex-wrap: wrap; }
    .page-title form input, .page-title form select { flex: 1; min-width: 0; }
    .stat-value { font-size: 22px; }
    .gift-row { gap: 10px; }
    table.table td form[style*="flex"] { flex-direction: column; align-items: stretch !important; }
    table.table td form[style*="flex"] .field { width: 100%; }
    /* Keep install banner clear of the bottom nav bar */
    .install-banner { bottom: calc(74px + env(safe-area-inset-bottom)); left: 10px; right: 10px; flex-wrap: wrap; }
    .install-banner .txt { min-width: 140px; }
}
@media (max-width: 420px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .gift-slot { width: 60px; }
    .gift-slot .gift-icon { width: 48px; height: 48px; font-size: 20px; }
    .auth-logo img { height: 46px; }
    .btn { font-size: 14px; padding: 12px 16px; }
    table.table { font-size: 12.5px; }
}

/* ---------- Admin shell mobile fixes ---------- */
@media (max-width: 860px) {
    .admin-sidebar { position: fixed; top: 0; left: -240px; height: 100vh; z-index: 300; transition: left .25s ease; }
    .admin-sidebar.open { left: 0; box-shadow: 0 0 30px rgba(0,0,0,0.35); }
    .admin-topbar #hamburgerBtn { display: inline-flex !important; }
    .admin-content { padding: 14px; }
    .admin-content .grid-2 { grid-template-columns: 1fr; }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(10,24,48,0.5); z-index: 250; }
    .sidebar-overlay.open { display: block; }
}
@media (min-width: 861px) {
    .admin-topbar #hamburgerBtn { display: none !important; }
}

/* ---------- Footer credit ---------- */
.site-credit {
    text-align: center; font-size: 11px; color: var(--grey-400);
    padding: 14px 10px 10px;
}
.site-credit a { color: var(--grey-400); font-weight: 600; text-decoration: none; }
.site-credit a:hover { color: var(--gold-500); }
@media (max-width: 640px) { .site-credit { padding-bottom: calc(70px + env(safe-area-inset-bottom)); } }

/* ---------- Splash / portal-entry animation ---------- */
.splash-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: radial-gradient(circle at top left, var(--navy-700), var(--navy-900) 65%);
    display: flex; align-items: center; justify-content: center; flex-direction: column;
    opacity: 1; transition: opacity .5s ease;
}
.splash-overlay.splash-hide { opacity: 0; pointer-events: none; }
.splash-square {
    width: 92px; height: 92px; border-radius: 26px;
    background: linear-gradient(135deg, var(--navy-600), var(--navy-800));
    box-shadow: 0 0 0 0 rgba(212,175,55,0.35), 0 14px 34px rgba(0,0,0,0.35);
    display: flex; align-items: center; justify-content: center;
    animation: splashPop .6s cubic-bezier(.34,1.56,.64,1) both, splashRing 1.8s ease-out infinite;
}
.splash-square img { width: 46px; height: auto; }
.splash-brand {
    margin-top: 20px; color: #fff; font-family: var(--font-display); font-weight: 700;
    letter-spacing: 3px; font-size: 15px; opacity: 0; animation: splashFadeUp .5s ease .35s forwards;
}
.splash-sub {
    margin-top: 6px; color: var(--gold-400); font-size: 11.5px; letter-spacing: 1.5px;
    text-transform: uppercase; opacity: 0; animation: splashFadeUp .5s ease .55s forwards;
}
.splash-dots { margin-top: 22px; display: flex; gap: 6px; opacity: 0; animation: splashFadeUp .5s ease .75s forwards; }
.splash-dots span {
    width: 6px; height: 6px; border-radius: 50%; background: var(--gold-400);
    animation: splashBounce 1s ease-in-out infinite;
}
.splash-dots span:nth-child(2) { animation-delay: .15s; }
.splash-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes splashPop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes splashRing {
    0% { box-shadow: 0 0 0 0 rgba(212,175,55,0.35), 0 14px 34px rgba(0,0,0,0.35); }
    70% { box-shadow: 0 0 0 18px rgba(212,175,55,0), 0 14px 34px rgba(0,0,0,0.35); }
    100% { box-shadow: 0 0 0 0 rgba(212,175,55,0), 0 14px 34px rgba(0,0,0,0.35); }
}
@keyframes splashFadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes splashBounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-6px); opacity: 1; } }
