﻿/* =============================================
   BASE
============================================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
    overflow-x: hidden;
}

/* =============================================
   CART LINK
============================================= */
.cart-link {
    text-decoration: none;
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    padding: 11px 18px;
    border-radius: 10px;
    font-weight: 700;
    white-space: nowrap;
}

/* =============================================
   PRODUCTS PAGE
============================================= */
.products-page {
    max-width: 1250px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.products-title {
    text-align: center;
    margin: 24px 0 20px;
}

    .products-title h1 {
        font-size: 34px;
        color: #111827;
        margin: 0 0 8px;
    }

    .products-title p {
        color: #6b7280;
        font-size: 15px;
        margin: 0;
    }

.products-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    background: white;
    padding: 14px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,.06);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

    .products-toolbar input,
    .products-toolbar select {
        padding: 11px 12px;
        border: 1px solid #d1d5db;
        border-radius: 10px;
        flex: 1;
        font-size: 15px;
    }

/* =============================================
   PRODUCTS GRID
============================================= */
#productsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 10px;
}

.product-card {
    background: #fff;
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transition: 0.2s;
    cursor: pointer;
}

    .product-card .btn-buy,
    .product-card .btn-disabled {
        margin-top: auto;
    }

    .product-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 18px 40px rgba(0,0,0,0.12);
    }

.product-img {
    width: 100%;
    aspect-ratio: unset;
    border-radius: 14px;
    overflow: hidden;
    background: #f3f4f6;
}

    .product-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.product-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 8px 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card p {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 6px;
}

.product-card strong {
    font-size: 18px;
    font-weight: 800;
    color: #ff8a00;
}

.product-card small {
    font-size: 12px;
    color: #6b7280;
}

/* =============================================
   BUTTONS
============================================= */
.btn-buy {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

    .btn-buy:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
    }

.btn-disabled {
    background: #e5e7eb;
    color: #6b7280;
    font-weight: 600;
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-top: 8px;
    cursor: not-allowed;
}

.btn-danger {
    background: #fff;
    color: #ef4444;
    border: 2px solid #ef4444;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

    .btn-danger:hover {
        background: #ef4444;
        color: white;
    }

.secondary-link {
    text-decoration: none;
    color: #047857;
    background: #ecfdf5;
    padding: 11px 18px;
    border-radius: 10px;
    font-weight: 700;
}

/* =============================================
   CART PAGE
============================================= */
.cart-page {
    max-width: 1000px;
    margin: 35px auto;
    padding: 0 20px;
}

.cart-item {
    display: grid;
    grid-template-columns: 120px 1fr auto auto;
    gap: 18px;
    align-items: center;
    background: white;
    padding: 18px;
    border-radius: 18px;
    margin-bottom: 16px;
    box-shadow: 0 8px 25px rgba(0,0,0,.07);
}

    .cart-item img {
        width: 120px;
        height: 120px;
        object-fit: cover;
        border-radius: 14px;
    }

.cart-info h3 {
    margin: 0 0 8px;
}

.qty-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .qty-actions button {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        border: 1px solid #d1d5db;
        background: #f9fafb;
        cursor: pointer;
        font-size: 18px;
        font-weight: 700;
    }

.cart-summary {
    background: white;
    padding: 22px;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(0,0,0,.07);
    display: block; /* ← CHANGE flex → block */
}

.empty-card {
    background: white;
    padding: 40px;
    border-radius: 18px;
    text-align: center;
    color: #6b7280;
    box-shadow: 0 8px 25px rgba(0,0,0,.07);
}

/* =============================================
   CHECKOUT PAGE
============================================= */
.checkout-page {
    min-height: 75vh;
    display: block;
    padding: 30px 20px;
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
}

.checkout-card {
    width: 100%;
    max-width: 520px;
    background: white;
    padding: 32px;
    border-radius: 22px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .10);
    margin: 0 auto;
    box-sizing: border-box;
}

/* =============================================
   PRODUCT DETAILS PAGE
============================================= */
.product-detail-card {
    display: flex;
    gap: 40px;
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
    align-items: flex-start;
}

    .product-detail-card img {
        width: 420px;
        border-radius: 18px;
        object-fit: contain;
        background: #f3f4f6;
    }

    .product-detail-card h1 {
        font-size: 28px;
        margin: 0 0 12px;
    }

    .product-detail-card h2 {
        font-size: 28px;
        color: #f97316;
        margin: 14px 0;
    }

