/* ===== VARIABLES ===== */
:root {
    --bg: #0d0d0d;
    --bg-card: #161616;
    --bg-hover: #1c1c1c;
    --text: #f0f0f0;
    --text-muted: #777;
    --text-subtle: #3e3e3e;
    --border: #242424;
    --border-hover: #383838;
    --accent: #6c63ff;
    --accent-glow: rgba(108,99,255,0.1);
    --discord: #5865F2;
}

[data-theme="light"] {
    --bg: #f8f8f8;
    --bg-card: #fff;
    --bg-hover: #f0f0f0;
    --text: #111;
    --text-muted: #666;
    --text-subtle: #bbb;
    --border: #e8e8e8;
    --border-hover: #ccc;
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    transition: background 0.2s, color 0.2s;
}

a { text-decoration: none; color: inherit; }
img { display: block; }

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== NAVBAR ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--text);
    flex-shrink: 0;
}
.logo span { color: var(--accent); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.discord-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--discord);
    padding: 5px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}
.discord-link:hover { background: rgba(88,101,242,0.1); }

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
    color: var(--text-muted);
}
.theme-toggle:hover { border-color: var(--border-hover); }

/* ===== FILTER BAR ===== */
.filter-bar {
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    position: sticky;
    top: 54px;
    z-index: 100;
    background: var(--bg);
}

.filter-inner {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 10px;
    color: var(--text-subtle);
    pointer-events: none;
    flex-shrink: 0;
}

.search-box input {
    width: 100%;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0 10px 0 34px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.15s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--text-subtle); }

.sort-select {
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
}

/* ===== CATEGORY BAR ===== */
.cat-bar {
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 106px; /* 54px nav + 52px filter bar */
    z-index: 99;
    background: var(--bg);
}

.cat-scroll {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 8px 0;
}
.cat-scroll::-webkit-scrollbar { display: none; }

.cat-pill {
    padding: 4px 14px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}
.cat-pill:hover { border-color: var(--accent); color: var(--accent); }
.cat-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== MAIN ===== */
.shop-main {
    padding: 16px 0 80px;
    min-height: 60vh;
}

.results-bar {
    margin-bottom: 12px;
    font-size: 0.78rem;
    color: var(--text-subtle);
}

/* ===== PRODUCT GRID ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* ===== PRODUCT CARD ===== */
.product-card {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s;
}
.product-card:hover { border-color: var(--border-hover); }

.card-img {
    aspect-ratio: 1 / 1;
    background: var(--bg-hover);
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}
.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s;
}
.product-card:hover .card-img img { transform: scale(1.04); }

.card-img.no-img::after {
    content: '📦';
    font-size: 1.8rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.15;
}

.card-batch {
    position: absolute;
    top: 7px;
    left: 7px;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.batch-LJR { background: #7c3aed; color: #fff; }
.batch-BD  { background: #2563eb; color: #fff; }
.batch-DG  { background: #ea580c; color: #fff; }
.batch-PK  { background: #16a34a; color: #fff; }
.batch-UA  { background: #dc2626; color: #fff; }
.batch-OG  { background: #d97706; color: #000; }
.batch-other { background: rgba(0,0,0,0.55); color: #fff; }

.card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.card-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
}

.card-price {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text);
}

.card-actions { display: flex; gap: 5px; }

.card-btn {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: none;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
}
.card-btn:hover { border-color: var(--accent); color: var(--accent); }
.card-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.card-btn.primary:hover { opacity: 0.85; color: #fff; }
.card-btn.disabled { opacity: 0.3; cursor: default; pointer-events: none; }

/* ===== STATES ===== */
.loading-state {
    display: flex;
    justify-content: center;
    padding: 80px 0;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-state, .empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-subtle);
    font-size: 0.88rem;
}

/* ===== FOOTER ===== */
.footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
}
.footer-text {
    font-size: 0.76rem;
    color: var(--text-subtle);
    text-align: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .products-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .cat-bar { top: 106px; }
}

@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .products-grid { gap: 8px; }
    .discord-link { display: none; }
}
