/* ══════════════════════════════════════════════════════════════════
   JoyShopping — Mobile-first responsive stylesheet
   Breakpoints:  mobile (base)   ≤640px
                 tablet          641–1023px
                 desktop         ≥1024px
   ══════════════════════════════════════════════════════════════════ */

:root {
    --obsidian: #0a0a0f;
    --ink: #111118;
    --surface: #16161f;
    --card: #1c1c28;
    --card-alt: #22222e;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --gold: #c9a84c;
    --gold-light: #e8c97a;
    --gold-dim: rgba(201, 168, 76, 0.15);
    --cream: #f5f0e8;
    --muted: #8888a0;
    --muted-2: #6b6b80;
    --white: #ffffff;
    --danger: #ff5252;
    --success: #4caf7d;
    --warning: #ffab40;
    --r: 14px;
    --r-lg: 20px;
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .35);
    /* Surfaces that were hard-coded to black. Declaring them as variables
       is what lets the light theme actually reach them — chasing individual
       selectors kept missing cases like #appHeader. */
    --header-bg: rgba(10, 10, 15, 0.9);
    --nav-bg: rgba(10, 10, 15, 0.96);
    --input-bg: rgba(0, 0, 0, 0.35);
    --input-bg-focus: rgba(0, 0, 0, 0.55);
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --img-ctl-bg: rgba(0, 0, 0, 0.55);
    --img-ctl-bg-hover: rgba(0, 0, 0, 0.75);
    /* Subtle overlays. On a dark theme these are white washes; on a light
       theme they must become dark washes or they vanish. Declaring them
       once is what stops the light theme missing individual rules. */
    --panel-bg: rgba(22, 22, 31, 0.94);
    --tint-1: rgba(255, 255, 255, 0.04);
    --tint-2: rgba(255, 255, 255, 0.08);
    --tint-3: rgba(255, 255, 255, 0.14);
    --header-h: 60px;
    --bottom-nav-h: 62px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--obsidian);
    color: var(--cream);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: var(--gold); text-decoration: none; }

/* ── Global utilities ─────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* ── Background canvas ────────────────────────────────────────── */
#bgCanvas {
    position: fixed; inset: 0; z-index: 0;
    pointer-events: none; opacity: 0.25;
}

.page { position: relative; z-index: 1; }

/* ══════════════════════════════════════════════════════════════════
   AUTH SCREENS (login, register, forgot password)
   ══════════════════════════════════════════════════════════════════ */
.auth-scene {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px 16px;
    padding-bottom: calc(20px + var(--safe-bottom));
    position: relative; z-index: 1;
}

.auth-glass {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 32px 22px;
    width: 100%;
    max-width: 440px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    animation: slideUp .5s cubic-bezier(.16,1,.3,1);
}

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

.auth-logo { text-align: center; margin-bottom: 26px; }
.wordmark {
    font-family: 'Playfair Display', serif;
    font-size: 30px; font-weight: 900; line-height: 1;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; letter-spacing: -0.5px;
}
.sub {
    font-size: 11px; color: var(--muted); letter-spacing: 2px;
    text-transform: uppercase; margin-top: 6px; font-weight: 500;
}

.auth-title {
    font-size: 20px; font-weight: 600;
    color: var(--white);
    margin-bottom: 22px;
    text-align: center;
}

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--muted); text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 13px 14px;
    color: var(--cream);
    font-size: 15px;
    transition: border-color .2s, background .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--input-bg-focus);
}
.form-group textarea { resize: vertical; min-height: 88px; }

.btn-primary {
    width: 100%;
    padding: 14px;
    border-radius: var(--r);
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--obsidian);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
    transition: transform .15s, box-shadow .15s, opacity .15s;
    margin-top: 6px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(201,168,76,.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-ghost {
    width: 100%;
    padding: 12px;
    border-radius: var(--r);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--cream);
    font-size: 14px;
    margin-top: 8px;
    transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: var(--tint-1); border-color: var(--border-strong); }

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted);
}
.auth-switch a { color: var(--gold); font-weight: 500; }

.auth-inline-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
    transition: color .15s;
}
.auth-inline-link:hover { color: var(--gold); }

.alert {
    padding: 11px 13px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 14px;
    line-height: 1.4;
}
.alert-error {
    background: rgba(255,82,82,.12);
    border: 1px solid rgba(255,82,82,.4);
    color: #ff8a80;
}
.alert-info {
    background: rgba(76,175,125,.12);
    border: 1px solid rgba(76,175,125,.4);
    color: #a3e0c1;
}

.otp-hint {
    background: rgba(201,168,76,.08);
    border: 1px solid rgba(201,168,76,.25);
    color: var(--gold-light);
    font-size: 13px;
    padding: 11px 13px;
    border-radius: 10px;
    margin-bottom: 14px;
    text-align: center;
}
.otp-hint b { color: var(--white); }

/* Language switcher on auth screens */
.auth-lang-bar {
    display: flex; gap: 6px; justify-content: center;
    margin-bottom: 22px;
}
.auth-lang-bar button {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--tint-1);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    transition: all .15s;
}
.auth-lang-bar button.active {
    background: var(--gold-dim);
    border-color: var(--gold);
    color: var(--gold-light);
}

/* ══════════════════════════════════════════════════════════════════
   HEADER (desktop)
   ══════════════════════════════════════════════════════════════════ */
#appHeader {
    position: sticky; top: 0; z-index: 900;
    background: var(--header-bg);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
}
.header-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--header-h);
}
.h-logo {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 22px;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    flex-shrink: 0;
    letter-spacing: -0.3px;
}
.h-search { flex: 1; min-width: 0; }
.h-search input {
    width: 100%; height: 40px;
    background: var(--tint-1);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 16px;
    color: var(--cream);
    font-size: 14px;
}
.h-search input:focus {
    outline: none; border-color: var(--gold); background: var(--tint-2);
}
.h-actions { display: flex; align-items: center; gap: 8px; }
.h-user {
    font-size: 13px; color: var(--muted);
    padding: 6px 10px;
    display: none;   /* only desktop */
}
.h-btn {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
}
.h-btn-ghost { color: var(--cream); }
.h-btn-ghost:hover { background: var(--tint-1); }
.h-btn-outline {
    border: 1px solid var(--border);
    color: var(--cream);
}
.h-btn-outline:hover { border-color: var(--gold); color: var(--gold-light); }

