/* ============================================================
   eCard Portal — Responsive (Mobile + Desktop)
   Font: Plus Jakarta Sans
   ============================================================ */

:root {
    --green:        #059669;
    --green-light:  #10b981;
    --green-pale:   #ecfdf5;
    --green-mid:    #d1fae5;
    --green-border: #6ee7b7;
    --teal:         #0d9488;
    --amber:        #f59e0b;
    --amber-light:  #fbbf24;
    --amber-pale:   #fffbeb;
    --amber-mid:    #fef3c7;
    --amber-border: #fcd34d;
    --red:          #ef4444;
    --navy:         #0f2236;
    --navy-mid:     #0a1a28;
    --navy-deep:    #061320;
    --slate:        #334155;
    --muted:        #64748b;
    --muted-light:  #94a3b8;
    --border:       #e2e8f0;
    --bg:           #f0f4f8;
    --white:        #ffffff;
    --surface:      #f8fafc;
    --radius-sm:    10px;
    --radius-md:    16px;
    --radius-lg:    22px;
    --radius-xl:    28px;
    --radius-full:  999px;
    --font:         'Plus Jakarta Sans', sans-serif;
    --shadow-card:  0 4px 24px rgba(15,33,54,0.10);
    --shadow-lg:    0 12px 40px rgba(15,33,54,0.16);
    --max-w:        960px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html {
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    background: var(--navy-deep);
    color: var(--slate);
}

/* ===== SCREEN SYSTEM ===== */
.screen {
    min-height: 100vh;
    display: none;
    opacity: 0;
    transition: opacity 0.32s ease;
}

.screen.active-screen {
    display: block;
    opacity: 1;
}

/* ===== LOGIN SCREEN ===== */
.screen-login {
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 55%, var(--navy-deep) 100%);
    display: none;
    align-items: stretch;
}

.screen-login.active-screen {
    display: flex;
    flex-direction: column;
}

.login-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
}

/* On desktop: side-by-side */
@media (min-width: 768px) {
    .screen-login.active-screen {
        flex-direction: row;
        align-items: stretch;
    }

    .login-inner {
        max-width: var(--max-w);
        flex-direction: row;
        align-items: stretch;
        width: 100%;
    }

    .login-header-art {
        flex: 1;
        min-height: auto;
        border-radius: 0;
        padding: 60px 48px;
        display: flex;
        align-items: center;
    }

    .login-body {
        flex: 0 0 420px;
        border-radius: 0;
        padding: 60px 48px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-shadow: -20px 0 60px rgba(0,0,0,0.12);
    }
}

.login-header-art {
    min-height: 220px;
    display: flex;
    align-items: flex-end;
    padding: 52px 28px 28px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.login-header-art::before {
    content: '';
    position: absolute;
    top: -60px; left: -60px;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(16,185,129,0.2), transparent 68%);
    pointer-events: none;
}

.login-header-art::after {
    content: '';
    position: absolute;
    top: 10px; right: -40px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(245,158,11,0.18), transparent 68%);
    pointer-events: none;
}

.login-brand { position: relative; z-index: 1; }

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(16,185,129,0.15);
    border: 1px solid rgba(16,185,129,0.35);
    border-radius: var(--radius-full);
    padding: 5px 14px 5px 8px;
    margin-bottom: 18px;
}

.brand-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green-light);
    box-shadow: 0 0 8px rgba(16,185,129,0.6);
}

.brand-pill span {
    font-size: 11px;
    font-weight: 700;
    color: var(--green-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-title {
    font-size: clamp(28px, 6vw, 46px);
    font-weight: 800;
    color: #fff;
    line-height: 1.08;
    letter-spacing: -0.5px;
    margin-bottom: 14px;
}

.login-title em {
    color: var(--green-light);
    font-style: normal;
}

.login-tagline {
    font-size: 14px;
    color: rgba(255,255,255,0.48);
    line-height: 1.6;
    max-width: 36ch;
}

.login-body {
    background: var(--white);
    border-radius: 30px 30px 0 0;
    padding: 32px 24px 36px;
    flex-shrink: 0;
}

.language-select {
    width: 100%;
    max-width: 220px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--navy);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.language-select:focus {
    border-color: var(--green-light);
    box-shadow: 0 0 0 4px rgba(16,185,129,0.12);
    background: var(--white);
}

.field-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--slate);
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 9px;
}

.input-wrap {
    position: relative;
    margin-bottom: 18px;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    color: var(--muted-light);
    pointer-events: none;
}

.styled-input {
    width: 100%;
    padding: 15px 16px 15px 44px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: var(--surface);
    font-family: var(--font);
    font-size: 15px;
    color: var(--navy);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    -webkit-appearance: none;
}

.styled-input:focus {
    border-color: var(--green-light);
    box-shadow: 0 0 0 4px rgba(16,185,129,0.12);
    background: var(--white);
}

