/* =====================================================================
   TECH LAB — DESIGN SYSTEM v2
   One source of truth: tokens, layout, header, footer, cards, buttons.
   ===================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Surfaces */
    --bg:        #070b14;
    --surface:   #0d1320;
    --surface-2: #131b2c;
    --surface-3: #1a2438;
    --border:    rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.28);

    /* Text */
    --text:       #f1f5f9;
    --text-2:     #94a3b8;
    --text-3:     #64748b;

    /* Brand accent — used sparingly */
    --accent:     #22d3ee;
    --accent-strong: #06b6d4;
    --accent-ink: #062a33;
    --cta-grad:   linear-gradient(135deg, #2563eb, #06b6d4);

    /* States */
    --success:    #34d399;
    --danger:     #f87171;
    --warning:    #fbbf24;

    /* Type */
    --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-body:    'Inter', 'Segoe UI', sans-serif;

    /* Shape & depth */
    --radius-s: 8px;
    --radius:   14px;
    --radius-l: 20px;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25);
    --shadow-2: 0 8px 30px rgba(0,0,0,.45);
    --glow-cta: 0 4px 24px rgba(34, 211, 238, 0.25);

    /* Legacy variable aliases (older pages still reference these) */
    --primary-blue:   #2563eb;
    --secondary-cyan: #22d3ee;
    --dark-bg:    #070b14;
    --darker-bg:  #0d1320;
    --card-bg:    #131b2c;
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-glow: rgba(37, 99, 235, 0.25);
    --cyber-glow:  rgba(34, 211, 238, 0.18);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; }

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

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

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-s);
    border: none;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--cta-grad);
    color: #fff;
    box-shadow: var(--glow-cta);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 30px rgba(34,211,238,.4); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-disabled, .btn[disabled] {
    background: var(--surface-2);
    color: var(--text-3);
    cursor: not-allowed;
    border: 1px solid var(--border);
    box-shadow: none;
}
.btn-disabled:hover { transform: none; }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

/* =====================================================================
   HEADER
   ===================================================================== */