.cart-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--gold-dim);
    border: 1px solid var(--gold);
    color: var(--gold-light);
    font-size: 13px; font-weight: 600;
    transition: transform .15s;
}
.cart-pill:hover { transform: translateY(-1px); }
.cart-badge {
    background: var(--gold);
    color: var(--obsidian);
    font-weight: 700;
    min-width: 20px; height: 20px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 6px; font-size: 11px;
}

/* Language dropdown */
.lang-toggle {
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--cream);
    font-size: 12px;
    display: inline-flex; align-items: center; gap: 4px;
    transition: border-color .15s;
}
.lang-toggle:hover { border-color: var(--gold); }
.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    min-width: 140px;
    padding: 6px;
    z-index: 1200;
    animation: fadeIn .12s;
}
@keyframes fadeIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
.lang-menu button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 10px;
    border-radius: 8px;
    color: var(--cream);
    font-size: 13px; text-align: left;
    transition: background .12s;
}
.lang-menu button:hover { background: var(--tint-1); }
.lang-menu button.active { color: var(--gold-light); }
.lang-menu button.active::after { content: '✓'; margin-left: auto; }
.lang-wrap { position: relative; }

/* Mobile-only "user chip" opens profile */
.mobile-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    display: none;
    align-items: center; justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.mobile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mobile-avatar-fallback {
    color: var(--gold); font-weight: 700; font-size: 13px;
}

/* ══════════════════════════════════════════════════════════════════
   SHOP HERO / FILTERS
   ══════════════════════════════════════════════════════════════════ */
