/* ============================================================= *
 *  Crown Royale — luxury design system
 * ============================================================= */
:root {
    --gold: #c9a24b;
    --gold-light: #e6cd86;
    --gold-bright: #f4e2a0;
    --ink: #0b0b0d;
    --cream: #f4f1ea;
    --muted: #8a8681;
    --line: rgba(201, 162, 75, 0.16);
    --gold-grad: linear-gradient(135deg, #f4e2a0, #c9a24b 55%, #9c7a2e);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--cream);
    font-family: 'Sora', ui-sans-serif, system-ui, sans-serif;
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, .serif { font-family: 'Sora', ui-sans-serif, system-ui, sans-serif; font-weight: 500; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

::selection { background: rgba(201, 162, 75, 0.3); color: #fff; }

/* --- scrollbar --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #2a2620; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a352b; }

/* --- layout helpers --- */
.container-cr { max-width: 1240px; margin: 0 auto; padding: 0 24px; width: 100%; }
.section { padding: clamp(48px, 8vw, 100px) 0; }
.eyebrow {
    font-size: 11px; letter-spacing: 0.4em; text-transform: uppercase;
    color: var(--gold); margin-bottom: 14px;
}
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.gold-light { color: var(--gold-light); }
.hr-gold { height: 1px; background: var(--line); border: 0; }

.gold-text {
    background: linear-gradient(135deg, #f4e2a0, #c9a24b);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* --- buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 15px 32px; border-radius: 2px; cursor: pointer;
    font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 500;
    border: 1px solid transparent; transition: all 0.25s ease; font-family: inherit;
    white-space: nowrap;
}
.btn-gold {
    background: var(--gold-grad); color: var(--ink); font-weight: 600; border: none;
    box-shadow: 0 10px 30px rgba(201, 162, 75, 0.22);
}
.btn-gold:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 14px 36px rgba(201, 162, 75, 0.32); }
.btn-outline {
    background: rgba(11, 11, 13, 0.35); color: var(--gold-light);
    border: 1px solid rgba(201, 162, 75, 0.5);
}
.btn-outline:hover { background: rgba(201, 162, 75, 0.12); }
.btn-block { width: 100%; }
.btn-sm { padding: 10px 18px; font-size: 10px; letter-spacing: 0.14em; }

/* --- forms --- */
.field { width: 100%; padding: 14px 16px; background: #141210; border: 1px solid rgba(201, 162, 75, 0.24);
    border-radius: 2px; color: var(--cream); font-size: 14px; outline: none; font-family: inherit; transition: border 0.2s; }
.field:focus { border-color: rgba(201, 162, 75, 0.6); }
.field::placeholder { color: #6b6862; }
select.field option { background: #141210; }
.label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 6px; }

/* --- cards --- */
.card {
    border: 1px solid var(--line); border-radius: 4px;
    background: linear-gradient(180deg, #121110, #0a0a0a); overflow: hidden;
}
.panel { border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(160deg, #141210, #0a0a0a); padding: 24px; }

/* --- product cards --- */
.product-card { border: 1px solid var(--line); border-radius: 4px; background: linear-gradient(180deg, #121110, #0a0a0a);
    overflow: hidden; transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-6px); border-color: rgba(201, 162, 75, 0.45); box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5); }
.product-card .thumb { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: #0a0a0a; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.product-card:hover .thumb img { transform: scale(1.06); }
.badge { position: absolute; top: 14px; left: 14px; z-index: 2; padding: 5px 12px; font-size: 9px;
    letter-spacing: 0.18em; text-transform: uppercase; border-radius: 2px; background: var(--gold-grad); color: var(--ink); font-weight: 600; }
.badge-soft { background: rgba(11,11,13,.7); color: var(--gold-light); border: 1px solid rgba(201,162,75,.4); }

/* --- grid --- */
.grid-cr { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-2.stack-sm { grid-template-columns: 1fr; } }
@media (max-width: 460px) { .grid-4, .grid-3 { grid-template-columns: 1fr; } }

/* --- header / nav --- */
.topbar {
    background: linear-gradient(90deg, #1a1712, #100f0d, #1a1712); color: var(--gold);
    text-align: center; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    padding: 8px 12px; border-bottom: 1px solid rgba(201, 162, 75, 0.18);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: #040707;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; min-height: 60px; padding: 8px 0;
}
.nav-links {
    display: flex; gap: 28px; align-items: center;
    font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
}
.nav-links a, .nav-link { color: var(--cream); transition: color 0.2s; }
.nav-links a:hover, .nav-link:hover { color: var(--gold); }
.brand {
    display: inline-flex; align-items: center; flex: 0 0 auto; line-height: 0;
    text-decoration: none;
}
.brand-logo {
    display: block;
    height: 52px;
    width: auto;
    max-width: min(180px, 42vw);
    object-fit: contain;
}
.brand small {
    display: block; font-size: 8px; letter-spacing: 0.24em; color: var(--muted);
    text-transform: uppercase; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.icon-btn {
    cursor: pointer; color: var(--cream); background: none; border: 0; padding: 0;
    width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 4px; position: relative; -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover, .icon-btn:focus-visible { color: #fff; background: rgba(201,162,75,.1); outline: none; }
.icon-btn svg { display: block; pointer-events: none; }
.cart-count {
    position: absolute; top: 4px; right: 2px; background: var(--gold-grad); color: var(--ink);
    font-size: 9px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.hamburger { display: none; }
.hamburger-lines {
    width: 20px; height: 14px; display: flex; flex-direction: column; justify-content: space-between;
}
.hamburger-lines span {
    display: block; height: 1.5px; width: 100%; background: currentColor;
    transition: transform .25s ease, opacity .2s;
}
.site-header.is-menu-open .hamburger-lines span:nth-child(1) { transform: translateY(6.25px) rotate(45deg); }
.site-header.is-menu-open .hamburger-lines span:nth-child(2) { opacity: 0; }
.site-header.is-menu-open .hamburger-lines span:nth-child(3) { transform: translateY(-6.25px) rotate(-45deg); }

/* Mobile panel — drops under header */
.mobile-panel {
    display: none;
    border-top: 1px solid var(--line);
    background: #0e0d0c;
    max-height: min(80vh, 640px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.site-header.is-menu-open .mobile-panel {
    display: block !important;
}
.mobile-panel-links { display: flex; flex-direction: column; padding: 8px 0 12px; }
.mobile-panel-links a {
    display: flex; align-items: center;
    min-height: 52px; padding: 14px 0;
    font-size: 18px; border-bottom: 1px solid rgba(201,162,75,.12);
    -webkit-tap-highlight-color: transparent;
}
.mobile-panel-links a:active { color: var(--gold); }
.mobile-theme-btn {
    width: 100%; min-height: 48px; margin: 12px 0 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px;
    background: rgba(201,162,75,.06); color: var(--cream);
    font-family: inherit; font-size: 14px; cursor: pointer;
}
.mobile-theme-btn .icon-moon { display: none; }
.theme-label-light { display: none; }
html[data-theme="light"] .mobile-theme-btn .icon-sun { display: none; }
html[data-theme="light"] .mobile-theme-btn .icon-moon { display: block; }
html[data-theme="light"] .theme-label-dark { display: none; }
html[data-theme="light"] .theme-label-light { display: inline; }
body.menu-open { overflow: hidden; }

@media (max-width: 960px) {
    .desktop-nav { display: none !important; }
    .desktop-only { display: none !important; }
    .hamburger { display: inline-flex !important; }
    .container-cr { padding-left: 16px; padding-right: 16px; }
    .brand-logo { height: 42px; max-width: min(150px, 40vw); }
}
@media (max-width: 480px) {
    .nav { min-height: 56px; padding: 4px 0; }
    .icon-btn { width: 42px; height: 42px; }
    .topbar { font-size: 9px; letter-spacing: 0.06em; padding: 7px 10px; }
}

/* Mobile page layout */
@media (max-width: 680px) {
    .hero {
        min-height: 70vh; align-items: flex-end; padding: 32px 0 40px;
    }
    .hero-bg::after {
        background: linear-gradient(180deg, rgba(11,11,13,.25) 0%, rgba(11,11,13,.75) 48%, rgba(11,11,13,.96) 100%);
    }
    .hero-inner { max-width: 100%; }
    .hero h1 { font-size: clamp(34px, 10vw, 48px); margin-bottom: 12px; }
    .hero .flex { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; width: 100%; }
    .btn { width: 100%; padding: 15px 18px; white-space: normal; text-align: center; }
    .section { padding: 36px 0; }
    .field { font-size: 16px; }
    .panel { padding: 16px; }
    .product-card:hover { transform: none; box-shadow: none; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
    .admin-main { padding: 16px 12px; }
    .grid-cr[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    aside.panel { position: static !important; }
    .cat-tile { aspect-ratio: 3 / 3.4; }
    .cat-tile .cap h3 { font-size: 18px; }
}

/* --- hero --- */
.hero { position: relative; min-height: clamp(560px, 82vh, 820px); display: flex; align-items: center; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.hero-bg::after { content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(11,11,13,0.94) 0%, rgba(11,11,13,0.7) 45%, rgba(11,11,13,0.35) 100%); }
.hero-inner { position: relative; z-index: 2; max-width: 620px; }
.hero h1 { font-size: clamp(44px, 7vw, 82px); line-height: 1.0; margin: 0 0 22px; }

/* --- category tile --- */
.cat-tile { position: relative; border-radius: 4px; overflow: hidden; aspect-ratio: 3 / 4; cursor: pointer; border: 1px solid var(--line); }
.cat-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.cat-tile:hover img { transform: scale(1.07); }
.cat-tile::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(11,11,13,0.9)); }
.cat-tile .cap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 22px; text-align: center; }
.cat-tile .cap h3 { font-size: 22px; margin: 0; }
.cat-tile .cap span { font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold); }

/* --- footer --- */
.site-footer { border-top: 1px solid var(--line); background: #040707; padding: 64px 0 30px; margin-top: 40px; }
.footer-cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.footer-cols h4 { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); margin: 0 0 18px; font-family: 'Sora', sans-serif; font-weight: 500; }
.footer-cols a, .footer-cols span.lnk { display: block; color: var(--muted); font-size: 13px; margin-bottom: 12px; cursor: pointer; transition: color 0.2s; }
.footer-cols a:hover, .footer-cols span.lnk:hover { color: var(--cream); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
    margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); color: #6b6862; font-size: 12px; }
@media (max-width: 820px) { .footer-cols { grid-template-columns: 1fr 1fr; gap: 30px; } }
@media (max-width: 480px) { .footer-cols { grid-template-columns: 1fr; } }

/* --- flash / alerts --- */
.flash { padding: 14px 18px; border-radius: 3px; font-size: 13px; letter-spacing: 0.02em; margin-bottom: 18px; }
.flash-success { background: rgba(111, 174, 143, 0.12); border: 1px solid rgba(111, 174, 143, 0.4); color: #8fd0ae; }
.flash-error { background: rgba(201, 90, 90, 0.12); border: 1px solid rgba(201, 90, 90, 0.4); color: #e59b9b; }

/* --- status pills --- */
.pill { display: inline-block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; padding: 6px 14px; border-radius: 2px; }
.pill-gold { background: rgba(201,162,75,.16); color: var(--gold-light); }
.pill-green { background: rgba(111,174,143,.16); color: #8fd0ae; }
.pill-grey { background: rgba(138,134,129,.16); color: var(--muted); }
.pill-red { background: rgba(201,90,90,.16); color: #e59b9b; }

/* --- tables --- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; padding: 14px 10px; font-weight: 500; color: var(--muted); font-size: 11px;
    letter-spacing: 0.12em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.tbl td { padding: 14px 10px; border-bottom: 1px solid rgba(201, 162, 75, 0.08); }
.tbl tr:hover td { background: rgba(201, 162, 75, 0.03); }
.table-wrap { overflow-x: auto; }

/* --- admin layout --- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side { width: 250px; flex-shrink: 0; background: #0a0908; border-right: 1px solid var(--line);
    padding: 26px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-main { flex: 1; min-width: 0; padding: 30px clamp(20px, 4vw, 44px); }
.admin-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 4px; font-size: 13px;
    color: var(--muted); margin-bottom: 4px; transition: all 0.2s; letter-spacing: 0.02em; }
.admin-nav a:hover { color: var(--cream); background: rgba(201, 162, 75, 0.06); }
.admin-nav a.active { color: var(--gold-light); background: rgba(201, 162, 75, 0.1); }
.stat-card { padding: 22px; border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(160deg, #141210, #0a0a0a); }
.stat-card .val { font-family: 'Sora', sans-serif; font-size: 34px; font-weight: 600; color: var(--gold-light); }
@media (max-width: 860px) {
    .admin-side { position: fixed; left: 0; top: 0; z-index: 100; transform: translateX(-100%); transition: transform 0.3s; }
    .admin-side.open { transform: translateX(0); }
    .admin-toggle { display: inline-flex !important; }
}
.admin-toggle { display: none; }

/* utilities */
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-sm { gap: 10px; }
.gap-md { gap: 20px; }
.text-center { text-align: center; }
.mt-sm { margin-top: 12px; } .mt-md { margin-top: 24px; } .mt-lg { margin-top: 40px; }
.mb-sm { margin-bottom: 12px; } .mb-md { margin-bottom: 24px; } .mb-lg { margin-bottom: 40px; }
.hidden { display: none; }
.fade-up { animation: fadeUp 0.6s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ============================================================= *
 *  Light theme
 * ============================================================= */
html[data-theme="light"] {
    --ink: #f7f4ee;
    --cream: #1a1814;
    --muted: #6b6560;
    --line: rgba(150, 120, 60, 0.22);
    --gold: #9c7a2e;
    --gold-light: #7a5c1e;
    --gold-bright: #c9a24b;
    --gold-grad: linear-gradient(135deg, #e6cd86, #c9a24b 55%, #9c7a2e);
}
html[data-theme="light"] body { background: var(--ink); color: var(--cream); }
html[data-theme="light"] .topbar {
    background: linear-gradient(90deg, #efe8d8, #f7f4ee, #efe8d8);
    color: #9c7a2e; border-bottom-color: rgba(150,120,60,.25);
}
html[data-theme="light"] .site-header {
    background: rgba(247, 244, 238, 0.95); border-bottom-color: var(--line);
}
html[data-theme="light"] .mobile-panel { background: #f3efe6; }
html[data-theme="light"] .mobile-theme-btn { background: rgba(156,122,46,.08); }
html[data-theme="light"] .card,
html[data-theme="light"] .panel,
html[data-theme="light"] .product-card,
html[data-theme="light"] .stat-card {
    background: linear-gradient(180deg, #fffdf8, #f3efe6);
    border-color: var(--line);
}
html[data-theme="light"] .field {
    background: #fff; border-color: rgba(150,120,60,.3); color: #1a1814;
}
html[data-theme="light"] .field::placeholder { color: #9a948c; }
html[data-theme="light"] .site-footer { background: #efeae0; }
html[data-theme="light"] .admin-side { background: #f3efe6; }
html[data-theme="light"] .hero-bg::after {
    background: linear-gradient(90deg, rgba(247,244,238,0.92) 0%, rgba(247,244,238,0.65) 45%, rgba(247,244,238,0.25) 100%);
}
html[data-theme="light"] .btn-outline {
    background: rgba(255,255,255,.55); color: #7a5c1e; border-color: rgba(156,122,46,.5);
}
html[data-theme="light"] ::-webkit-scrollbar-track { background: #efeae0; }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #d4cbb8; }

.theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.icon-btn svg { display: block; }

.qty-stepper.is-loading { opacity: 0.55; pointer-events: none; }

.stock-limit-msg {
    display: block;
    margin: 8px 0 0;
    padding: 10px 12px;
    font-size: 13px;
    color: #e59b9b;
    background: rgba(201, 90, 90, 0.12);
    border: 1px solid rgba(201, 90, 90, 0.35);
    border-radius: 3px;
}
.stock-limit-msg[hidden] { display: none !important; }

/* Admin search + notifications */
.admin-search-wrap { position: relative; flex: 1; max-width: 420px; }
.admin-search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 80;
    background: #121110; border: 1px solid var(--line); border-radius: 6px;
    max-height: 420px; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
html[data-theme="light"] .admin-search-results { background: #fffdf8; }
.admin-search-group { padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-search-group .label { padding: 4px 14px 8px; }
.admin-search-item {
    display: flex; gap: 12px; align-items: center; padding: 10px 14px; color: inherit;
}
.admin-search-item:hover { background: rgba(201,162,75,.08); }
.admin-search-item img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; }
.admin-search-item strong { display: block; font-size: 13px; font-weight: 500; }
.admin-search-item small { color: var(--muted); font-size: 11px; }

.admin-notif-wrap { position: relative; }
.admin-notif-dropdown {
    position: absolute; right: 0; top: calc(100% + 10px); width: 340px; z-index: 90;
    background: #121110; border: 1px solid var(--line); border-radius: 6px;
    box-shadow: 0 20px 50px rgba(0,0,0,.45); max-height: 420px; overflow: auto;
}
html[data-theme="light"] .admin-notif-dropdown { background: #fffdf8; }
.admin-notif-item {
    display: block; padding: 12px 14px; border-bottom: 1px solid rgba(201,162,75,.08); color: inherit;
}
.admin-notif-item.unread { background: rgba(201,162,75,.06); }
.admin-notif-item strong { display: block; font-size: 13px; margin-bottom: 2px; }
.admin-notif-item span { display: block; font-size: 12px; color: var(--muted); }
.admin-notif-item small { font-size: 10px; color: var(--muted); letter-spacing: .04em; }

#admin-toast-host {
    position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.admin-toast {
    display: block; min-width: 280px; max-width: 360px; padding: 14px 16px;
    background: #141210; border: 1px solid rgba(201,162,75,.4); border-radius: 6px; color: #f4f1ea;
    transform: translateX(20px); opacity: 0; transition: all .35s ease; text-decoration: none;
    box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.admin-toast.show { transform: none; opacity: 1; }
.admin-toast strong { display: block; color: #e6cd86; font-size: 13px; margin-bottom: 4px; }
.admin-toast span { font-size: 12px; color: #8a8681; }