/* =============================================
   HOME PAGE
============================================= */
.hero-home {
    margin: 34px;
    min-height: 340px;
    border-radius: 24px;
    background: linear-gradient(135deg, #008f68, #06142b);
    color: white;
    display: flex;
    align-items: center;
    padding: 50px;
}

    .hero-home h1 {
        font-size: 46px;
        margin-bottom: 14px;
    }

    .hero-home p {
        font-size: 20px;
        max-width: 620px;
    }

.hero-btn {
    display: inline-block;
    margin-top: 22px;
    padding: 14px 22px;
    border-radius: 12px;
    background: #ff9800;
    color: white;
    text-decoration: none;
    font-weight: 800;
}

.home-section {
    padding: 20px 34px 60px;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin-top: 20px;
}

.home-card {
    background: white;
    padding: 26px;
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

/* =============================================
   ORDERS PAGE
============================================= */
.order-card {
    background: white;
    padding: 22px;
    border-radius: 18px;
    margin-bottom: 22px;
    box-shadow: 0 8px 25px rgba(0,0,0,.07);
}

.order-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

    .order-head h2 {
        margin: 0;
    }

    .order-head p {
        margin: 6px 0 0;
        color: #6b7280;
    }

.order-status {
    background: #ecfdf5;
    color: #047857;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 700;
}

.order-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 18px;
}

    .order-table th, .order-table td {
        padding: 12px;
        border-bottom: 1px solid #e5e7eb;
        text-align: left;
    }

    .order-table th {
        background: #f9fafb;
    }

/* =============================================
   THANK YOU PAGE
============================================= */
.thank-you-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thank-you-card {
    max-width: 560px;
    background: white;
    padding: 40px;
    border-radius: 22px;
    text-align: center;
    box-shadow: 0 12px 35px rgba(0,0,0,.08);
}

.success-icon {
    font-size: 54px;
    margin-bottom: 18px;
}

.thank-you-card h1 {
    margin: 0 0 14px;
    font-size: 32px;
    color: #111827;
}

.thank-you-card p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 28px;
}

.thank-you-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* =============================================
   MISC
============================================= */
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ef4444;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.loader {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 9999;
}

.price {
    color: #f97316;
    font-weight: bold;
    font-size: 18px;
}

.site-footer {
    padding: 30px;
    background: #06142b;
    color: white;
    text-align: center;
}

    .site-footer a {
        color: #10b981;
        margin: 0 10px;
        font-weight: 700;
        text-decoration: none;
    }

/* =============================================
   MOBILE — max-width: 768px
============================================= */
@media (max-width: 768px) {

    .site-logo {
        font-size: 15px !important;
    }

    /* Products page */
    .products-page {
        padding: 62px 8px 40px !important;
    }

    .products-toolbar {
        display: none !important;
    }

    .products-title h1 {
        font-size: 20px !important;
    }

    #productsGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        align-items: stretch !important;
    }

    .product-card {
        padding: 0 !important;
        border-radius: 10px !important;
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
    }

    .product-img {
        height: 110px !important;
        max-height: 110px !important;
        aspect-ratio: unset !important;
        flex-shrink: 0 !important;
        border-radius: 10px 10px 0 0 !important;
    }

        .product-img img {
            width: 100% !important;
            height: 100% !important;
            object-fit: contain !important;
        }

    .product-info {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        padding: 6px 8px 8px !important;
    }

    .product-name {
        font-size: 12px !important;
        font-weight: 700 !important;
        -webkit-line-clamp: 2 !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .price-current {
        font-size: 12px !important;
        white-space: nowrap !important;
    }

    .price-old {
        font-size: 10px !important;
    }

    .product-stock {
        font-size: 10px !important;
    }

    .stars-row {
        font-size: 10px !important;
    }

    .product-category {
        font-size: 9px !important;
    }

    .btn-buy, .btn-disabled {
        width: 100% !important;
        font-size: 11px !important;
        padding: 8px 4px !important;
        margin-top: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }

    /* Cart page */
    .cart-page {
        margin: 16px auto !important;
        padding: 0 12px 40px !important;
        padding-top: 70px !important;
    }

        .cart-page h1 {
            font-size: 24px !important;
            text-align: center;
        }

    .cart-item {
        display: grid;
        grid-template-columns: 90px 1fr auto auto; /* ← 120px → 90px */
        gap: 18px;
        align-items: start; /* ← center → start */
        background: white;
        padding: 18px;
        border-radius: 18px;
        margin-bottom: 16px;
        box-shadow: 0 8px 25px rgba(0,0,0,.07);
    }

        .cart-item img {
            width: 90px; /* ← 120px → 90px */
            height: 90px;
            object-fit: cover;
            border-radius: 14px;
        }

    .cart-info {
        width: 100%;
        text-align: center;
    }

        .cart-info h3 {
            font-size: 17px !important;
        }

    .qty-actions {
        justify-content: center;
        gap: 16px;
        width: 100%;
    }

        .qty-actions button {
            width: 42px !important;
            height: 42px !important;
            font-size: 20px !important;
        }

    .cart-item .btn-danger {
        width: 100% !important;
        height: 40px !important;
        border-radius: 12px !important;
        font-size: 14px !important;
        border: none !important;
        background: #ef4444 !important;
        color: white !important;
    }

    .cart-summary {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 18px !important;
        text-align: center !important;
        margin-top: 20px !important;
    }

        .cart-summary h2 {
            font-size: 20px !important;
        }

        .cart-summary .cart-link, .cart-summary .btn-danger, .cart-summary .secondary-link {
            width: 100% !important;
            height: 48px !important;
            border-radius: 12px !important;
            font-size: 15px !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            box-sizing: border-box !important;
            font-weight: 700 !important;
            text-decoration: none !important;
        }

    /* Checkout */
    .checkout-page {
        padding: 16px 12px 50px !important;
        align-items: flex-start !important;
        min-height: unset !important;
    }

    .checkout-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px 16px !important;
        border-radius: 18px !important;
    }

        .checkout-card h1 {
            font-size: 22px !important;
            text-align: center !important;
        }

    .checkout-wrapper {
        padding-top: 70px !important;
    }

    /* Product details */
    .product-detail-card {
        flex-direction: column !important;
        padding: 70px 12px 40px !important;
        gap: 16px !important;
        margin: 0 !important;
    }

        .product-detail-card img {
            width: 100% !important;
            height: 220px !important;
            border-radius: 16px !important;
        }

        .product-detail-card h1 {
            font-size: 20px !important;
        }

        .product-detail-card h2 {
            font-size: 22px !important;
        }

        .product-detail-card .btn-buy, .product-detail-card .btn-disabled {
            width: 100% !important;
            height: 50px !important;
            font-size: 16px !important;
            border-radius: 14px !important;
            margin-top: 14px !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
        }

        .product-detail-card .secondary-link {
            display: block !important;
            text-align: center !important;
            margin-top: 12px !important;
            padding: 12px !important;
        }

    .product-page {
        margin-top: 70px !important;
        padding: 0 12px !important;
    }

    .product-description-full {
        padding: 0 12px !important;
    }

    /* Home */
    .hero-home {
        margin: 16px !important;
        padding: 30px 20px !important;
        min-height: unset !important;
    }

        .hero-home h1 {
            font-size: 24px !important;
        }

        .hero-home p {
            font-size: 14px !important;
        }

    .home-grid {
        grid-template-columns: 1fr !important;
    }

    .home-section {
        padding: 16px 16px 40px !important;
    }

    /* Orders */
    .orders-page {
        padding: 0 12px !important;
        margin: 70px auto 40px !important;
    }

    .order-card {
        padding: 16px !important;
    }

    .order-head {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    .order-table {
        font-size: 12px !important;
    }

        .order-table th, .order-table td {
            padding: 8px !important;
        }

    /* Thank you */
    .thank-you-card {
        padding: 28px 20px !important;
        margin: 16px !important;
    }

        .thank-you-card h1 {
            font-size: 22px !important;
        }

    .thank-you-actions {
        flex-direction: column !important;
    }

        .thank-you-actions a {
            width: 100% !important;
            text-align: center !important;
        }

    /* Auth */
    .auth-card {
        margin: 70px 16px 40px !important;
        padding: 24px 16px !important;
    }
}