.shop-hero {
    padding: 22px 14px 10px;
    text-align: center;
    max-width: 1200px; margin: 0 auto;
}
.shop-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(24px, 5.5vw, 40px);
    font-weight: 900;
    color: var(--white);
    line-height: 1.15;
}
.shop-title span {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.shop-subtitle {
    color: var(--muted);
    font-size: clamp(13px, 3.5vw, 15px);
    margin-top: 6px;
}

.filters-bar {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 8px;
    max-width: 1200px;
    margin: 16px auto 0;
    padding: 0 14px;
    justify-content: center;
}
.filter-label {
    font-size: 12px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px;
}
.filter-select {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 14px;
    color: var(--cream);
    font-size: 13px;
    min-width: 130px;
    max-width: 100%;
}
.filter-select:focus { outline: none; border-color: var(--gold); }

.shop-content {
    padding: 14px 14px 100px;   /* leave room for mobile bottom nav */
    max-width: 1440px;
    margin: 0 auto;
}

/* ── Products grid ─────────────────────────────────────────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.product-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform .18s, border-color .18s, box-shadow .18s;
    display: flex; flex-direction: column;
}
.product-card:hover {
    transform: translateY(-2px);
    border-color: var(--gold);
    box-shadow: var(--shadow-md);
}
.disc-badge {
    position: absolute; top: 8px; left: 8px; z-index: 3;
    background: linear-gradient(135deg, #ff5252, #ff8a80);
    color: white;
    font-size: 11px; font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(255,82,82,.4);
}
.product-img-wrap {
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #16161f, #22222e);
    position: relative; overflow: hidden;
}
.product-img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .3s;
}
.product-card:hover .product-img { transform: scale(1.04); }
.product-img-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 48px; color: var(--muted-2);
}
.product-body {
    padding: 10px 12px 12px;
    display: flex; flex-direction: column;
    flex: 1;
}
.product-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--white);
    line-height: 1.25;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.35;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 32px;
}
.price-row {
    display: flex; align-items: baseline;
    gap: 6px; flex-wrap: wrap;
    margin-bottom: 6px;
}
.price-main {
    font-size: 15px;
    font-weight: 700;
    color: var(--gold-light);
}
.price-orig {
    font-size: 12px;
    color: var(--muted);
    text-decoration: line-through;
}
.stock-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    display: inline-flex; align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    align-self: flex-start;
}
.stock-tag.in-stock { background: rgba(76,175,125,.15); color: var(--success); }
.stock-tag.low-stock { background: rgba(255,171,64,.15); color: var(--warning); }
.stock-tag.out-of-stock { background: rgba(255,82,82,.15); color: var(--danger); }

.card-stars {
    display: flex; align-items: center; gap: 4px;
    margin-bottom: 8px;
    font-size: 12px;
}
.rating-count-sm {
    color: var(--muted); font-size: 11px; margin-left: 4px;
}
.star.filled { color: var(--gold); }
.star.empty { color: rgba(255,255,255,.15); }

.add-cart-btn {
    margin-top: auto;
    padding: 9px;
    border-radius: 10px;
    background: var(--gold-dim);
    border: 1px solid var(--gold);
    color: var(--gold-light);
    font-weight: 600;
    font-size: 13px;
    transition: all .15s;
}
.add-cart-btn:hover { background: var(--gold); color: var(--obsidian); }
.add-cart-btn.added {
    background: var(--success); border-color: var(--success); color: white;
}

/* ══════════════════════════════════════════════════════════════════
   MODAL / BOTTOM SHEETS
   ══════════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(6px);
    z-index: 1100;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 800px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 20px 16px;
    padding-bottom: calc(20px + var(--safe-bottom));
    position: relative;
    animation: sheetUp .28s cubic-bezier(.16,1,.3,1);
    border: 1px solid var(--border);
}
@keyframes sheetUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    font-size: 18px;
    color: var(--white);
    font-weight: 600;
}
.modal-close {
    background: var(--tint-1);
    width: 34px; height: 34px;
    border-radius: 50%;
    font-size: 20px;
    color: var(--cream);
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.modal-close:hover { background: var(--tint-3); }

/* ── Product detail ────────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
.main-img-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--card);
    border-radius: var(--r);
    overflow: hidden;
    border: 1px solid var(--border);
}
.main-img { width: 100%; height: 100%; object-fit: cover; }
.img-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: var(--img-ctl-bg);
    color: #fff;
    width: 38px; height: 38px;
    border-radius: 50%;
    font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.img-nav:hover { background: var(--img-ctl-bg-hover); }
.img-nav.prev { left: 8px; }
.img-nav.next { right: 8px; }
.img-counter {
    position: absolute; bottom: 8px; right: 8px;
    background: var(--img-ctl-bg);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
}
.thumbs {
    display: flex; gap: 8px;
    overflow-x: auto;
    padding: 10px 0 2px;
    scrollbar-width: none;
}
.thumbs::-webkit-scrollbar { display: none; }
.thumb {
    width: 64px; height: 64px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s, transform .15s;
}
.thumb:hover { transform: translateY(-1px); }
.thumb.active { border-color: var(--gold); }

.detail-name {
    font-size: 22px;
    color: var(--white);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 12px;
}
.disc-box {
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(135deg, rgba(255,82,82,.15), rgba(255,138,128,.05));
    border: 1px solid rgba(255,82,82,.3);
    padding: 10px 12px;
    border-radius: var(--r);
    margin-bottom: 12px;
    flex-wrap: wrap; gap: 6px;
}
.disc-pct {
    color: #ff8a80; font-weight: 700; font-size: 14px;
}
.disc-info {
    color: var(--muted); font-size: 12px;
}
.detail-price {
    font-size: 28px;
    color: var(--gold-light);
    font-weight: 700;
    margin-bottom: 4px;
}
.detail-price-orig {
    color: var(--muted);
    text-decoration: line-through;
    font-size: 15px;
    margin-bottom: 8px;
}
.detail-stock {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    display: inline-flex; gap: 4px;
    margin-bottom: 14px;
}
.detail-stock.in-stock { background: rgba(76,175,125,.15); color: var(--success); }
.detail-stock.low-stock { background: rgba(255,171,64,.15); color: var(--warning); }
.detail-stock.out-of-stock { background: rgba(255,82,82,.15); color: var(--danger); }
.detail-desc {
    background: var(--card);
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--cream);
    margin-bottom: 14px;
    border: 1px solid var(--border);
}
.attr-section-title {
    font-size: 13px; color: var(--white);
    font-weight: 600; margin-bottom: 8px; text-transform: uppercase;
    letter-spacing: 1px;
}
.attr-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 14px;
    font-size: 13px;
}
.attr-table th, .attr-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.attr-table th {
    background: var(--tint-1);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 11px; letter-spacing: 1px;
}
.attr-table tr:last-child td { border-bottom: none; }
.detail-add-btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--r);
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--obsidian);
    font-weight: 700;
    font-size: 15px;
    transition: transform .15s, box-shadow .15s;
}
.detail-add-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(201,168,76,.3); }

/* ── Reviews ───────────────────────────────────────────────────── */
.review-section {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.rating-summary {
    display: flex; gap: 14px;
    background: var(--card);
    padding: 12px 14px;
    border-radius: var(--r);
    margin-bottom: 16px;
    align-items: center;
    border: 1px solid var(--border);
}
.rating-big { font-size: 30px; font-weight: 800; color: var(--gold-light); }
.rating-stars-big { display: flex; gap: 2px; margin-bottom: 4px; }
.rating-count { color: var(--muted); font-size: 12px; }

.review-card {
    background: var(--card);
    padding: 12px 14px;
    border-radius: var(--r);
    margin-bottom: 10px;
    border: 1px solid var(--border);
}
.review-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap; gap: 6px;
}
.review-author { font-size: 13px; font-weight: 600; color: var(--white); }
.review-date { font-size: 11px; color: var(--muted); }
.review-stars { display: flex; gap: 2px; margin-bottom: 6px; }
.review-comment {
    font-size: 14px;
    color: var(--cream);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.review-translate-btn {
    margin-top: 8px;
    background: var(--tint-1);
    border: 1px solid var(--border);
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    color: var(--muted);
    display: inline-flex; align-items: center; gap: 5px;
    transition: all .15s;
}
.review-translate-btn:hover { border-color: var(--gold); color: var(--gold-light); }
.review-translate-btn.showing-translation {
    background: var(--gold-dim);
    border-color: var(--gold);
    color: var(--gold-light);
}
.review-translated-tag {
    font-size: 10px; color: var(--muted);
    margin-top: 4px; font-style: italic;
}
.no-reviews {
    text-align: center;
    padding: 20px;
    color: var(--muted);
    font-size: 13px;
}
.write-review {
    background: var(--card);
    padding: 14px;
    border-radius: var(--r);
    margin-top: 16px;
    border: 1px solid var(--border);
}
.write-review h4 {
    color: var(--white);
    font-size: 15px;
    margin-bottom: 10px;
}
.star-picker {
    display: flex; gap: 6px;
    margin-bottom: 10px;
    font-size: 26px;
}
.star-picker .star {
    cursor: pointer;
    color: rgba(255,255,255,.15);
    transition: color .1s, transform .1s;
}
.star-picker .star:hover,
.star-picker .star.selected { color: var(--gold); }
.star-picker .star:hover { transform: scale(1.1); }
.review-textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    color: var(--cream);
    font-size: 14px;
    resize: vertical;
    min-height: 70px;
}
.review-textarea:focus { outline: none; border-color: var(--gold); }
.submit-review-btn {
    margin-top: 10px;
    padding: 10px 22px;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--obsidian);
    font-weight: 600;
    border-radius: 10px;
    font-size: 13px;
    transition: transform .15s;
}
.submit-review-btn:hover { transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════════════════
   CART SHEET
   ══════════════════════════════════════════════════════════════════ */
.cart-header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.cart-header h2 { font-size: 18px; color: var(--white); }
.cart-body { }
.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.cart-empty-icon { font-size: 48px; margin-bottom: 10px; opacity: .5; }
.cart-item {
    display: flex; gap: 12px; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.cart-item-img, .cart-item-img-ph {
    width: 60px; height: 60px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--card);
    flex-shrink: 0;
}
.cart-item-img-ph {
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: var(--muted-2);
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
    font-weight: 600; font-size: 14px;
    color: var(--white);
    line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.cart-item-price {
    font-size: 12px; color: var(--muted); margin-top: 2px;
}
.cart-qty {
    display: flex; align-items: center; gap: 8px;
    background: var(--card);
    border-radius: 999px;
    padding: 3px;
    margin-top: 4px;
    border: 1px solid var(--border);
    width: fit-content;
}
.cart-qty button {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--tint-1);
    color: var(--cream);
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.cart-qty button:hover { background: var(--gold-dim); color: var(--gold-light); }
.cart-qty span { min-width: 22px; text-align: center; font-size: 13px; }

.cart-remove {
    color: var(--danger);
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 6px;
    transition: background .15s;
}
.cart-remove:hover { background: rgba(255,82,82,.1); }

.cart-total-row {
    display: flex; justify-content: space-between; align-items: center;
    margin: 16px 0;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}
.cart-total-label {
    font-size: 14px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px;
}
.cart-total {
    font-size: 22px; font-weight: 700; color: var(--gold-light);
}
.checkout-btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--r);
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--obsidian);
    font-weight: 700;
    font-size: 15px;
    transition: transform .15s;
}
.checkout-btn:hover { transform: translateY(-1px); }

