﻿:root {
    --cart-width: 360px;
    --cart-bg: #fff;
    --cart-accent: #7bb558;
    --overlay-bg: rgba(0, 0, 0, 0.45);
    --text-muted: #666;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    --font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

body {
    padding-top: 80px;
    font-family: var(--font-family);
    background: #f7f8fa;
}

.navbar {
    min-height: 64px;
    padding: 0 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.navbar-brand {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.product-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 15px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.product-card {
    text-align: center;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 6px 18px rgba(0,0,0,.04);
}

.product-image {
    width: 100%;
    height: 180px;
    max-width: 220px;
    margin: 0 auto 15px;
    display: block;
    object-fit: contain;
}

.product-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    min-height: 44px;
}

.product-price {
    color: #444;
    margin-bottom: 15px;
    font-weight: 700;
}

.add-btn {
    background: var(--cart-accent);
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s ease;
}

    .add-btn:hover {
        filter: brightness(.95);
    }

.cart-opener {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1200;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 999px;
    background: var(--cart-accent);
    color: #fff;
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: 22px;
    text-decoration: none;
    border: none;
}

.cart-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ff3b30;
    color: #fff;
    min-width: 21px;
    height: 21px;
    border-radius: 999px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    font-weight: 700;
}

.cart-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    pointer-events: none;
    transition: background .25s ease;
    z-index: 1100;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: var(--cart-width);
    max-width: 100%;
    transform: translateX(110%);
    background: var(--cart-bg);
    box-shadow: var(--shadow);
    z-index: 1150;
    display: flex;
    flex-direction: column;
    transition: transform .28s cubic-bezier(.2, .9, .2, 1);
    border-left: 1px solid #eee;
    overflow: hidden;
    font-family: var(--font-family);
}

#cart-toggle:checked ~ .cart-overlay {
    background: var(--overlay-bg);
    pointer-events: auto;
}

#cart-toggle:checked ~ .cart-drawer {
    transform: translateX(0);
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #f2f2f2;
}

    .cart-header h2 {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 700;
    }

.cart-close {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
}

.cart-items {
    padding: 12px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.empty-cart {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 15px;
}

.cart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 6px;
    border-bottom: 1px solid #f3f3f3;
}

.cart-item-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8f8f8;
    border: 1px solid #eee;
    padding: 4px;
}

.cart-item-title {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 14px;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.qty-label {
    font-size: 12px;
    color: var(--text-muted);
}

.qty-input {
    width: 70px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.remove-item {
    border: none;
    background: transparent;
    color: #d63939;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}

.cart-item-price {
    font-weight: 700;
    white-space: nowrap;
    color: #222;
    font-size: 14px;
}

.cart-footer {
    padding: 16px;
    border-top: 1px solid #f2f2f2;
    background: #fff;
}

.cart-subtotal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 700;
}

.cart-note {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: var(--text-muted);
}

.cart-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.checkout-btn,
.clear-cart {
    width: 100%;
    padding: 12px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    border: none;
}

.checkout-btn {
    background: var(--cart-accent);
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.clear-cart {
    background: #f1f3f5;
    color: #222;
}

    .checkout-btn:disabled,
    .clear-cart:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

    .cart-opener:focus,
    .cart-close:focus,
    .checkout-btn:focus,
    .clear-cart:focus,
    .qty-input:focus,
    .add-btn:focus {
        outline: 3px solid rgba(123, 181, 88, 0.25);
        outline-offset: 2px;
    }

@media (min-width: 900px) {
    :root {
        --cart-width: 420px;
    }
}

@media (max-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .cart-drawer {
        width: 100%;
    }
}
