@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --primary: #febd69;
    --primary-hover: #f3a847;
    --secondary: #f08804;
    --dark: #131921;
    --light: #f3f3f3;
    --gray: #565959;
    --white: #ffffff;
    --danger: #B12704;
    --bg: #EAEDED;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Outfit', sans-serif;
    margin: 0;
    background-color: var(--bg);
    color: var(--dark);
    line-height: 1.5;
}

/* HEADER */
header {
    background: var(--dark);
    padding: 0.5rem 5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 60px;
    box-shadow: none;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Le :before du carton a été supprimé pour laisser place au vrai logo SVG/PNG */

.search-bar {
    flex-grow: 1;
    margin: 0 2rem;
    display: flex;
    max-width: 800px;
    background: var(--white);
    border-radius: 4px;
    overflow: hidden;
    padding: 0;
    border: none;
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    box-shadow: 0 0 0 2px #f3a847, 0 0 0 3px rgba(243, 168, 71, 0.5);
}

.search-bar input {
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
}

.search-bar button {
    background: var(--primary);
    color: var(--dark);
    border: none;
    width: 50px;
    height: 40px;
    border-radius: 0;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.search-bar button:hover {
    background: var(--primary-hover);
}

.cart-icon {
    background: transparent;
    padding: 5px 10px;
    border-radius: 50px;
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.cart-icon:hover {
    background: var(--white);
    border-color: var(--white);
    color: var(--primary);
}

.cart-count {
    background: #f08804;
    color: var(--dark);
    font-size: 0.85rem;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
}

/* LAYOUT PRINCIPAL */
.main-container {
    display: flex;
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    gap: 2rem;
}

/* SIDEBAR FILTRES */
.sidebar {
    width: 250px;
    background: var(--white);
    padding: 1.5rem;
    border-radius: 20px;
    height: fit-content;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.sidebar h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--bg);
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-group label {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    border-radius: 12px;
    transition: all 0.2s;
}

.filter-group label:hover {
    background: var(--bg);
    color: var(--primary);
}

.filter-group input {
    margin-right: 12px;
    accent-color: var(--primary);
}

/* GRILLE PRODUITS */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    flex-grow: 1;
}

/* CARTE PRODUIT */
.product-card {
    background: var(--white);
    border-radius: 24px;
    padding: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 450px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.product-image {
    height: 220px;
    border-radius: 18px 18px 0 0; /* Plus propre en haut de la carte */
    overflow: hidden;
    background: transparent; /* Permet au fond blanc des images d'épouser la carte blanche */
    margin-bottom: 1.25rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Garde les proportions exactes */
    mix-blend-mode: multiply; /* Fait disparaître les légers fonds blancs/grisâtres des photos JPG */
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-info {
    padding: 0 0.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* On pousse la zone du bouton / status vers le bas s'il y a un décalage de taille de texte */
.product-card .add-btn {
    margin-top: auto;
}

.product-info h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    line-height: 1.4;
}

.rating {
    color: #f59e0b;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.price span.symbol {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 500;
}

.stock-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: #dcfce7;
    color: #15803d;
    width: fit-content;
    margin-bottom: 1rem;
}

.stock-status.low {
    background: #fee2e2;
    color: #b91c1c;
}

.add-btn {
    background: #FFD814;
    color: var(--dark);
    border: 1px solid #FCD200;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 2px 5px rgba(213, 217, 217, .5);
}

.add-btn:hover:not(:disabled) {
    background: #f7ca00;
    border-color: #f2c200;
}

.add-btn:disabled {
    background: #f3f3f3;
    color: #a0a0a0;
    border-color: #d5d9d9;
    cursor: not-allowed;
}

/* PANIER SLIDE-IN */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 450px;
    max-width: 100%;
    height: 100vh;
    background: var(--white);
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: all 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Permet le défilement global du panneau si nécessaire */
    scrollbar-width: thin;
}

.cart-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    padding: 2rem;
    border-bottom: 1px solid var(--bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.cart-items {
    padding: 2rem;
    list-style: none;
    margin: 0;
}

.cart-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--bg);
    position: relative;
    animation: fadeIn 0.3s ease;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: var(--bg);
    border-radius: 12px;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-details strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.remove-btn-x {
    color: var(--gray);
    background: var(--bg);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-btn-x:hover {
    background: var(--danger);
    color: white;
}

.cart-footer {
    padding: 2rem;
    background: var(--light);
    border-top: 1px solid var(--bg);
}

.cart-total-line {
    display: flex;
    justify-content: space-between;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-view-cart,
#checkoutBtnMain {
    padding: 1rem;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-view-cart {
    background: var(--white);
    color: var(--dark);
    border: 1px solid #e2e8f0;
}

#checkoutBtnMain {
    background: #FFD814;
    color: var(--dark);
    border: 1px solid #FCD200;
    box-shadow: 0 2px 5px rgba(213, 217, 217, .5);
}

#checkoutBtnMain:hover {
    background: #f7ca00;
}

#orderForm {
    margin-top: 1.5rem;
    display: none;
    background: #fff;
    padding: 1rem;
    border-radius: 12px;
    border: 1px dashed var(--primary);
}

#orderForm.visible {
    display: block;
}