.delivery-form { margin-top: 16px; }
.delivery-form h3 {
    font-size: 15px;
    color: var(--white);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.form-row { margin-bottom: 12px; }
.form-row label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.summary-box {
    background: var(--card);
    padding: 12px 14px;
    border-radius: var(--r);
    margin: 12px 0;
    border: 1px solid var(--border);
}
.summary-box h4 {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.summary-row {
    display: flex; justify-content: space-between;
    font-size: 13px; color: var(--cream);
    padding: 5px 0;
}
.summary-total {
    display: flex; justify-content: space-between;
    padding-top: 10px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
    font-weight: 700;
    color: var(--gold-light);
    font-size: 15px;
}
.form-actions-row {
    display: flex; gap: 10px;
    margin-top: 14px;
}
.btn-cancel {
    flex: 1;
    padding: 12px;
    border-radius: var(--r);
    background: var(--tint-1);
    color: var(--cream);
    border: 1px solid var(--border);
    font-size: 14px;
    transition: background .15s;
}
.btn-cancel:hover { background: var(--tint-3); }
.btn-place {
    flex: 1;
    padding: 12px;
    border-radius: var(--r);
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--obsidian);
    font-weight: 700;
    font-size: 14px;
    transition: transform .15s;
}
.btn-place:hover { transform: translateY(-1px); }
.btn-place:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ══════════════════════════════════════════════════════════════════
   ORDERS PAGE
   ══════════════════════════════════════════════════════════════════ */
.orders-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 14px 100px;
}
.orders-title {
    font-family: 'Playfair Display', serif;
    color: var(--white);
    font-size: clamp(24px, 5vw, 32px);
    margin-bottom: 20px;
}
.orders-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.ei { font-size: 56px; margin-bottom: 12px; opacity: .5; }

.order-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 16px;
    margin-bottom: 14px;
}
.order-card-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 14px;
    flex-wrap: wrap; gap: 8px;
}
.order-id {
    font-size: 16px;
    color: var(--white);
    font-weight: 700;
}
.order-date {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}
.order-status-badge {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.order-status-badge.pending { background: rgba(255,171,64,.15); color: var(--warning); }
.order-status-badge.processing { background: rgba(74,144,255,.15); color: #90caf9; }
.order-status-badge.shipped { background: rgba(155,89,182,.15); color: #ce93d8; }
.order-status-badge.delivered { background: rgba(76,175,125,.15); color: var(--success); }
.order-status-badge.cancelled { background: rgba(255,82,82,.15); color: var(--danger); }

.timeline {
    display: flex;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 12px;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.timeline::-webkit-scrollbar { display: none; }
.tl-step {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; flex-shrink: 0;
}
.tl-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--card-alt);
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    color: var(--muted);
    transition: all .3s;
}
.tl-dot.done {
    background: var(--success);
    border-color: var(--success);
    color: white;
}
.tl-dot.current {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--obsidian);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201,168,76,.5); }
    50% { box-shadow: 0 0 0 8px rgba(201,168,76,0); }
}
.tl-label {
    font-size: 10px;
    color: var(--muted);
    text-align: center;
    max-width: 60px;
}
.tl-label.done, .tl-label.current { color: var(--white); font-weight: 600; }
.tl-line {
    height: 2px;
    background: var(--border);
    flex: 1;
    min-width: 18px;
    margin-bottom: 20px;
}
.tl-line.done { background: var(--success); }

.order-items-body {
    background: var(--surface);
    border-radius: 10px;
    padding: 6px 10px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
.order-item {
    display: flex; gap: 10px; align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.order-item:last-child { border-bottom: none; }
.order-item img, .order-item-ph {
    width: 42px; height: 42px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--card);
    flex-shrink: 0;
}
.order-item-ph {
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--muted-2);
}
.order-item-info { flex: 1; min-width: 0; }
.order-item-name {
    font-size: 13px; font-weight: 500; color: var(--cream);
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
    overflow: hidden;
}
.order-item-meta { font-size: 11px; color: var(--muted); }
.order-item-price {
    font-size: 13px; font-weight: 600; color: var(--gold-light);
    white-space: nowrap;
}

