@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Marcellus&display=swap');

/* ==========================================================================
   Maison Nadia - feuille de style
   Palette : bleu nuit (zellige), or, ivoire. Titres : Marcellus. Texte : Figtree.
   ========================================================================== */

:root {
    --gold: #b68a3a;
    --gold-dark: #8a6423;
    --gold-light: #e2c27d;
    --indigo: #1f2b4a;
    --indigo-dark: #16203a;
    --ink: #241f18;
    --dark: #241f18;
    --gray: #6a6258;
    --ivory: #faf6ef;
    --light-gray: #f6f2ea;
    --sand: #e8dfcf;
    --white: #ffffff;
    --surface-dark: #1f2b4a;
    --surface-dark-text: #e9dfcb;
    --radius: 3px;
    --font-display: 'Marcellus', 'Palatino Linotype', Georgia, serif;
    --font-body: 'Figtree', 'Segoe UI', Tahoma, Verdana, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    background-color: var(--white);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: .005em;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--gold-dark);
    outline-offset: 2px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Barre du haut ---------- */
.topbar {
    background: var(--indigo);
    color: var(--surface-dark-text);
    font-size: 13px;
    padding: 8px 0;
}
.topbar .container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 20px;
}

/* ---------- En-tete : logo, recherche, actions, puis menu sur sa propre ligne ---------- */
header.main-header {
    background: var(--white);
    border-bottom: 1px solid var(--sand);
    padding: 14px 0 0;
}
.header-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
}
.header-actions { display: contents; }
.header-actions > * { order: 4; }

.logo {
    order: 1;
    margin-right: auto;
    display: flex;
    align-items: center;
}
.logo img { height: 64px; width: auto; display: block; }

.mobile-toggle {
    display: none;
    order: 2;
    background: none;
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    padding: 6px 12px;
    cursor: pointer;
}

.search-box {
    order: 3;
    display: flex;
    flex: 0 1 260px;
    min-width: 160px;
    border: 1px solid var(--sand);
    border-radius: 999px;
    background: var(--white);
    overflow: hidden;
    transition: border-color .15s;
}
.search-box:focus-within { border-color: var(--gold); }
.search-box input {
    border: 0;
    outline: none;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    min-width: 0;
    background: transparent;
}
.search-box button {
    background: var(--indigo);
    border: none;
    color: #fff;
    padding: 0 18px;
    cursor: pointer;
    transition: background .15s;
}
.search-box button:hover { background: var(--indigo-dark); }

.header-actions a {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.header-action-link {
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--ink);
    transition: background .15s, color .15s;
}
.header-action-link:hover {
    background: var(--ivory);
    color: var(--gold-dark);
}
.header-action-icon { font-size: 16px; line-height: 1; }

.account-toggle {
    padding: 5px 14px 5px 5px;
    border-radius: 999px;
    border: 1px solid var(--sand);
    color: var(--ink);
    background: var(--ivory);
    transition: border-color .15s, background .15s;
}
.account-toggle:hover { border-color: var(--gold); background: #f3ecdf; }
.account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--indigo);
    color: var(--gold-light);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.account-toggle .chevron { font-size: 11px; color: var(--gray); margin-left: 2px; }
.account-dropdown .dropdown-toggle { font-size: inherit; font-weight: inherit; }

.cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--indigo);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    margin-left: 2px;
}
.admin-link {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--gray) !important;
    border: 1px solid var(--sand);
    border-radius: 999px;
    padding: 5px 14px !important;
}
.admin-link:hover { border-color: var(--gold-dark); color: var(--gold-dark) !important; }

/* Menu principal */
nav.main-nav {
    order: 5;
    flex: 1 0 100%;
    border-top: 1px solid var(--sand);
    margin-top: 4px;
}
nav.main-nav ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0 38px;
}
nav.main-nav a {
    display: block;
    padding: 14px 2px 12px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .01em;
    color: var(--ink);
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
}
nav.main-nav a:hover, nav.main-nav a.active {
    color: var(--gold-dark);
    border-bottom-color: var(--gold);
}

/* Menus deroulants */
.has-dropdown { position: relative; }
.dropdown-toggle { cursor: pointer; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    background: var(--white);
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    box-shadow: 0 14px 30px rgba(31,43,74,.14);
    min-width: 200px;
    padding: 6px 0;
    z-index: 60;
}
.has-dropdown.open .dropdown-menu { display: flex; }
nav.main-nav ul.dropdown-menu { left: 0; right: auto; min-width: 210px; }
nav.main-nav ul.dropdown-menu {
    display: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0;
}
nav.main-nav .has-dropdown.open ul.dropdown-menu { display: flex; }
.dropdown-menu li { display: block; }
.dropdown-menu a,
.header-actions .dropdown-menu a,
nav.main-nav .dropdown-menu a {
    display: block;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    border-bottom: 0;
    border-radius: 0;
}
.dropdown-menu a:hover,
nav.main-nav .dropdown-menu a:hover {
    background: var(--ivory);
    color: var(--gold-dark);
}

/* ---------- Banniere d'accueil ---------- */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: clamp(380px, 60vh, 600px);
    margin-bottom: 56px;
    background: var(--indigo);
    color: #fff;
    text-align: left;
    overflow: hidden;
}
.hero img.bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 65% 40%;
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        rgba(18,24,43,.9) 0%,
        rgba(18,24,43,.68) 38%,
        rgba(18,24,43,.15) 72%,
        rgba(18,24,43,0) 100%);
}
.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 56px 20px;
}
.hero h1 {
    font-size: clamp(2.2rem, 5.2vw, 3.9rem);
    line-height: 1.08;
    max-width: 11em;
    margin: 0 0 18px;
    color: #fff;
}
.hero p {
    font-size: 1.0625rem;
    line-height: 1.65;
    color: #efe8d8;
    max-width: 30rem;
    margin: 0 0 30px;
}
.hero .btn { padding: 14px 32px; }

/* Banniere de categorie */
.categorie-banniere {
    position: relative;
    text-align: center;
    padding: 64px 20px;
    margin-bottom: 40px;
    overflow: hidden;
    color: #fff;
    background: var(--indigo);
}
.categorie-banniere img.bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.categorie-banniere::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(18,24,43,.58);
}
.categorie-banniere .categorie-banniere-content { position: relative; z-index: 2; }
.categorie-banniere h1 { font-size: clamp(1.7rem, 3.5vw, 2.5rem); margin: 6px 0 0; color: #fff; }
.categorie-banniere .breadcrumb-fil { font-size: 13px; color: #eee; }
.categorie-banniere .breadcrumb-fil a { color: var(--gold-light); }

/* ---------- Boutons ---------- */
.btn {
    display: inline-block;
    background: var(--gold);
    color: #1f1a12;
    padding: 12px 26px;
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: .01em;
    text-align: center;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.btn:hover { background: #c9a050; border-color: #c9a050; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--ink);
    color: var(--ink);
}
.btn-outline:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Titres de section ---------- */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 24px;
    margin: 0 0 28px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--sand);
    text-align: left;
}
.section-title h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0; color: var(--ink); }
.section-title p { margin: 0; color: var(--gray); font-size: 15px; }

/* ---------- Categories ---------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 64px;
}
.category-card {
    position: relative;
    display: block;
    background: var(--ivory);
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: left;
    overflow: hidden;
    transition: border-color .2s;
}
.category-card::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: 0;
    background: var(--gold);
    transition: width .3s ease;
    z-index: 3;
}
.category-card:hover { border-color: var(--gold); }
.category-card:hover::after { width: 100%; }
.category-card h3 { margin: 0 0 6px; font-size: 1.35rem; position: relative; z-index: 2; }
.category-card p { color: var(--gray); font-size: 14px; margin: 0; position: relative; z-index: 2; }

.category-card.has-image {
    background-size: cover;
    background-position: center;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: #fff;
    border: 0;
}
.category-card.has-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(18,24,43,.05) 30%, rgba(18,24,43,.8) 100%);
}
.category-card.has-image h3 { color: #fff; }
.category-card.has-image p { color: #efe8d8; }

/* ---------- Produits ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 36px 24px;
    margin-bottom: 64px;
}
.product-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    background: transparent;
}
.product-card .img-wrap {
    aspect-ratio: 4/5;
    overflow: hidden;
    background: var(--light-gray);
    border-radius: var(--radius);
}
.product-card .img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform .5s ease;
}
.product-card:hover .img-wrap img { transform: scale(1.035); }
.img-wrap-relative { position: relative; }

.favori-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.95);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--ink);
    box-shadow: 0 2px 8px rgba(31,43,74,.16);
    transition: transform .15s, color .15s;
    z-index: 5;
}
.favori-btn:hover { transform: scale(1.1); }
.favori-btn.is-favori { color: #b3261e; }
.favori-btn-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--gray);
    vertical-align: middle;
    margin-left: 10px;
    transition: transform .15s, color .15s;
}
.favori-btn-inline:hover { transform: scale(1.1); }
.favori-btn-inline.is-favori { color: #b3261e; }

.product-info { padding: 14px 2px 0; flex: 1; display: flex; flex-direction: column; }
.product-info .cat-label {
    font-size: 13px;
    color: var(--gold-dark);
    margin-bottom: 2px;
}
.product-info h3 { font-size: 1.1rem; margin: 0 0 8px; }
.product-info h3 a:hover { color: var(--gold-dark); }
.price-row { margin-top: auto; display: flex; align-items: baseline; gap: 10px; }
.price { font-weight: 700; font-size: 1.0625rem; color: var(--ink); }
.price-old { text-decoration: line-through; color: #9a9184; font-size: 14px; }
/* Toute la carte ouvre la fiche produit (le lien du nom s'etend sur la carte),
   les boutons restent au-dessus et gardent leur propre action. */