.site-header {
    background: rgba(7, 11, 20, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 68px;
    padding: 8px 0;
}

.header-left-zone { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.logo-container { display: flex; align-items: center; cursor: pointer; flex-shrink: 0; height: 62px; }
.site-logo { height: 62px; width: auto; object-fit: contain; }

.mobile-menu-btn {
    background: transparent; border: none; display: none;
    flex-direction: column; justify-content: center; gap: 5px;
    width: 40px; height: 40px; cursor: pointer; padding: 8px;
    border-radius: var(--radius-s);
}
.mobile-menu-btn span { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; transition: all .2s; }
.mobile-menu-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.main-nav ul { display: flex; gap: 4px; list-style: none; }
.main-nav a {
    color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 0.95rem;
    padding: 8px 14px; border-radius: var(--radius-s); transition: color .15s, background .15s;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a.active { color: var(--accent); background: rgba(34, 211, 238, 0.08); }

.header-right-group { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Search */
.search-wrapper { width: 260px; }
.search-container { position: relative; width: 100%; }

#search-input {
    width: 100%; padding: 10px 40px 10px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); font-size: 14px;
    font-family: var(--font-body);
    transition: border-color .15s, background .15s; outline: none;
}
#search-input::placeholder { color: var(--text-3); }
#search-input:focus { border-color: var(--accent); background: var(--surface); }

#search-button {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; color: var(--text-2); cursor: pointer;
    font-size: 14px; width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; transition: color .15s;
}
#search-button:hover { color: var(--accent); }

#search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    border-radius: var(--radius); max-height: 420px; overflow-y: auto;
    display: none; z-index: 9999; box-shadow: var(--shadow-2);
}
#search-results.active { display: block; }
.search-result-item {
    padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center; gap: 10px; transition: background .1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item.selected { background: var(--surface-3); }
.result-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.result-category { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.result-price { color: var(--accent); font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.no-results, .search-loading { padding: 22px; text-align: center; color: var(--text-3); font-size: 0.9rem; }
.view-all-results { justify-content: center; color: var(--accent); font-weight: 600; font-size: 0.88rem; }

/* Wallet chip + cart */
.balance-chip {
    display: flex; align-items: center; gap: 7px;
    background: rgba(52, 211, 153, 0.1); padding: 9px 14px; border-radius: 10px;
    border: 1px solid rgba(52, 211, 153, 0.35); color: var(--success);
    text-decoration: none; font-weight: 700; font-size: 13px;
    white-space: nowrap; flex-shrink: 0; transition: background .15s;
}
.balance-chip:hover { background: rgba(52, 211, 153, 0.2); }

.cart-icon {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-2); padding: 9px 14px; border-radius: 10px;
    cursor: pointer; transition: border-color .15s; border: 1px solid var(--border); flex-shrink: 0;
}
.cart-icon:hover { border-color: var(--accent); }
.cart-count {
    background: var(--accent); color: var(--accent-ink); font-weight: 800;
    border-radius: 20px; padding: 1px 8px; font-size: 12px; min-width: 22px; text-align: center;
}
.cart-icon svg { width: 18px; height: 18px; stroke: var(--text-2); stroke-width: 1.8; }

/* Mobile drawer nav */
.mobile-nav {
    display: none; position: fixed; top: 68px; left: 0; right: 0;
    background: rgba(7, 11, 20, 0.97); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-strong);
    padding: 16px; z-index: 999;
}
.mobile-nav.active { display: block; }
.mobile-nav ul { list-style: none; }
.mobile-nav li { margin-bottom: 6px; }
.mobile-nav a {
    color: var(--text); text-decoration: none; font-size: 1.05rem; font-weight: 600;
    display: block; padding: 13px 16px; border-radius: var(--radius-s); transition: background .15s;
}
.mobile-nav a.active, .mobile-nav a:hover { background: var(--surface-2); color: var(--accent); }

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

@media (max-width: 1024px) {
    .main-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    .header-right-group { flex: 1; min-width: 0; }
    .search-wrapper { flex: 1; width: auto; min-width: 90px; }
}
@media (max-width: 550px) {
    .balance-chip span { display: none; }
    .logo-container { height: 42px; }
    .site-logo { height: 42px; }
    .header-content { gap: 10px; }
    /* bottom nav already has profile/login — header chip is redundant on phones */
    .signin-chip { display: none; }
}

/* =====================================================================
   SECTIONS / TYPOGRAPHY HELPERS
   ===================================================================== */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { font-size: clamp(1.4rem, 2.5vw, 1.9rem); color: var(--text); }
.section-head .see-all { color: var(--text-2); text-decoration: none; font-size: 0.9rem; font-weight: 500; white-space: nowrap; }
.section-head .see-all:hover { color: var(--accent); }
.eyebrow { color: var(--accent); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 10px; }

/* =====================================================================
   PRODUCT CARD — the one card used everywhere
   ===================================================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-2);
}

.product-card .card-link { text-decoration: none; display: flex; flex-direction: column; flex: 1; }

.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    padding: 18px; overflow: hidden;
}
.product-image img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .25s ease; }
.product-card:hover .product-image img { transform: scale(1.04); }

.product-info { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-info h3 {
    color: var(--text); font-size: 0.95rem; font-weight: 600; line-height: 1.4;
    font-family: var(--font-body);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.6em;
}
.product-category { color: var(--text-3); font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.product-price { color: var(--text); font-size: 1.15rem; font-weight: 800; font-family: var(--font-display); }

.stock-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; }
.stock-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; }
.in-stock  { color: var(--success); }
.in-stock::before  { background: var(--success); }
.out-of-stock { color: var(--danger); }
.out-of-stock::before { background: var(--danger); }

.card-actions { padding: 0 16px 16px; margin-top: auto; }
.card-actions form { margin: 0; }
.card-actions .btn { width: 100%; }

@media (max-width: 768px) {
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-image { padding: 12px; }
    .product-info { padding: 11px 12px 8px; }
    .product-info h3 { font-size: 0.84rem; }
    .product-price { font-size: 1.02rem; }
    .card-actions { padding: 0 12px 12px; }
    .card-actions .btn { padding: 10px 12px; font-size: 0.86rem; }
    .section { padding: 36px 0; }
}

/* =====================================================================
   FOOTER (desktop)
   ===================================================================== */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 56px 0 32px;
    margin-top: 64px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.2fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 { color: var(--text); margin-bottom: 14px; font-size: 1rem; }
.footer-section p { color: var(--text-2); font-size: 0.9rem; line-height: 1.7; }
.footer-section ul { list-style: none; }
.footer-section ul li { margin-bottom: 9px; }
.footer-section ul a { color: var(--text-2); text-decoration: none; font-size: 0.9rem; transition: color .15s; }
.footer-section ul a:hover { color: var(--accent); }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 22px; text-align: center;
    color: var(--text-3); font-size: 0.84rem;
}

@media (max-width: 1024px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; } }

/* =====================================================================
   MOBILE BOTTOM NAV (app-style)
   ===================================================================== */
.mobile-bottom-nav { display: none; }

