/* ==========================================================================
   1. GRUNDINSTÄLLNINGAR & DESIGNVARIABLER (Fungerar på alla skärmar)
   ========================================================================== */
:root {
    --bg-main: #0b0f19;
    --bg-card: #151b2c;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --accent-color: #3b82f6;
    --sale-color: #ef4444;
    --preorder-color: #10b981;
    --border-color: #242f47;
    --font-sans: 'Inter', sans-serif;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ==========================================================================
   2. HEADER, SÖKFÄLT & LOGOTYP
   ========================================================================== */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 20px 20px;
    gap: 20px;
}

.header-center-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 500px;
}

header .logo {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

header .logo:hover { transform: scale(1.02); }

.search-container { 
    width: 100%; 
}

.search-container input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-container input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.cart-trigger {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.cart-trigger:hover { background: var(--border-color); }

.cart-count {
    background: var(--accent-color);
    color: #fff;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 20px;
}

@media (min-width: 769px) {
    header { padding-bottom: 20px; }
    .cart-trigger { position: absolute; right: 20px; bottom: 20px; }
}

/* ==========================================================================
   3. NAVIGERINGSMENY
   ========================================================================== */
nav {
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(12px);
    background-color: rgba(11, 15, 25, 0.9);
    border-bottom: 1px solid var(--border-color);
}

.menu {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.menu button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.menu button:hover, .menu button.active {
    color: var(--text-main);
    background-color: var(--border-color);
}

.menu button.preorder { color: var(--preorder-color); }
.menu button.sale { color: var(--sale-color); font-weight: 600; }

@media (max-width: 768px) {
    .menu {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 12px 15px;
        scrollbar-width: none;
    }
    .menu::-webkit-scrollbar { display: none; }
    .menu button { padding: 8px 14px; font-size: 0.85rem; }
}

/* ==========================================================================
   4. PRODUKTRUTNÄT & KORT
   ========================================================================== */
main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

@media (max-width: 768px) { main { margin: 25px auto; } }

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: capitalize;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

@media (max-width: 500px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    header .logo { font-size: 1.6rem; }
    .section-title { font-size: 1.2rem; margin-bottom: 20px; }
}

.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 500px) { .product-card { padding: 10px; border-radius: 8px; } }

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: #334155;
}

.badge {
    position: absolute;
    top: 24px;
    left: 24px;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    z-index: 10;
}
@media (max-width: 500px) { .badge { top: 16px; left: 16px; font-size: 0.65rem; padding: 2px 6px; } }

.badge.badge-sale { background-color: var(--sale-color); }
.badge.badge-preorder { background-color: var(--preorder-color); }

.product-image-wrapper {
    width: 100%;
    padding-top: 100%;
    position: relative;
    background-color: #1e293b;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}
@media (max-width: 500px) { .product-image-wrapper { margin-bottom: 10px; } }

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: #1e293b;
}

.product-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 500px) { .product-title { font-size: 0.9rem; margin-bottom: 4px; } }

.price-wrapper {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
@media (max-width: 500px) { .price-wrapper { margin-bottom: 10px; } }

.current-price { font-size: 1.15rem; font-weight: 700; color: #fff; }
.old-price { font-size: 0.9rem; color: var(--text-muted); text-decoration: line-through; }
@media (max-width: 500px) { .current-price { font-size: 1rem; } .old-price { font-size: 0.8rem; } }

.buy-btn {
    background-color: #fff;
    color: #000;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}
.buy-btn:hover { background-color: #e2e8f0; }
@media (max-width: 500px) { .buy-btn { padding: 10px; font-size: 0.8rem; border-radius: 6px; } }

/* ==========================================================================
   5. VARUKORGS-PANEL (Glider ut från sidan - 100% skottsäker mörk stil)
   ========================================================================== */
.cart-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 30px 24px;
}

.cart-panel.open { right: 0; }

@media (max-width: 450px) {
    .cart-panel { max-width: 100%; right: -100%; }
    .cart-panel.open { right: 0; }
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.close-cart { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.cart-items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.02); padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); }
.cart-item-title { font-weight: 500; font-size: 0.95rem; }
.cart-item-price { color: var(--text-muted); font-size: 0.85rem; }

/* Lyxig röd Ta Bort-knapp */
.remove-item { 
    background-color: rgba(239, 68, 68, 0.1) !important; 
    border: none; 
    color: #ef4444 !important; 
    cursor: pointer; 
    font-size: 0.85rem; 
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}
.remove-item:hover { background-color: rgba(239, 68, 68, 0.2) !important; }

.cart-footer { margin-top: auto; border-top: 1px solid var(--border-color); padding-top: 20px; }
.cart-total { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 700; color: #fff; margin-bottom: 20px; }

/* Stor blå Till Kassan-knapp */
.checkout-btn { 
    background-color: #3b82f6 !important; 
    color: white !important; 
    border: none; 
    width: 100%; 
    padding: 16px; 
    border-radius: 8px; 
    font-weight: 700; 
    cursor: pointer; 
    font-size: 1rem; 
    transition: background 0.2s, transform 0.1s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.checkout-btn:hover { background-color: #2563eb !important; }
.checkout-btn:active { transform: scale(0.98); }