.order-foot {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.order-meta-item {
    background: var(--surface);
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.order-meta-label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 3px;
}
.order-meta-value { font-size: 12px; color: var(--cream); word-break: break-word; }

.order-total-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px;
    background: linear-gradient(135deg, var(--gold-dim), rgba(201,168,76,.05));
    border: 1px solid var(--gold);
    border-radius: 10px;
}
.otl {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.otv {
    font-size: 18px;
    font-weight: 700;
    color: var(--gold-light);
}

/* ══════════════════════════════════════════════════════════════════
   PROFILE PAGE
   ══════════════════════════════════════════════════════════════════ */
.profile-wrap {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 14px 100px;
}
.profile-hero {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px 18px;
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.avatar-wrap {
    position: relative;
    width: 88px; height: 88px;
    border-radius: 50%;
    background: var(--card-alt);
    border: 2px solid var(--gold);
    overflow: hidden;
    flex-shrink: 0;
}
.avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--gold);
    font-size: 34px; font-weight: 700;
}
.avatar-upload-btn {
    position: absolute;
    right: -2px; bottom: -2px;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--obsidian);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    cursor: pointer;
    border: 2px solid var(--card);
}
.profile-hero-info { flex: 1; min-width: 200px; }
.profile-hero-name {
    font-size: 20px;
    color: var(--white);
    font-weight: 700;
    margin-bottom: 3px;
}
.profile-hero-phone { font-size: 13px; color: var(--muted); }
.profile-hero-role {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--gold-dim);
    color: var(--gold-light);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.profile-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px;
    margin-bottom: 16px;
}
.profile-card h3 {
    font-size: 15px;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.profile-order-preview {
    background: var(--surface);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color .15s;
}
.profile-order-preview:hover { border-color: var(--gold); }
.profile-order-status-line {
    font-size: 14px;
    color: var(--cream);
    margin-top: 8px;
}
.profile-order-status-line .icon { color: var(--gold); }

/* ══════════════════════════════════════════════════════════════════
   RECEIPT MODAL
   ══════════════════════════════════════════════════════════════════ */
.receipt-head {
    text-align: center;
    padding: 16px 0 20px;
}
.receipt-store {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
}
.receipt-sub {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 4px;
}
.receipt-check {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success), #66bb6a);
    color: white;
    font-size: 34px;
    display: flex; align-items: center; justify-content: center;
    margin: 18px auto 10px;
    animation: bounceIn .5s;
}
@keyframes bounceIn {
    0% { transform: scale(0); }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.receipt-success { color: var(--success); font-weight: 600; font-size: 16px; }

.receipt-body { }
.receipt-row {
    display: flex; justify-content: space-between;
    padding: 6px 0; font-size: 13px;
}
.rl { color: var(--muted); }
.rv { color: var(--cream); font-weight: 500; text-align: right; }
.receipt-divider {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 10px 0;
}
.receipt-items-title {
    font-size: 12px; text-transform: uppercase;
    letter-spacing: 1px; color: var(--muted);
    margin: 12px 0 6px;
}
.receipt-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    color: var(--cream);
}
.ri-q { color: var(--muted); }
.ri-p { text-align: right; color: var(--gold-light); font-weight: 500; }
.receipt-total {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0;
}
.rt-l {
    color: var(--muted); font-size: 12px;
    text-transform: uppercase; letter-spacing: 1px;
}
.rt-v {
    font-size: 22px; font-weight: 700; color: var(--gold-light);
}

.receipt-footer { margin-top: 18px; }
.receipt-thank {
    text-align: center; color: var(--muted);
    font-size: 12px; margin-bottom: 12px;
}
.receipt-print, .receipt-close {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: transform .15s;
}
.receipt-print {
    background: var(--tint-1);
    color: var(--cream);
    border: 1px solid var(--border);
    margin-bottom: 8px;
}
.receipt-close {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--obsidian);
}

/* ══════════════════════════════════════════════════════════════════
   AI CHAT
   ══════════════════════════════════════════════════════════════════ */
.chat-fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--bottom-nav-h) + 16px + var(--safe-bottom));
    width: 54px; height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--obsidian);
    font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(201,168,76,.4);
    z-index: 950;
    transition: transform .15s;
}
.chat-fab:hover { transform: scale(1.05); }

.chat-panel {
    position: fixed;
    inset: 0;
    background: var(--surface);
    z-index: 1200;
    display: none;
    flex-direction: column;
    padding-bottom: var(--safe-bottom);
    animation: sheetUp .3s cubic-bezier(.16,1,.3,1);
}
.chat-panel.open { display: flex; }
.chat-header {
    padding: 12px 14px;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.chat-title {
    font-weight: 600; color: var(--white); font-size: 15px;
    flex: 1;
}
.chat-title-sub {
    display: block;
    color: var(--muted); font-size: 11px; font-weight: 400;
    margin-top: 2px;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
}
.chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--obsidian);
    border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--card);
    color: var(--cream);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.chat-input-bar {
    padding: 10px 12px;
    background: var(--ink);
    border-top: 1px solid var(--border);
    display: flex; gap: 8px;
}
.chat-input-bar input {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 16px;
    color: var(--cream);
    font-size: 14px;
}
.chat-input-bar input:focus { outline: none; border-color: var(--gold); }
.chat-send {
    background: var(--gold);
    color: var(--obsidian);
    padding: 0 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
}
.chat-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV
   ══════════════════════════════════════════════════════════════════ */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    display: flex;
    z-index: 900;
}
.bottom-nav.hidden { display: none; }
.bn-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 10px;
    position: relative;
    transition: color .15s;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.bn-icon { font-size: 20px; }
.bn-item.active { color: var(--gold); }
.bn-item .cart-badge-mini {
    position: absolute;
    top: 6px; right: calc(50% - 22px);
    background: var(--gold);
    color: var(--obsidian);
    font-size: 10px;
    font-weight: 700;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 5px;
}