.chip-row {
    display: flex;
    gap: 8px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.chip {
    padding: 5px 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    user-select: none;
}

.login-btn {
    width: 100%;
    padding: 17px;
    background: linear-gradient(135deg, var(--green) 0%, var(--teal) 100%);
    color: var(--white);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    box-shadow: 0 12px 28px rgba(5,150,105,0.32);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    -webkit-appearance: none;
    margin-bottom: 22px;
}

.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.65; cursor: not-allowed; }

.login-btn .btn-spinner {
    width: 17px; height: 17px;
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.login-footer-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted-light);
}

.login-footer-note svg {
    width: 13px; height: 13px;
    color: var(--green-light);
    flex-shrink: 0;
}

/* ===== DASHBOARD SCREEN ===== */
.screen-dashboard {
    background: var(--bg);
    display: none;
    flex-direction: column;
}

.screen-dashboard.active-screen {
    display: flex;
    flex-direction: column;
}

/* Header */
.dash-header {
    background: linear-gradient(160deg, var(--navy) 0%, #0d3550 100%);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.dash-header::after {
    content: '';
    position: absolute;
    bottom: -50px; right: -30px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(16,185,129,0.25), transparent 65%);
    pointer-events: none;
}

.dash-header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 52px 24px 28px;
    position: relative;
    z-index: 1;
}

@media (min-width: 768px) {
    .dash-header-inner {
        padding: 40px 40px 28px;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        column-gap: 40px;
        align-items: start;
    }

    .dash-toprow { grid-column: 1; grid-row: 1; margin-bottom: 8px; }
    .dash-meta   { grid-column: 1; grid-row: 2; }
    .stat-strip  { grid-column: 2; grid-row: 1 / 3; align-self: center; flex-direction: column; gap: 18px; }
    .stat-mini   { text-align: right; }
}

.dash-toprow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dash-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green-light), var(--teal));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.dash-greeting {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
}

.dash-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.icon-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,0.75);
    transition: background 0.2s;
    padding: 0;
}

.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:active { background: rgba(255,255,255,0.2); }
.icon-btn-danger { color: rgba(239,68,68,0.8); }

.dash-meta {
    font-size: 13px;
    color: rgba(255,255,255,0.4);
    font-weight: 500;
    margin-bottom: 20px;
}

.stat-strip {
    display: flex;
    gap: 28px;
}

.stat-mini { text-align: center; }

.stat-val {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.3px;
}

.stat-lbl {
    font-size: 9px;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

/* Dashboard body */
.dash-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px 40px;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .dash-body {
        padding: 32px 40px 56px;
    }

    .footer-topline {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 24px;
    }

}

/* Inner content wrapper for max-width */
.dash-body-inner {
    max-width: var(--max-w);
    margin: 0 auto;
}

/* On desktop: 2-column layout for cards + redemptions */
@media (min-width: 768px) {
    .dash-layout {
        display: grid;
        grid-template-columns: 1fr 340px;
        gap: 24px;
        align-items: start;
    }
}

/* Loading state */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 80px 20px;
    color: var(--muted-light);
    font-size: 14px;
    font-weight: 500;
}

.spinner {
    width: 32px; height: 32px;
    border: 3px solid rgba(5,150,105,0.18);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* ===== STAMP CARD ===== */
.stamp-card-modern {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    margin-bottom: 16px;
    animation: fadeUp 0.35s ease both;
}

.stamp-card-modern:nth-child(2) { animation-delay: 0.06s; }
.stamp-card-modern:nth-child(3) { animation-delay: 0.12s; }

.card-header-strip {
    background: linear-gradient(135deg, #064e3b 0%, #0f766e 100%);
    padding: 18px 22px 16px;
    position: relative;
    overflow: hidden;
}

.card-header-strip::after {
    content: '';
    position: absolute;
    top: -24px; right: -24px;
    width: 130px; height: 130px;
    background: radial-gradient(circle, rgba(245,158,11,0.28), transparent 65%);
    pointer-events: none;
}

.card-promo-name {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 7px;
    position: relative;
    z-index: 1;
    line-height: 1.2;
}

.card-active-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(16,185,129,0.22);
    border: 1px solid rgba(16,185,129,0.38);
    border-radius: var(--radius-full);
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 700;
    color: #6ee7b7;
    position: relative;
    z-index: 1;
}

.card-archived-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-full);
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    position: relative;
    z-index: 1;
}

.badge-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green-light);
}

/* Progress */
.progress-section {
    padding: 16px 22px 0;
}

.progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 9px;
}

.progress-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.progress-count {
    font-size: 14px;
    font-weight: 800;
    color: var(--navy);
}

.progress-track {
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--surface);
    margin-bottom: 14px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--green), var(--amber));
    transition: width 1.2s cubic-bezier(0.34,1.56,0.64,1);
}

/* Stamp grid */
.stamps-section {
    padding: 0 18px 16px;
}

.stamps-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

/* On wider screens, allow more columns */
@media (min-width: 520px) {
    .stamps-grid {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    }
}

.stamp-cell {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}

.stamp-cell:active { transform: scale(0.95); }

.stamp-cell.empty-cell {
    background: var(--surface);
    border: 1.5px dashed #cbd5e1;
}