.product-card { position: relative; }
.product-info h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}
.product-actions { position: relative; z-index: 2; display: flex; gap: 8px; margin-top: 14px; }
.product-actions form { flex: 1; }
.product-actions .btn { width: 100%; padding: 11px 12px; font-size: 14px; text-align: center; }

/* ---------- Fiche produit ---------- */
.product-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 56px;
    align-items: start;
    margin: 40px 0 80px;
}
.product-detail .img-wrap {
    background: var(--light-gray);
    border-radius: var(--radius);
    overflow: hidden;
}
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery-thumb {
    width: 68px;
    height: 82px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    opacity: .7;
    transition: opacity .15s, border-color .15s;
}
.gallery-thumb:hover { opacity: 1; }
.taille-options { display: flex; gap: 10px; flex-wrap: wrap; }
.taille-option { position: relative; margin: 0; font-weight: 400; }
.taille-option input[type=radio] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}
.taille-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 1px solid #cfc6b6;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    transition: border-color .15s, background .15s, color .15s;
}
.taille-option:hover span { border-color: var(--indigo); }
.taille-option input[type=radio]:checked + span {
    border-color: var(--indigo);
    background: var(--indigo);
    color: #fff;
}
.taille-option input[type=radio]:focus-visible + span { outline: 2px solid var(--gold-dark); outline-offset: 2px; }
.product-detail h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 0 0 10px; }
.product-detail .breadcrumb { font-size: 13px; color: var(--gray); margin-bottom: 20px; }
.product-detail .breadcrumb a { color: var(--gold-dark); }
.product-detail .price-row { font-size: 1.5rem; margin: 16px 0; }
.product-detail .price { color: var(--gold-dark); }
.product-detail .description { color: #4a443b; line-height: 1.75; max-width: 60ch; margin-bottom: 24px; }
.qty-form { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; }
.qty-form input[type=number] {
    width: 74px;
    padding: 11px 9px;
    border: 1px solid #cfc6b6;
    border-radius: var(--radius);
    text-align: center;
    font-family: inherit;
}
.stock-info { font-size: 13px; color: var(--gray); margin-bottom: 20px; }
.whatsapp-btn { background: #17894a; border-color: #17894a; color: #fff; }
.whatsapp-btn:hover { background: #116c39; border-color: #116c39; }

/* ---------- Panier ---------- */
.cart-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 20px; }
.cart-table { width: 100%; min-width: 560px; border-collapse: collapse; margin-bottom: 10px; }
.cart-table th, .cart-table td {
    padding: 16px 10px;
    border-bottom: 1px solid var(--sand);
    text-align: left;
    font-size: 14px;
}
.cart-table th { color: var(--gray); font-weight: 600; font-size: 13px; }
.cart-product { display: flex; align-items: center; gap: 14px; }
.cart-product img { width: 64px; height: 76px; object-fit: cover; border-radius: var(--radius); }
.qty-input {
    width: 62px;
    padding: 7px;
    border: 1px solid #cfc6b6;
    border-radius: var(--radius);
    text-align: center;
    font-family: inherit;
}
.remove-link { color: #b3261e; font-size: 13px; }
.remove-link:hover { text-decoration: underline; }
.cart-summary {
    max-width: 400px;
    margin-left: auto;
    background: var(--ivory);
    border: 1px solid var(--sand);
    padding: 26px;
    border-radius: var(--radius);
}
.cart-summary .total-row {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
    margin: 14px 0 20px;
}
.empty-cart { text-align: center; padding: 80px 20px; color: var(--gray); }

/* ---------- Formulaires ---------- */
.contact-form { max-width: 560px; margin: 0 auto; }
.contact-form label { display: block; font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
.contact-form input, .contact-form textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #cfc6b6;
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    transition: border-color .15s;
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--gold-dark); }
.contact-form textarea { min-height: 130px; resize: vertical; }
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-success { background: #e5f7ea; color: #1e7e34; border: 1px solid #b8e6c3; }
.alert-error { background: #fdecea; color: #b02a37; border: 1px solid #f5c2c7; }

/* ---------- Fil d'Ariane ---------- */
.breadcrumb-bar {
    background: var(--ivory);
    border-bottom: 1px solid var(--sand);
    padding: 22px 0;
    margin-bottom: 40px;
    font-size: 14px;
    color: var(--gray);
}
.breadcrumb-bar a { color: var(--gold-dark); }
.breadcrumb-bar h1 { margin: 4px 0 0; font-size: clamp(1.5rem, 3vw, 2rem); color: var(--ink); }

/* ---------- Pied de page ---------- */
footer {
    background: var(--indigo);
    color: #d9d2c3;
    padding: 64px 0 24px;
    margin-top: 80px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}
.footer-grid h4 { color: var(--gold-light); margin: 0 0 16px; font-size: 1.15rem; }
.footer-grid p { margin: 0; line-height: 1.7; color: #cfc8b8; }
.footer-grid ul li { margin-bottom: 10px; font-size: 14.5px; }
.footer-grid a { transition: color .15s; }
.footer-grid a:hover { color: var(--gold-light); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.14);
    padding-top: 20px;
    text-align: center;
    font-size: 13px;
    color: #b5ae9f;
}
footer .footer-bottom a { color: #d9d2c3 !important; text-decoration: underline; }
footer .footer-bottom a:hover { color: var(--gold-light) !important; }

/* ---------- Tablette et mobile ---------- */
@media (max-width: 900px) {
    .mobile-toggle { display: block; }
    .logo img { height: 48px; }
    .search-box { order: 3; flex: 1 0 100%; }
    .header-actions > * { order: 4; }
    nav.main-nav { display: none; }
    nav.main-nav.open { display: block; }
    nav.main-nav ul { flex-direction: column; justify-content: flex-start; gap: 0; padding: 6px 0 10px; }
    nav.main-nav a { padding: 11px 0; border-bottom: 0; }
    nav.main-nav ul.dropdown-menu {
        display: flex;
        position: static;
        border: none;
        box-shadow: none;
        padding: 0 0 0 14px;
        min-width: 0;
    }
    .hero-overlay { background: rgba(18,24,43,.62); }
}

@media (max-width: 780px) {
    .product-detail { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 600px) {
    .topbar .container { flex-direction: column; align-items: flex-start; gap: 3px; font-size: 12px; }
    .hero { min-height: 420px; margin-bottom: 40px; }
    .hero-content { padding: 40px 16px; }
    .hero h1 { font-size: 2.1rem; }
    .hero p { font-size: 1rem; }
    .categorie-banniere { padding: 40px 16px; }
    .section-title { flex-direction: column; gap: 2px; }

    .category-grid { gap: 14px; margin-bottom: 48px; }
    .category-card { padding: 22px 18px; }
    .category-card.has-image { min-height: 190px; }

    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 26px 14px; margin-bottom: 48px; }
    .product-info h3 { font-size: 1rem; }

    .taille-options { gap: 8px; }
    .taille-option span { width: 42px; height: 42px; font-size: 13px; }

    .cart-summary { max-width: 100%; }
    .login-card { padding: 26px 20px; }
    footer { padding: 44px 0 20px; margin-top: 56px; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px 20px; margin-bottom: 30px; }
    .footer-grid > div:first-child,
    .footer-grid > div:last-child { grid-column: 1 / -1; }
    .footer-grid h4 { font-size: 1.05rem; margin-bottom: 12px; }
    .footer-grid ul li { margin-bottom: 8px; }
    .footer-bottom { line-height: 1.9; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}