/* ══════════════════════════════════════════════════════════════════
   LOADING STATES
   ══════════════════════════════════════════════════════════════════ */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 14px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.loading-spinner {
    width: 34px; height: 34px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE OVERRIDES
   ══════════════════════════════════════════════════════════════════ */

/* On mobile, hide search bar in header (there's a Search tab in bottom nav
   that flips the mobile screen into search mode). */
@media (max-width: 640px) {
    .h-search { display: none; }
    .h-actions {
        /* Push actions to the right now that h-search (flex:1) is hidden */
        margin-left: auto;
    }
    .h-actions .h-btn-ghost,
    .h-actions .h-btn-outline { display: none; }
    .cart-pill { display: none; }  /* replaced by bottom nav */
    .mobile-avatar { display: flex; }
    .header-inner { gap: 8px; padding: 0 12px; }
    .h-logo { font-size: 20px; }
    .modal-box { max-height: 100vh; max-height: 100dvh; border-radius: 0; }
    .lang-menu { right: -4px; }

    /* Mobile search bar (visible only on mobile — the desktop header search
       is hidden here). Rendered inside the shop-hero above the filters. */
    .mobile-search-bar { display: block; }

    /* iOS Safari zooms the viewport if input font-size < 16px on focus.
       Bump anything a user can tap into. */
    .form-group input,
    .form-group textarea,
    .form-group select,
    .review-textarea,
    .filter-select,
    .chat-input-bar input,
    .mobile-search-bar input {
        font-size: 16px;
    }

    /* Language menu should stay inside viewport on very narrow screens */
    .lang-menu { max-width: calc(100vw - 24px); }

    /* Chat panel: use dynamic viewport height so iOS URL bar doesn't overflow */
    .chat-panel { height: 100vh; height: 100dvh; }
}

/* Very small screens (iPhone SE 1st gen, etc.) */
@media (max-width: 360px) {
    .header-inner { gap: 6px; padding: 0 8px; }
    .h-logo { font-size: 18px; }
    .lang-toggle { padding: 6px 8px; font-size: 11px; }
    .mobile-avatar { width: 30px; height: 30px; }
    .shop-content { padding: 12px 10px 100px; }
    .products-grid { gap: 8px; }
    .product-body { padding: 8px 10px 10px; }
}

/* Mobile search bar (in shop-hero) — hidden on tablet+ */
.mobile-search-bar { display: none; padding: 0 14px; margin-top: 14px; }
.mobile-search-bar input {
    width: 100%;
    background: var(--tint-1);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 11px 18px;
    color: var(--cream);
}
.mobile-search-bar input:focus {
    outline: none; border-color: var(--gold); background: var(--tint-2);
}

/* Tablet & up */
@media (min-width: 641px) {
    :root { --header-h: 64px; }
    .bottom-nav { display: none; }
    .chat-fab { bottom: 24px; }
    .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
    .shop-content { padding: 20px 20px 40px; }
    .cart-pill { display: inline-flex; }
    .h-actions .h-btn-ghost { display: inline-flex; }
    .h-actions .h-btn-outline { display: inline-flex; }
    .modal-overlay { align-items: center; padding: 20px; }
    .modal-box { border-radius: 20px; max-height: 92vh; }
    .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; }
    .auth-glass { padding: 44px 40px; max-width: 460px; }
    .wordmark { font-size: 34px; }
}

/* Desktop */
@media (min-width: 1024px) {
    :root { --header-h: 68px; }
    .products-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .h-user { display: inline; }
    .header-inner { padding: 0 32px; }
    .shop-hero { padding-top: 40px; }
    .modal-box { padding: 28px 30px; }
}

@media (min-width: 1280px) {
    .products-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
}

/* Print (receipt) */
@media print {
    body > *:not(#receiptModal) { display: none !important; }
    #receiptModal, #receiptModal * { visibility: visible; }
    #receiptModal { position: static; background: white; }
    .modal-box { box-shadow: none; border: none; background: white; color: black; }
    .receipt-print, .receipt-close { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   SOCIAL LOGIN (Google / Yandex / Telegram)
   ═══════════════════════════════════════════════════════════════════ */
.social-login-section {
    margin: 20px 0 12px;
}
.social-divider {
    display: flex;
    align-items: center;
    color: #999;
    font-size: 12px;
    margin: 16px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.social-divider::before,
.social-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--tint-3);
}
.social-divider span {
    padding: 0 14px;
}
.social-btn-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--tint-2);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
    justify-content: center;
}
.social-btn:hover {
    background: var(--tint-3);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}
.social-btn svg {
    flex-shrink: 0;
}
#telegramWidgetHost {
    margin-top: 14px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE POLISH — v2 fixes for filters/sort + tighter product cards
   ═══════════════════════════════════════════════════════════════════ */

/* Mobile filters bar: 2×2 grid, hide the FILTER:/SORT: labels since
   the dropdown labels already convey what each select does */
@media (max-width: 640px) {
    .filters-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 0 12px;
        margin-top: 10px;
    }
    .filter-label {
        display: none;
    }
    .filter-select {
        min-width: 0;
        width: 100%;
        padding: 10px 12px;
        font-size: 14px;
    }
    /* Sort dropdown spans full width on second row */
    .filter-select#sortFilter {
        grid-column: span 2;
    }

    /* Tighter product cards for that Ozon/Wildberries density */
    .products-grid { gap: 8px; padding: 0 2px; }
    .product-body { padding: 8px 10px 12px; }
    .product-name {
        font-size: 12.5px;
        line-height: 1.3;
        -webkit-line-clamp: 2;
    }
    .product-price { font-size: 15px; font-weight: 700; }
    .product-old-price { font-size: 11px; }
    .disc-badge { font-size: 10px; padding: 3px 6px; top: 6px; left: 6px; }
    .product-img-wrap { aspect-ratio: 1 / 1; }
    .add-to-cart-btn { padding: 7px 10px; font-size: 12px; }
}

/* Tablet: keep 2 per row for tighter shopping feel (was 3, Islam wants 2/4) */
@media (min-width: 641px) and (max-width: 1023px) {
    .products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }
    /* Filter bar on tablet: horizontal but with sane widths */
    .filters-bar {
        gap: 10px;
    }
    .filter-select { min-width: 150px; }
}

/* Desktop: 4 per row */
@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 18px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   RECEIPT — order code + QR
   ═══════════════════════════════════════════════════════════════════ */