/* =============================================
   TRÈS PETIT MOBILE — max-width: 380px
============================================= */
@media (max-width: 380px) {
    #productsGrid {
        grid-template-columns: 1fr !important;
    }

    .site-logo {
        font-size: 13px !important;
    }

    .products-title h1 {
        font-size: 22px !important;
    }

    .checkout-card h1 {
        font-size: 18px !important;
    }

    .product-detail-card h1 {
        font-size: 17px !important;
    }

    .product-detail-card img {
        height: 170px !important;
    }
}

@media (max-width: 480px) {
    .payment-option {
        flex-wrap: wrap !important;
        padding: 10px 12px !important;
        gap: 8px !important;
        overflow: hidden !important;
    }

        .payment-option input[type="radio"] {
            flex-shrink: 0 !important;
            width: 18px !important;
            height: 18px !important;
        }

        .payment-option label {
            flex: 1 !important;
            min-width: 0 !important;
            font-size: 13px !important;
            white-space: normal !important;
            word-break: break-word !important;
            overflow: hidden !important;
        }

        .payment-option .badge-soon {
            margin-left: auto !important;
            flex-shrink: 0 !important;
            font-size: 10px !important;
        }
}

@media (max-width: 600px) {
    .checkout-page .payment-option, .checkout-wrapper .payment-option {
        display: grid !important;
        grid-template-columns: 22px 1fr auto !important;
        gap: 8px !important;
        padding: 10px 12px !important;
    }
}

/* Auth pages */
.auth-card {
    max-width: 420px;
    margin: 60px auto;
    background: white;
    padding: 36px;
    border-radius: 20px;
    box-shadow: 0 12px 35px rgba(0,0,0,.10);
}

.auth-logo {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
    color: #111827;
}

.auth-card h2 {
    text-align: center;
    margin: 0 0 20px;
    font-size: 22px;
}

.auth-card form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 15px;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.auth-card form button {
    width: 100%;
    padding: 13px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
}

.auth-links {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
}

    .auth-links a {
        color: #10b981;
        text-decoration: none;
        font-weight: 600;
    }


/* =============================================
   P-CARD (cartes produits home + similaires)
============================================= */
.p-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .2s, box-shadow .2s;
    position: relative;
}

    .p-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(0,0,0,.1);
    }

.p-img {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f3f4f6;
    position: relative;
}

    .p-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.p-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 40px;
}

.p-info {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.p-cat {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #10b981;
}

.p-name {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertic