:root {
    --radius: 0.75rem;
    --background: oklch(12% .005 260);
    --foreground: oklch(96% .002 260);
    --card: oklch(15.5% .006 260);
    --card-foreground: oklch(96% .002 260);
    --primary: oklch(60% .13 250);
    --primary-foreground: oklch(98% .002 260);
    --secondary: oklch(19.5% .006 260);
    --secondary-foreground: oklch(94% .003 260);
    --muted: oklch(20% .005 260);
    --muted-foreground: oklch(62% .008 260);
    --accent: oklch(22% .008 260);
    --border: oklch(22% .006 260);
    --input: oklch(18% .006 260);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #050607;
    color: var(--foreground);
    min-height: 100vh;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    margin: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.balance-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.balance-section svg {
    opacity: 0.7;
}

.balance-label {
    font-size: 10px;
    color: var(--muted-foreground);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.balance-amount {
    font-size: 15px;
    font-weight: 600;
    color: var(--foreground);
}

.brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--muted-foreground);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.secure-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted-foreground);
}

.secure-badge svg {
    opacity: 0.7;
}

.cart-button {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    display: none;
}

.cart-badge.show {
    display: block;
}

/* Main Content */
.main-content {
    padding: 0 20px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab {
    padding: 8px 20px;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--muted-foreground);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

/* Sort Button */
.sort-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    color: var(--foreground);
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.sort-button:hover {
    background: var(--accent);
}

/* Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    cursor: pointer;
    margin-bottom: 20px;
    position: relative;
}

.checkbox-container input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.checkbox-container input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-icon {
    position: absolute;
    left: 13px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.checkbox-container input[type="checkbox"]:checked + .checkbox-icon {
    opacity: 1;
}

.checkbox-container span {
    font-size: 13px;
    color: var(--foreground);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Product Card */
.product-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    overflow: hidden;
    transition: all 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.product-image-container {
    position: relative;
    width: 100%;
    padding-top: 75%;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.category-tag {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.category-tag svg {
    width: 12px;
    height: 12px;
}

.product-info {
    padding: 12px;
}

.product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-description {
    font-size: 11px;
    color: var(--muted-foreground);
    margin-bottom: 12px;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 12px;
}

.add-to-cart-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    border: none;
    border-radius: calc(var(--radius));
    color: var(--primary-foreground);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.add-to-cart-btn:hover {
    opacity: 0.9;
}

.add-to-cart-btn svg {
    width: 14px;
    height: 14px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted-foreground);
}

.empty-icon {
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 14px;
}

/* ── Cart Overlay ── */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 200;
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ── Cart Panel (slide from bottom) ── */
.cart-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    border-radius: 20px 20px 0 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.cart-panel.open {
    transform: translateY(0);
}

/* ── Header ── */
.cart-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cart-panel-header-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cart-panel-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--foreground);
}

.cart-panel-subtitle {
    font-size: 12px;
    color: var(--muted-foreground);
}

.cart-panel-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cart-panel-total {
    font-size: 15px;
    font-weight: 700;
    color: var(--foreground);
    background: var(--secondary);
    padding: 6px 12px;
    border-radius: 8px;
}

.cart-panel-close {
    background: none;
    border: none;
    color: var(--foreground);
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 4px;
    line-height: 1;
}

.cart-panel-close:hover {
    opacity: 1;
}

/* ── Body ── */
.cart-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
}

/* Sort Menu */
.sort-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s;
    z-index: 1001;
}

.sort-menu.open {
    transform: translateY(0);
}

.sort-option {
    width: 100%;
    padding: 14px;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    margin-bottom: 8px;
    cursor: pointer;
    color: var(--foreground);
    font-size: 14px;
    text-align: left;
    transition: all 0.2s;
}

.sort-option:hover {
    background: var(--accent);
}

.sort-option.active {
    background: color-mix(in oklab, var(--primary) 15%, transparent);
    border-color: var(--primary);
    color: var(--primary);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: color-mix(in oklab, var(--background) 98%, transparent);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 12px 20px 20px;
    display: flex;
    justify-content: space-around;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--muted-foreground);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: calc(var(--radius) + 2px);
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--accent);
}

.nav-item.active {
    background: color-mix(in oklab, var(--primary) 15%, transparent);
    color: var(--primary);
}

.nav-item svg {
    stroke: currentColor;
}

@media (max-width: 480px) {
    .secure-badge {
        display: none;
    }
    
    .brand {
        font-size: 10px;
    }
}

/* Badge promo */
.promo-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: oklch(60% .15 20);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    z-index: 2;
}

/* Items du panier */
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--secondary);
    border-radius: calc(var(--radius));
    margin-bottom: 8px;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: calc(var(--radius) - 4px);
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 4px;
}

.cart-item-price {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--foreground);
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.quantity-btn:hover {
    background: var(--accent);
}

.quantity-btn:active {
    transform: scale(0.95);
}

.cart-item-quantity span {
    font-size: 14px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.remove-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--muted-foreground);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: oklch(60% .15 20);
    color: white;
    border-color: oklch(60% .15 20);
}

/* ── Cart Items ── */
.cart-items {
    margin-bottom: 16px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--secondary);
    border-radius: calc(var(--radius));
    margin-bottom: 8px;
}

.cart-item-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: calc(var(--radius) - 2px);
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-status {
    font-size: 11px;
    color: var(--muted-foreground);
}

.cart-item-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
    flex-shrink: 0;
}

.cart-item-delete {
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
    border-radius: 6px;
}

.cart-item-delete:hover {
    color: oklch(60% .15 20);
    background: oklch(60% .15 20 / 0.1);
}

/* ── Summary ── */
.cart-summary {
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--foreground);
}

.summary-row.deduction {
    font-size: 13px;
    font-weight: 400;
    color: var(--muted-foreground);
}

/* ── Error ── */
.cart-error {
    background: #ff3b3030;
    color: #ff6b6b;
    padding: 13px 16px;
    border-radius: calc(var(--radius));
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 14px;
    border: 1px solid #ff3b3055;
}

/* ── Checkout Button ── */
.cart-checkout-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: calc(var(--radius));
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.cart-checkout-btn:hover {
    opacity: 0.9;
}

.cart-checkout-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}