.stamp-cell.filled-cell {
    background: linear-gradient(145deg, var(--green-pale), var(--green-mid));
    border: 1.5px solid var(--green-border);
}

.stamp-cell.gift-cell {
    background: linear-gradient(145deg, var(--amber-pale), var(--amber-mid));
    border: 1.5px solid var(--amber-border);
}

.stamp-cell.filled-gift-cell {
    background: linear-gradient(145deg, var(--amber-mid), #fde68a);
    border: 1.5px solid var(--amber);
}

.stamp-num {
    font-size: 14px;
    font-weight: 800;
    color: var(--green);
    line-height: 1;
}

.stamp-cell.empty-cell .stamp-num { color: #cbd5e1; }

.stamp-date-line {
    font-size: 8px;
    font-weight: 600;
    color: var(--green-border);
    margin-top: 2px;
    text-align: center;
}

.stamp-cell.empty-cell .stamp-date-line { color: #e2e8f0; }

.stamp-time-line {
    font-size: 7px;
    font-weight: 500;
    color: rgba(110,231,183,0.7);
    text-align: center;
}

.gift-icon-wrap {
    font-size: 18px;
    line-height: 1;
    margin-bottom: 2px;
}

.gift-cell-label {
    font-size: 7.5px;
    font-weight: 700;
    color: #92400e;
    text-align: center;
    line-height: 1.15;
    padding: 0 2px;
}

.filled-gift-cell .gift-cell-label { color: #78350f; }

/* Card footer */
.card-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 22px 16px;
    border-top: 1px solid var(--border);
}

.cycle-info {
    font-size: 11px;
    color: var(--muted-light);
    font-weight: 500;
}

.cycle-info strong {
    color: var(--slate);
    font-weight: 700;
}

/* Tier chips */
.tiers-section {
    padding: 0 18px 16px;
}

.tiers-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 9px;
}

.tiers-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (min-width: 520px) {
    .tiers-grid {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .tiers-grid::-webkit-scrollbar { display: none; }
}

.tier-chip {
    flex-shrink: 0;
    padding: 10px 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 88px;
}

.tier-chip.is-unlocked { border-color: var(--green-border); background: var(--green-pale); }
.tier-chip.is-redeemed { border-color: var(--amber-border); background: var(--amber-pale); }
.tier-chip.is-locked   { opacity: 0.5; }

.tier-icon { font-size: 18px; }

.tier-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--slate);
    text-align: center;
    line-height: 1.2;
}

.tier-stamps {
    font-size: 9px;
    color: var(--muted-light);
    font-weight: 500;
}

.tier-state {
    font-size: 9px;
    font-weight: 700;
    color: var(--green);
}

.tier-chip.is-redeemed .tier-state { color: var(--amber); }
.tier-chip.is-locked   .tier-state { color: var(--muted-light); }

/* ===== SECTION HEADERS ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0 12px;
}

.section-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--navy);
}

/* ===== REDEMPTION LIST ===== */
.redeem-item {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 12px rgba(15,33,54,0.06);
    margin-bottom: 10px;
    animation: fadeUp 0.35s ease both;
}

.redeem-icon-wrap {
    width: 42px; height: 42px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--amber-pale), var(--amber-mid));
    border: 1px solid var(--amber-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.redeem-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.3;
}

.redeem-meta {
    font-size: 11px;
    color: var(--muted-light);
    margin-top: 2px;
    line-height: 1.3;
}

.redeem-date {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: var(--green);
    text-align: right;
    flex-shrink: 0;
    line-height: 1.4;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted-light);
}

.empty-state-icon {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 13px;
    font-weight: 500;
}

.portal-footer {
    margin-top: 28px;
    padding: 18px 18px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

.portal-footer-dashboard {
    max-width: var(--max-w);
    margin: 28px auto 0;
    padding: 20px 0 0;
}

.footer-topline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.footer-company {
    font-size: 14px;
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 6px;
}

.footer-copy {
    font-size: 12px;
    line-height: 1.6;
}

.footer-language {
    margin-top: 14px;
}

.footer-language-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.footer-pdpa {
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.7;
}

.footer-pdpa strong {
    color: var(--navy);
}

.translate-anchor {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

body > .skiptranslate,
.goog-te-banner-frame,
.goog-logo-link,
.goog-te-gadget span {
    display: none !important;
}

body {
    top: 0 !important;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: rgba(15,33,54,0.93);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: var(--radius-full);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    max-width: calc(100vw - 40px);
    text-align: center;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-success { background: rgba(5,150,105,0.95); }
.toast.toast-error   { background: rgba(220,38,38,0.95); }

.hidden { display: none !important; }

/* ===== ANIMATIONS ===== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== SCROLLBAR (desktop) ===== */
.dash-body::-webkit-scrollbar { width: 4px; }
.dash-body::-webkit-scrollbar-track { background: transparent; }
.dash-body::-webkit-scrollbar-thumb { background: rgba(15,33,54,0.15); border-radius: 99px; }
