/* ============================================================
   NovaCart — dark, AI-forward e-commerce theme
   Palette:
     --bg        #0A0C10  deep space black
     --surface   #12151C  cards / header
     --surface-2 #181C25  hover surfaces
     --border    #232733
     --accent    #7C5CFF  electric violet (AI / primary actions)
     --accent-2  #00D9C0  teal (price / success / CTA)
     --text      #E7E9EE
     --muted     #8A93A6
     --danger    #FF5C7A
   Type: 'Space Grotesk' for headings/brand, 'Inter' for body/UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #0A0C10;
    --surface: #12151C;
    --surface-2: #181C25;
    --border: #232733;
    --accent: #7C5CFF;
    --accent-dim: #7C5CFF33;
    --accent-2: #00D9C0;
    --text: #E7E9EE;
    --muted: #8A93A6;
    --danger: #FF5C7A;
    --radius: 14px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
}
h1, h2, h3, h4, .brand, .btn, .price {
    font-family: 'Space Grotesk', sans-serif;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: var(--radius-sm); border: none;
    font-weight: 600; font-size: 14.5px; transition: transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent-2); color: #06231F; }
.btn-primary:hover { opacity: .9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #2A0510; }

/* ---------- Top header ---------- */
header.site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgba(10,12,16,0.92); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-row {
    display: flex; align-items: center; gap: 20px;
    padding: 14px 0;
}
.brand {
    font-weight: 700; font-size: 22px; letter-spacing: .2px; color: var(--text);
    display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.brand span { color: var(--accent); }

.ai-searchbar {
    flex: 1; position: relative; display: flex; align-items: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 6px 6px 6px 18px;
    transition: border-color .15s ease;
}
.ai-searchbar:focus-within { border-color: var(--accent); }
.ai-searchbar input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text); font-size: 14.5px; padding: 8px 4px;
}
.ai-searchbar input::placeholder { color: var(--muted); }
.ai-searchbar .ai-tag {
    font-size: 11px; font-weight: 600; color: var(--accent);
    border: 1px solid var(--accent-dim); background: var(--accent-dim);
    padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.ai-searchbar button.search-go {
    background: var(--accent); color: #fff; border: none; border-radius: 999px;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.header-icons { display: flex; align-items: center; gap: 18px; }
.icon-btn {
    position: relative; display: flex; flex-direction: column; align-items: center;
    gap: 2px; color: var(--muted); font-size: 11px;
}
.icon-btn:hover { color: var(--text); }
.icon-btn .badge {
    position: absolute; top: -6px; right: -10px;
    background: var(--accent-2); color: #06231F; font-size: 10px; font-weight: 700;
    min-width: 16px; height: 16px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* ---------- Category menu row ---------- */
nav.category-menu {
    display: flex; gap: 22px; overflow-x: auto; padding: 10px 0;
    border-top: 1px solid var(--border); scrollbar-width: none;
}
nav.category-menu::-webkit-scrollbar { display: none; }
nav.category-menu a {
    display: flex; align-items: center; gap: 6px; white-space: nowrap;
    font-size: 13.5px; color: var(--muted); font-weight: 500; padding: 4px 2px;
    border-bottom: 2px solid transparent;
}
nav.category-menu a:hover, nav.category-menu a.active {
    color: var(--text); border-bottom-color: var(--accent-2);
}

/* ---------- Hero ---------- */
.hero {
    padding: 56px 0 40px; border-bottom: 1px solid var(--border);
    background: radial-gradient(600px 240px at 15% 0%, var(--accent-dim), transparent 70%);
}
.hero h1 { font-size: clamp(28px, 4vw, 42px); margin: 0 0 14px; max-width: 640px; }
.hero p { color: var(--muted); max-width: 520px; margin: 0 0 22px; font-size: 15.5px; }

/* ---------- Section headings ---------- */
.section { padding: 40px 0; }
.section-head {
    display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px;
}
.section-head h2 { font-size: 20px; margin: 0; }
.section-head a { font-size: 13.5px; color: var(--accent-2); font-weight: 600; }

/* ---------- Product grid & cards ---------- */
.grid {
    display: grid; gap: 18px;
    grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 980px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }

.select-all-bar {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
    font-size: 13.5px; color: var(--muted);
}
.select-all-bar input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; position: relative; transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.card .pick {
    position: absolute; top: 10px; left: 10px; z-index: 2;
    width: 18px; height: 18px; accent-color: var(--accent);
}
.card .wish-btn {
    position: absolute; top: 8px; right: 8px; z-index: 2;
    background: rgba(10,12,16,0.6); border: 1px solid var(--border);
    width: 30px; height: 30px; border-radius: 999px; color: var(--muted);
    display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.card .wish-btn.active { color: var(--danger); border-color: var(--danger); }
.card .thumb {
    aspect-ratio: 1/1; background: var(--surface-2); display: flex; align-items: center; justify-content: center;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 12px 14px 14px; }
.card .cat-tag { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.card h3 { font-size: 14.5px; font-family: 'Inter'; font-weight: 600; margin: 0 0 6px; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.price { color: var(--accent-2); font-weight: 700; font-size: 16.5px; }
.mrp { color: var(--muted); font-size: 12.5px; text-decoration: line-through; }
.off { color: var(--danger); font-size: 12px; font-weight: 600; }
.rating { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.card .actions { display: flex; gap: 8px; }
.card .actions .btn { flex: 1; }

/* ---------- Filters sidebar ---------- */
.listing-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
@media (max-width: 860px) { .listing-wrap { grid-template-columns: 1fr; } }
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: sticky; top: 100px; }
.filters h4 { margin: 0 0 10px; font-size: 13px; text-transform: none; color: var(--muted); }
.filter-chip {
    display: inline-block; margin: 0 6px 8px 0; padding: 6px 12px; border-radius: 999px;
    border: 1px solid var(--border); font-size: 12.5px; color: var(--muted);
}
.filter-chip.active, .filter-chip:hover { border-color: var(--accent); color: var(--text); }
.filters label { display: block; font-size: 13.5px; color: var(--text); margin-bottom: 8px; }

/* ---------- Product detail ---------- */
.pdp { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 34px 0; }
@media (max-width: 860px) { .pdp { grid-template-columns: 1fr; gap: 20px; } }
.pdp .gallery-main { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); aspect-ratio: 1/1; }
.pdp .thumbs { display: flex; gap: 8px; margin-top: 10px; }
.pdp .thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.pdp h1 { font-size: 24px; margin: 0 0 8px; }
.pdp .brand-line { color: var(--muted); font-size: 13.5px; margin-bottom: 12px; }
.pdp .price-row { font-size: 15px; }
.pdp .price { font-size: 28px; }
.pdp .desc { color: var(--muted); font-size: 14.5px; margin: 18px 0; line-height: 1.7; }
.qty-box { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); width: fit-content; margin-bottom: 18px; }
.qty-box button { background: none; border: none; color: var(--text); width: 34px; height: 34px; font-size: 16px; }
.qty-box span { min-width: 24px; text-align: center; }
.pdp .buy-actions { display: flex; gap: 12px; }

/* ---------- Cart / checkout ---------- */
.cart-row { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.cart-row img { width: 68px; height: 68px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-2); }
.cart-row .info { flex: 1; }
.cart-row h4 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; }
.summary-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.summary-line { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.summary-line.total { color: var(--text); font-weight: 700; font-size: 16px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.coupon-box { display: flex; gap: 8px; margin: 16px 0; }
.coupon-box input { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); }

/* ---------- Forms (auth, checkout address) ---------- */
.form-card { max-width: 420px; margin: 50px auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; }
.form-card h2 { margin: 0 0 6px; }
.form-card p.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 11px 12px; color: var(--text); font-size: 14px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; }
.alert-error { background: #3A1420; color: #FF9BB2; border: 1px solid #5A1E30; }
.alert-success { background: #0F3A32; color: #6FEAD3; border: 1px solid #16594C; }

/* ---------- Footer ---------- */
footer.site-footer { border-top: 1px solid var(--border); margin-top: 60px; padding: 40px 0 90px; color: var(--muted); font-size: 13.5px; }
footer.site-footer .cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
@media (max-width: 700px) { footer.site-footer .cols { grid-template-columns: repeat(2, 1fr); } }
footer.site-footer h5 { color: var(--text); font-size: 13.5px; margin: 0 0 12px; }
footer.site-footer a { display: block; margin-bottom: 8px; }

/* ============================================================
   Floating AI assistant widget + WhatsApp button
   ============================================================ */
.float-stack {
    position: fixed; right: 18px; bottom: 18px; z-index: 60;
    display: flex; flex-direction: column; gap: 12px; align-items: flex-end;
}
.wa-btn {
    width: 50px; height: 50px; border-radius: 999px; background: #1F9D5A;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.ai-fab {
    width: 58px; height: 58px; border-radius: 999px; border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center; font-size: 24px;
    box-shadow: 0 8px 24px rgba(124,92,255,0.45); position: relative;
}
.ai-fab::after {
    content: ''; position: absolute; inset: -5px; border-radius: 999px;
    border: 2px solid var(--accent); opacity: .5; animation: pulse-ring 2.2s ease-out infinite;
}
@keyframes pulse-ring {
    0% { transform: scale(0.9); opacity: .6; }
    100% { transform: scale(1.35); opacity: 0; }
}

.ai-panel {
    position: fixed; right: 18px; bottom: 88px; z-index: 61;
    width: 340px; max-width: calc(100vw - 36px); max-height: 70vh;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0,0,0,0.55); display: none; flex-direction: column; overflow: hidden;
}
.ai-panel.open { display: flex; }
.ai-panel .ai-head {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.ai-avatar {
    width: 34px; height: 34px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.ai-head strong { display: block; font-size: 13.5px; }
.ai-head span { display: block; font-size: 11px; color: var(--accent-2); }
.ai-head span::before { content: '● '; }
.ai-close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 18px; }
.ai-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 85%; padding: 9px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; }
.ai-msg.bot { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.ai-msg.user { background: var(--accent-dim); color: var(--text); align-self: flex-end; border-bottom-right-radius: 4px; }
.ai-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip {
    font-size: 12px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
}
.ai-chip:hover { border-color: var(--accent); color: var(--text); }
.ai-result-card { display: flex; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.ai-result-card img { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; }
.ai-result-card .r-info { flex: 1; min-width: 0; }
.ai-result-card h5 { margin: 0 0 3px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-result-card .r-price { color: var(--accent-2); font-size: 12.5px; font-weight: 700; }
.ai-foot { padding: 10px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.ai-foot input { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 10px 14px; color: var(--text); outline: none; font-size: 13.5px; }
.ai-foot button { background: var(--accent); color: #fff; border: none; width: 38px; height: 38px; border-radius: 999px; }
.typing-dots span { display: inline-block; width: 5px; height: 5px; border-radius: 999px; background: var(--muted); margin-right: 3px; animation: blink 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* ============================================================
   Admin panel layout
   ============================================================ */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
@media (max-width: 820px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-sidebar {
    background: var(--surface); border-right: 1px solid var(--border);
    padding: 20px 16px; position: sticky; top: 0; height: 100vh;
}
@media (max-width: 820px) { .admin-sidebar { position: static; height: auto; display: flex; overflow-x: auto; gap: 6px; padding: 12px; } }
.admin-sidebar .brand { margin-bottom: 22px; }
@media (max-width: 820px) { .admin-sidebar .brand { display: none; } }
.admin-nav a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--muted); font-size: 13.5px; font-weight: 500; margin-bottom: 4px; white-space: nowrap;
}
.admin-nav a:hover, .admin-nav a.active { background: var(--surface-2); color: var(--text); }
.admin-main { padding: 26px 30px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.admin-topbar h1 { font-size: 20px; margin: 0; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
@media (max-width: 700px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card .num { font-size: 26px; font-weight: 700; font-family: 'Space Grotesk'; }
.stat-card .label { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
table.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.admin-table th, table.admin-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; }
table.admin-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); }
table.admin-table tr:last-child td { border-bottom: none; }
.tag-pill { padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.tag-active { background: #0F3A32; color: #6FEAD3; }
.tag-inactive { background: #3A1420; color: #FF9BB2; }

/* ---------- Mobile tweaks ---------- */
@media (max-width: 680px) {
    .header-row { flex-wrap: wrap; }
    .brand { order: 1; }
    .header-icons { order: 2; margin-left: auto; }
    .ai-searchbar { order: 3; width: 100%; flex-basis: 100%; margin-top: 8px; }
    .hero { padding: 34px 0 26px; }
    .pdp .price { font-size: 22px; }
}