#orderForm input,
#orderForm textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
}

#orderForm button[type="submit"] {
    width: 100%;
    padding: 1rem;
    background: var(--dark);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* PAGE DÉTAIL */
.detail-page-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
    width: 100%;
}

.detail-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 30px;
    box-shadow: var(--shadow);
}

.detail-image img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: var(--gray);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

.price-large {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark);
    margin: 1.5rem 0;
}

.description-section {
    margin: 2.5rem 0;
}

.description-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--gray);
}

.description-section p {
    color: #475569;
    line-height: 1.8;
}

.purchase-action {
    background: var(--white);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(79, 70, 229, 0.1);
}

.qty-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.qty-stepper {
    display: flex;
    align-items: center;
    background: var(--bg);
    border-radius: 12px;
    padding: 5px;
}

.qty-stepper button {
    width: 35px;
    height: 35px;
    border: none;
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.qty-stepper span {
    padding: 0 1.5rem;
    font-weight: 700;
}

.shipping-info {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #15803d;
    font-weight: 500;
    text-align: center;
}

/* PAGINATION */
.pagination-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-bottom: 2rem;
}

.pagi-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #e2e8f0;
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagi-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: #fffdf5;
}

.pagi-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--dark);
}

.pagi-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .detail-page-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* DROPDOWN CATÉGORIES CSS */
.cat-summary {
    list-style: none;
    cursor: pointer;
    outline: none;
}
.cat-summary::-webkit-details-marker {
    display: none;
}
.cat-summary h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 1rem 0; /* Ajustement marge si ouvert */
}
.cat-summary h3::after {
    content: "▼";
    font-size: 0.8rem;
    color: var(--primary);
    transition: transform 0.3s;
}
details[open] .cat-summary h3::after {
    transform: rotate(180deg);
}

@media (min-width: 769px) {
    .cat-summary { pointer-events: none; }
    .cat-summary h3::after { display: none; }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        padding: 1rem 5%;
        gap: 1rem;
    }

    .sidebar {
        width: 100%;
        margin-bottom: 0.5rem;
        padding: 1rem 1.5rem;
    }

    .cart-sidebar {
        width: 100%;
    }

    /* Restructuration du Header pour centrer sur mobile */
    header {
        height: auto;
        padding: 15px 5%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .logo {
        order: 1;
        width: 100%;
        justify-content: center;
    }

    .search-bar {
        order: 2;
        margin: 0;
        width: 100%;
        max-width: none;
        height: 45px;
    }

    .search-bar button {
        height: 45px;
        min-width: 60px;
    }

    .cart-icon {
        order: 3;
        width: 100%;
        justify-content: center;
        padding: 10px;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* SECTION PROMO (FEATURED) */
.featured-promo {
    margin-bottom: 3rem;
    background: linear-gradient(135deg, #131921 0%, #232f3e 100%);
    border-radius: 24px;
    padding: 2rem;
    color: white;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.promo-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.promo-header span {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.promo-slider {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: none;
    /* Firefox */
}

.promo-slider::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.promo-card {
    min-width: 300px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.promo-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    border-color: var(--primary);
}

.promo-card img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    background: white;
    border-radius: 12px;
    padding: 5px;
}

.promo-info {
    flex: 1;
}

.promo-info h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.promo-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.promo-card .add-btn {
    width: 100%;
    font-size: 0.85rem;
    padding: 8px;
}

/* =========================================
   TOAST NOTIFICATIONS & ANIMATIONS
========================================= */

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: var(--dark);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    font-size: 0.95rem;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success::before {
    content: '✅';
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error::before {
    content: '❌';
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning::before {
    content: '⚠️';
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info::before {
    content: 'ℹ️';
}

/* Animation BUMP pour le panier */
@keyframes bump {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.5);
        background-color: var(--danger);
        color: white;
    }

    100% {
        transform: scale(1);
    }
}

.cart-count.bump {
    animation: bump 0.4s ease-out;
}