.receipt-code-block {
    text-align: center;
    padding: 16px 12px 14px;
    margin-bottom: 14px;
    border: 2px dashed var(--gold);
    border-radius: 12px;
    background: rgba(212, 175, 55, .06);
}
.rc-label {
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}
.rc-code {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--gold);
    word-break: break-all;
    line-height: 1.2;
}
.rc-copy {
    margin-top: 8px;
    background: var(--tint-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 16px;
    color: var(--cream);
    font-size: 12px;
    cursor: pointer;
    transition: background .15s;
}
.rc-copy:hover { background: var(--tint-3); }
.rc-qr { margin-top: 14px; }
.rc-qr img {
    width: 140px;
    height: 140px;
    /* QR needs a light quiet zone or phone cameras struggle to read it */
    background: #fff;
    padding: 8px;
    border-radius: 10px;
    display: inline-block;
}
.rc-qr-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

.order-code-chip {
    display: inline-block;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--gold);
    background: rgba(212, 175, 55, .1);
    border: 1px solid rgba(212, 175, 55, .3);
    border-radius: 6px;
    padding: 2px 8px;
    margin-left: 8px;
    vertical-align: middle;
}

@media (max-width: 640px) {
    .rc-code { font-size: 21px; letter-spacing: 2px; }
    .rc-qr img { width: 120px; height: 120px; }
}

/* Printed receipt: force light colours so the QR stays scannable on paper */
@media print {
    .no-print { display: none !important; }
    .receipt-code-block {
        border-color: #333 !important;
        background: #fff !important;
        break-inside: avoid;
    }
    .rc-code { color: #000 !important; }
    .rc-label, .rc-qr-hint { color: #444 !important; }
    .rc-qr img { background: #fff !important; }
    .order-code-chip {
        color: #000 !important;
        background: #fff !important;
        border-color: #999 !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   BRAND LOGO + LANGUAGE FLAGS
   ═══════════════════════════════════════════════════════════════════ */

/* Logo uploaded in Site Settings. Hidden until one exists, so a shop
   without a logo still shows a clean wordmark. */
.brand-logo-img {
    max-height: 44px;
    max-width: 160px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 10px;
}
.h-logo .brand-logo-img {
    max-height: 34px;
    max-width: 120px;
    margin: 0 8px 0 0;
    display: inline-block;
    vertical-align: middle;
}
.h-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Language buttons: emoji flags and the drawn Qaraqalpaq flag share a size */
.lang-flag,
.lang-flag-emoji {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
}
.lang-flag {
    width: 21px;
    height: 14px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .18);
}
.lang-flag-emoji {
    font-size: 15px;
    line-height: 1;
}
.auth-lang-bar button,
#langMenu button {
    display: inline-flex;
    align-items: center;
}

@media (max-width: 640px) {
    .brand-logo-img { max-height: 38px; max-width: 130px; }
    .h-logo .brand-logo-img { max-height: 28px; max-width: 96px; }
    .lang-flag { width: 19px; height: 13px; }
}

/* The desktop username is now a button into the profile — keep it looking
   like the label it replaced, but make it obviously clickable. */
.h-user-btn {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background .15s, color .15s;
}
.h-user-btn:hover {
    background: rgba(212, 175, 55, .12);
    color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════════════════════════
   The whole design already runs on CSS variables, so switching themes is
   a matter of redefining them. Scoped to [data-theme="light"] on <html>,
   which app.js sets from localStorage before first paint — that avoids the
   dark-then-light flash on load.

   Gold stays the accent in both themes, darkened here so it holds contrast
   against white. */
html[data-theme="light"] {
    --obsidian: #f4f1ea;
    --ink: #ffffff;
    --surface: #ffffff;
    --card: #ffffff;
    --card-alt: #f7f5f0;
    --border: rgba(20, 20, 30, 0.10);
    --border-strong: rgba(20, 20, 30, 0.18);
    --gold: #9a7c22;
    --gold-light: #b8952f;
    --gold-dim: rgba(154, 124, 34, 0.12);
    --cream: #1b1b23;
    --muted: #5f5f70;
    --muted-2: #83839a;
    --white: #14141c;
    --danger: #c62828;
    --success: #2e7d51;
    --warning: #b26a00;
    --shadow-lg: 0 20px 46px rgba(30, 28, 20, .14);
    --shadow-md: 0 6px 18px rgba(30, 28, 20, .10);

    /* Surfaces and washes. Every one of these is a variable in the base
       stylesheet, so overriding them here reaches every rule — including
       .auth-glass, which was hard-coded dark and left dark text on a dark
       card after logging out in light mode. */
    --panel-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.94);
    --nav-bg: rgba(255, 255, 255, 0.97);
    --input-bg: #ffffff;
    --input-bg-focus: #ffffff;
    --overlay-bg: rgba(28, 26, 20, 0.45);
    --img-ctl-bg: rgba(28, 26, 20, 0.55);
    --img-ctl-bg-hover: rgba(28, 26, 20, 0.75);
    --tint-1: rgba(20, 20, 30, 0.04);
    --tint-2: rgba(20, 20, 30, 0.07);
    --tint-3: rgba(20, 20, 30, 0.12);
}

html[data-theme="light"] body {
    background: var(--obsidian);
    color: var(--cream);
}
html[data-theme="light"] .product-card,
html[data-theme="light"] .auth-card,
html[data-theme="light"] .modal-panel,
html[data-theme="light"] .order-card,
html[data-theme="light"] .profile-card {
    background: var(--card);
    box-shadow: var(--shadow-md);
}
html[data-theme="light"] .social-btn {
    background: rgba(20, 20, 30, .04);
    border-color: rgba(20, 20, 30, .12);
    color: var(--cream);
}
html[data-theme="light"] .social-btn:hover { background: rgba(20, 20, 30, .08); }
html[data-theme="light"] .rc-copy {
    background: rgba(20, 20, 30, .05);
    color: var(--cream);
}
html[data-theme="light"] .social-divider::before,
html[data-theme="light"] .social-divider::after { background: rgba(20, 20, 30, .12); }
html[data-theme="light"] .lang-flag { box-shadow: 0 0 0 1px rgba(20, 20, 30, .15); }

/* Form controls need explicit colours in both themes — a bare input
   otherwise inherits the browser default, which is what made the text
   almost invisible on hover and focus. */
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] .form-group input,
html[data-theme="light"] .form-group textarea,
html[data-theme="light"] .form-group select,
html[data-theme="light"] .filter-select,
html[data-theme="light"] .review-textarea,
html[data-theme="light"] .profile-field input,
html[data-theme="light"] .profile-field textarea {
    background: #ffffff;
    color: #1b1b23;
    border-color: var(--border-strong);
}
html[data-theme="light"] input:hover,
html[data-theme="light"] textarea:hover,
html[data-theme="light"] select:hover,
html[data-theme="light"] .form-group input:focus,
html[data-theme="light"] .form-group textarea:focus,
html[data-theme="light"] .form-group select:focus {
    background: #ffffff;
    color: #1b1b23;
}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder { color: var(--muted-2); }

/* Header contents. The wordmark is a gradient clipped to the text, so it
   needs its own light-theme gradient rather than a plain colour. */
html[data-theme="light"] .h-user,
html[data-theme="light"] .h-user-btn,
html[data-theme="light"] .h-btn-ghost,
html[data-theme="light"] .bn-item,
html[data-theme="light"] .filter-label {
    color: var(--cream);
}
html[data-theme="light"] .h-btn-outline {
    color: var(--cream);
    border-color: var(--border-strong);
}
html[data-theme="light"] .h-btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
}
html[data-theme="light"] .h-search input,
html[data-theme="light"] .mobile-search-bar input {
    background: #fff;
    color: #1b1b23;
    border-color: var(--border-strong);
}
html[data-theme="light"] .lang-menu,
html[data-theme="light"] #langMenu {
    background: #fff;
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}
html[data-theme="light"] #langMenu button { color: var(--cream); }
html[data-theme="light"] #langMenu button:hover { background: var(--gold-dim); }