@media (max-width: 768px) {
    /* App mode: no website footer — the tab bar is the navigation */
    .desktop-footer { display: none; }

    main { padding-bottom: 90px; }

    .mobile-bottom-nav {
        display: block;
        position: fixed; bottom: 0; left: 0; right: 0;
        background: rgba(10, 15, 26, 0.96);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border-top: 1px solid var(--border);
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-nav-container {
        display: flex; justify-content: space-around; align-items: stretch;
        height: 60px; max-width: 480px; margin: 0 auto;
    }

    .mobile-nav-item {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 4px; color: var(--text-3); text-decoration: none;
        font-size: 0.6rem; font-weight: 600; flex: 1;
        transition: color .15s, transform .1s;
        position: relative;
    }
    .mobile-nav-item i { font-size: 1.18rem; transition: transform .15s; }
    .mobile-nav-item:active { transform: scale(0.92); }
    .mobile-nav-item.active { color: var(--accent); }
    .mobile-nav-item.active::before {
        content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
        width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
    }

    /* App touch feel: press feedback instead of hover */
    .product-card:active { transform: scale(0.98); }
    .category-tile:active { transform: scale(0.98); }
    .btn:active { transform: scale(0.97); }

    /* Subtle screen-in animation, like an app view change */
    main { animation: appFadeIn .22s ease-out; }
    @keyframes appFadeIn {
        from { opacity: 0; transform: translateY(6px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Larger touch targets */
    .card-actions .btn { min-height: 42px; }
    .toolbar select { min-height: 42px; }
}

/* =====================================================================
   FLASH MESSAGES
   ===================================================================== */
.flash { max-width: 720px; margin: 0 auto 22px; padding: 13px 18px; border-radius: var(--radius-s); text-align: center; font-size: 0.92rem; font-weight: 500; }
.flash.error   { background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248,113,113,.4); color: var(--danger); }
.flash.success { background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52,211,153,.4); color: var(--success); }

/* =====================================================================
   HOMEPAGE — hero, trust strip, category tiles
   ===================================================================== */
.hero {
    padding: 72px 0 56px;
    background:
        radial-gradient(800px 400px at 85% -10%, rgba(37, 99, 235, 0.18), transparent 60%),
        radial-gradient(600px 350px at 10% 110%, rgba(34, 211, 238, 0.1), transparent 60%);
}
.hero-inner { max-width: 720px; }
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}
.hero h1 .accent { color: var(--accent); }
.hero p.lead { color: var(--text-2); font-size: clamp(1rem, 2vw, 1.15rem); margin-bottom: 28px; max-width: 560px; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }

.trust-strip { border-block: 1px solid var(--border); background: var(--surface); }
.trust-strip .container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding-top: 18px; padding-bottom: 18px; }
.trust-item { display: flex; align-items: center; gap: 12px; justify-content: center; }
.trust-item i { color: var(--accent); font-size: 1.15rem; flex-shrink: 0; }
.trust-item .t { font-size: 0.86rem; }
.trust-item .t strong { display: block; color: var(--text); font-weight: 600; }
.trust-item .t span { color: var(--text-3); font-size: 0.78rem; }

@media (max-width: 768px) {
    .hero { padding: 44px 0 36px; }
    .trust-strip .container { grid-template-columns: 1fr; gap: 10px; }
    .trust-item { justify-content: flex-start; }
}

/* Category tiles — photo cards, all visible, snap-scroll on mobile */
.category-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}
.category-tile {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    display: flex; align-items: flex-end;
    aspect-ratio: 16 / 10;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.category-tile:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow-2); }

.tile-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(7,11,20,0.92) 0%, rgba(7,11,20,0.35) 55%, rgba(7,11,20,0.05) 100%);
}
.tile-text { position: relative; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.category-tile .name { color: var(--text); font-weight: 700; font-size: 1rem; font-family: var(--font-display); }
.category-tile .count { color: var(--text-2); font-size: 0.78rem; }

@media (max-width: 768px) {
    .category-tiles {
        display: flex; overflow-x: auto; gap: 11px;
        scroll-snap-type: x mandatory; padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .category-tiles::-webkit-scrollbar { display: none; }
    .category-tile { min-width: 200px; scroll-snap-align: start; }
}

/* =====================================================================
   STORE PAGE
   ===================================================================== */
.store-hero { text-align: center; padding: 48px 20px 26px; }
.store-hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 10px; }
.store-hero p { color: var(--text-2); max-width: 520px; margin: 0 auto; }

.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 0 16px 34px; }
.cat-chips a {
    color: var(--text-2); border: 1px solid var(--border); background: var(--surface);
    padding: 8px 16px; border-radius: 100px; text-decoration: none; font-size: 0.86rem; font-weight: 500;
    transition: all 0.15s;
}
.cat-chips a:hover { border-color: var(--accent); color: var(--accent); }

.store-section { max-width: 1240px; margin: 0 auto 48px; padding: 0 20px; }
.store-section-header { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.store-section-header .icon { font-size: 1.4rem; }
.store-section-header h2 { color: var(--text); font-size: 1.3rem; flex: 1; }
.store-section-header a { color: var(--text-3); text-decoration: none; font-size: 0.85rem; white-space: nowrap; }
.store-section-header a:hover { color: var(--accent); }

/* =====================================================================
   CATEGORY PAGE
   ===================================================================== */
.category-header { padding: 44px 0 8px; }
.category-header h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: 6px; }
.product-count { color: var(--text-3); font-size: 0.9rem; }

.toolbar {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    margin: 20px 0 24px; flex-wrap: wrap;
}
.toolbar label { color: var(--text-2); font-size: 0.88rem; font-weight: 500; }
.toolbar select {
    padding: 9px 14px; background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius-s); cursor: pointer; font-family: var(--font-body); font-size: 0.88rem;
}
.toolbar select:focus { outline: none; border-color: var(--accent); }

/* =====================================================================
   GENERIC PAGE CARD (auth/account boxes reuse)
   ===================================================================== */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    padding: 32px;
}