/* ── The toggle itself ──────────────────────────────────────── */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--cream);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    transition: background .15s, border-color .15s, transform .15s;
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--gold-dim);
    border-color: var(--gold);
    transform: translateY(-1px);
}
.theme-toggle .ic-sun { display: none; }
html[data-theme="light"] .theme-toggle .ic-sun { display: inline; }
html[data-theme="light"] .theme-toggle .ic-moon { display: none; }

/* Smooth the switch, but not for people who prefer less motion */
@media (prefers-reduced-motion: no-preference) {
    body, .product-card, .site-header, .modal-panel, .auth-card {
        transition: background-color .2s ease, color .2s ease;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   PROFILE — avatar, bio, birthday
   ═══════════════════════════════════════════════════════════════════ */
.avatar-edit-wrap {
    position: relative;
    width: 104px;
    height: 104px;
    margin: 0 auto 14px;
}
.avatar-img,
.avatar-fallback {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold);
    display: block;
}
.avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
    color: var(--gold);
    background: var(--card-alt);
}
.avatar-edit-btn {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    background: var(--gold);
    color: #14141c;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-edit-btn:hover { background: var(--gold-light); }

.profile-field { margin-bottom: 14px; }
.profile-field label {
    display: block;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}
.profile-field input,
.profile-field textarea {
    width: 100%;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--card-alt);
    color: var(--cream);
    font: inherit;
}
.profile-field textarea { min-height: 84px; resize: vertical; }
.profile-bio {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    margin-top: 6px;
    white-space: pre-wrap;
}
.profile-age-chip {
    display: inline-block;
    font-size: 12px;
    color: var(--muted);
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 11px;
    margin-top: 8px;
}

/* ── Reviews with avatars ───────────────────────────────────── */
.review-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.review-avatar,
.review-avatar-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.review-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-alt);
    color: var(--gold);
    font-weight: 700;
    font-size: 15px;
    border: 1px solid var(--border);
}
.review-meta { flex: 1; min-width: 0; }
.review-author { font-weight: 600; font-size: 14px; }
.review-date { font-size: 11px; color: var(--muted-2); }
.review-edited { font-style: italic; opacity: .75; }
.review-edit-btn {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--muted);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}
.review-edit-btn:hover { color: var(--gold); border-color: var(--gold); }

.auth-top-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════════
   Language bar on narrow screens
   ═══════════════════════════════════════════════════════════════════
   Adding flags widened each button enough that four of them no longer fit
   on a phone, pushing the row off-screen. Let it wrap and shrink instead
   of overflowing. */
.auth-top-row {
    flex-wrap: wrap;
    max-width: 100%;
}
.auth-lang-bar {
    flex-wrap: wrap;
    max-width: 100%;
}

@media (max-width: 560px) {
    .auth-lang-bar {
        gap: 5px;
    }
    .auth-lang-bar button {
        padding: 5px 9px;
        font-size: 11px;
    }
    /* The flag alone identifies the language once space is tight */
    .auth-lang-bar button .lang-flag {
        width: 18px;
        height: 12px;
        margin-right: 4px;
    }
}

@media (max-width: 400px) {
    /* Two per row rather than a cramped single line */
    .auth-lang-bar button {
        flex: 0 0 calc(50% - 3px);
        justify-content: center;
    }
}

/* Unit suffix beside a price ("12 000 so'm / kg") */
.price-unit {
    font-size: 12px;
    color: var(--muted);
    margin-left: 2px;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   DELIVERY OPTIONS
   ═══════════════════════════════════════════════════════════════════ */
.delivery-options { display: flex; flex-direction: column; gap: 8px; }
.delivery-loading { color: var(--muted); font-size: 13px; padding: 6px 0; }
.delivery-option {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    background: var(--card-alt);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.delivery-option:hover { border-color: var(--gold); }
.delivery-option:has(input:checked) {
    border-color: var(--gold);
    background: var(--gold-dim);
}
.delivery-option input { accent-color: var(--gold); flex-shrink: 0; }
.do-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.do-name { font-weight: 600; font-size: 14px; }
.do-eta, .do-desc { font-size: 12px; color: var(--muted); }
.do-fee {
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
    font-size: 14px;
}

@media (max-width: 480px) {
    .delivery-option { padding: 10px; gap: 9px; }
    .do-name { font-size: 13px; }
    .do-fee { font-size: 13px; }
}

.field-hint {
    font-size: 11.5px;
    color: var(--muted-2);
    margin-top: 5px;
    line-height: 1.45;
}
