/* =========================================
   1. VARIABLES ET BASE
   ========================================= */
:root {
    --bg-color: #ffffff;
    --text-main: #222222;
    --text-light: #666666;
    --text-title: #545454;
    --purple-light: #F8F2FB;
    --purple-mid: #D3B8E8;
    --purple-dark: #CA97DF;
    --purple-text: #8A4BAF;
    --highlight-purple: rgba(211, 184, 232, 0.5);
    --beige-bg: #FFF8F2;
    --brown-card: #B97C46;
    --brown-btn: #D6B294;
    --footer-bg: #DAB99F;
    --border-color: #E2D1ED;
}

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-main);
    line-height: 1.5;
}

.custom-container {
    max-width: 1200px !important;
}

.highlight {
    position: relative;
    display: inline-block;
    z-index: 1;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: -5px;
    right: -5px;
    height: 40%;
    background-color: var(--highlight-purple);
    z-index: -1;
    border-radius: 2px;
}

/* =========================================
   2. NAVBAR
   ========================================= */
.main-header {
    background-color: var(--purple-light);
    border-radius: 50px;
    padding: 15px 40px;
}

.logo-circle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--text-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-weight: bold;
    font-style: italic;
    text-decoration: none;
    color: var(--text-main);
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 14px;
}

.logo-center {
    font-family: "Mea Culpa", cursive;
    font-size: 28px;
    text-align: center;
    line-height: 1;
}

.logo-center span {
    font-family: "Abril Fatface", serif;
    display: block;
    font-size: 18px;
    margin-top: 2px;
}

.search-icon {
    color: var(--text-main);
    cursor: pointer;
}

.custom-btn {
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.btn-outline {
    border: 2px solid var(--purple-dark);
    color: var(--text-main);
    background: transparent;
}

.btn-outline:hover {
    background-color: var(--purple-dark);
    color: white;
}

.btn-filled {
    background-color: var(--purple-dark);
    color: white;
    border: 2px solid transparent;
}

.btn-filled:hover {
    background-color: var(--purple-text); 
}


/* =========================================
   3. BARRE LATÉRALE (SIDEBAR)
   ========================================= */
.sidebar-menu {
    position: fixed;
    top: 0;
    left: -350px; 
    width: 320px;
    height: 100%;
    background-color: var(--bg-color); 
    border-radius: 0 40px 40px 0; 
    border-right: 2px solid var(--border-color);
    box-shadow: 10px 0 30px rgba(138, 75, 175, 0.15); 
    z-index: 1050; 
    padding: 30px 25px;
    transition: left 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); 
    display: flex;
    flex-direction: column;
}

.sidebar-menu.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 20px;
}

.sidebar-logo {
    font-family: "Mea Culpa", cursive;
    font-size: 32px;
    color: var(--text-main);
    line-height: 0.9;
}

.sidebar-logo span {
    font-family: "Abril Fatface", serif;
    display: block;
    font-size: 18px;
    color: var(--purple-text);
    margin-top: 5px;
}

.sidebar-close {
    width: 40px;
    height: 40px;
    background-color: var(--bg-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    color: var(--purple-text);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.sidebar-close:hover {
    background-color: var(--purple-text);
    color: white;
    transform: rotate(90deg);
}

/* Boîtes blanches principales (Sidebar + Contenu) */
.profile-sidebar, 
.profile-content-box {
    background-color: var(--bg-color, #ffffff);
    border-radius: 50px; 
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color, #E2D1ED);
}
.profile-content-box { min-height: 500px; }

/* Avatar Navbar */
.profile-min-avatar img {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid var(--border-color);
    transition: transform 0.2s ease;
}
.profile-min-avatar:hover img { transform: scale(1.1); border-color: var(--purple-text); }

/* =========================================
   BOUTON PROFIL (SIDEBAR MOBILE)
   ========================================= */

/* État par défaut (Design conservé) */
.sidebar-profile-link {
    background-color: var(--purple-light, #F8F2FB);
    border-radius: 50px;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent; /* Évite un carré bleu natif sur mobile au clic */
}

/* L'image de profil */
.sidebar-profile-link .profile-avatar {
    width: 45px; 
    height: 45px; 
    border-radius: 50%; 
    object-fit: cover;
    object-position: center;
    border: 2px solid #ffffff; 
    margin-right: 15px;
    transition: all 0.2s ease;
}

/* Le texte et la flèche (En noir) */
.sidebar-profile-link .profile-text {
    font-size: 16px;
    color: var(--text-title, #222);
    transition: color 0.2s ease;
}

.sidebar-profile-link .profile-arrow {
    color: var(--text-title, #222);
    transition: color 0.2s ease;
}

/* ===== ÉTAT AU CLIC / TOUCHER (:active) ===== */
.sidebar-profile-link:active {
    background-color: #EBE0F5; /* Le fond devient légèrement plus foncé */
}

.sidebar-profile-link:active .profile-text,
.sidebar-profile-link:active .profile-arrow {
    color: var(--purple-text, #8A4BAF); /* Le texte et la flèche passent en violet */
}

.sidebar-profile-link:active .profile-avatar {
    border-color: var(--purple-text, #8A4BAF); /* La bordure blanche de l'avatar passe en violet */
}

/* =========================================
   LIENS PRINCIPAUX DE LA SIDEBAR MOBILE
   ========================================= */
.sidebar-links > a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 16px;
    padding: 15px 20px;
    border-radius: 50px;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    border: 2px solid var(--border-color);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Les icônes à gauche des liens principaux */
.sidebar-links > a span i {
    color: var(--purple-mid);
    font-size: 18px;
    margin-right: 12px;
    transition: color 0.2s ease;
}

/* 
   ÉTAT ACTIF (Au clic) ET OUVERT
   Le bouton devient violet et le texte blanc.
   aria-expanded="true" permet de garder la couleur tant que le sous-menu est ouvert !
*/
.sidebar-links > a:active,
.sidebar-links > a[aria-expanded="true"] {
    background-color: var(--purple-mid);
    color: #ffffff;
    border-color: var(--purple-mid);
}

.sidebar-links > a:active span i,
.sidebar-links > a[aria-expanded="true"] span i {
    color: #ffffff;
}

.sidebar-links > a {
    -webkit-tap-highlight-color: rgba(138, 75, 175, 0.2); 
}

.sidebar-submenu a {
    -webkit-tap-highlight-color: rgba(138, 75, 175, 0.2);
}

/* =========================================
   ANIMATION DE LA PETITE FLÈCHE
   ========================================= */
.sidebar-chevron {
    font-size: 12px;
    transition: transform 0.3s ease;
}

/* Rotation de la flèche quand le menu est ouvert */
.sidebar-links > a[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

/* =========================================
   STYLE DES SOUS-MENUS
   ========================================= */
.sidebar-submenu {
    padding: 10px 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-submenu a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 20px;
    background-color: transparent;
    transition: background-color 0.2s ease;
}

/* État actif pour les liens du sous-menu (au doigt) */
.sidebar-submenu a:active {
    background-color: var(--purple-light);
    color: var(--purple-text);
}

/* =========================================
   HEADER GLOBAL & LIENS
   ========================================= */
.main-header {
    background-color: var(--purple-light);
    border-radius: 50px;
    padding: 15px 40px;
    transition: all 0.3s ease;
}

.nav-link-main {
    padding: 8px 12px;
    border-radius: 25px; 
    color: var(--text-main, #222);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-link-main:hover,
.nav-item-dropdown:hover .nav-link-main {
    background-color: #ffffff;
    color: var(--purple-text, #8A4BAF);
}

.icon-sm {
    font-size: 10px;
    transition: transform 0.3s ease;
}

/* =========================================
   MENUS DÉROULANTS FONCTIONNELS
   ========================================= */
.nav-item-dropdown {
    padding-bottom: 25px !important; 
    margin-bottom: -25px !important; 
}

.dropdown-custom {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px); 
    opacity: 0;
    visibility: hidden;
    background-color: var(--bg-color, #ffffff);
    min-width: 220px;
    border-radius: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color, #E2D1ED);
    padding: 12px 0;
    transition: all 0.25s ease-out; 
    z-index: 1000;
}

.nav-item-dropdown:hover .dropdown-custom {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-item-dropdown:hover .icon-sm {
    transform: rotate(180deg);
}

.dropdown-custom a {
    display: block;
    padding: 10px 20px;
    margin: 4px 12px;
    border-radius: 20px;
    color: var(--text-main, #222);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

.dropdown-custom a:hover {
    background-color: var(--purple-light, #F8F2FB);
    color: var(--purple-text, #8A4BAF);
    transform: translateX(5px);
}

/* =========================================
   BARRE DE RECHERCHE DYNAMIQUE (DESKTOP)
   ========================================= */
.search-wrapper { position: relative; }

.search-input {
    width: 0;
    opacity: 0;
    border: none; 
    background-color: transparent;
    border-radius: 25px;
    padding: 6px 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    outline: none;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.search-input::placeholder { color: #b0b0b0; }

.search-wrapper:hover .search-input,
.search-input:focus {
    width: 200px;
    opacity: 1;
    padding: 8px 18px; 
    margin-right: 10px;
    background-color: var(--bg-color); 
}

.search-wrapper:hover .search-icon,
.search-input:focus ~ .search-icon {
    color: var(--purple-text, #8A4BAF);
    transform: scale(1.1);
}

/* =========================================
   RECHERCHE MOBILE (SIDEBAR)
   ========================================= */
.search-mobile-wrapper {
    background-color: var(--purple-light, #F8F2FB);
    border-radius: 25px;
    padding: 2px 15px; 
    transition: all 0.3s ease;
    border: 1px solid transparent; 
}

.search-mobile-wrapper:focus-within {
    background-color: #ffffff;
    border-color: var(--purple-mid);
    box-shadow: 0 0 0 3px rgba(211, 184, 232, 0.3); 
}

.search-mobile-input {
    border: none;
    background: transparent;
    outline: none; 
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    padding: 10px 0; 
}

.search-mobile-input::placeholder { color: #b0b0b0; }

.search-mobile-btn {
    background: transparent;
    border: none;
    color: var(--purple-text, #8A4BAF);
    padding: 0 0 0 10px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.search-mobile-btn:hover,
.search-mobile-btn:active {
    transform: scale(1.1);
}
/* =========================================
   4. TITRES GLOBAUX
   ========================================= */
.page-title h1 {
    font-family: "Paytone One", sans-serif;
    font-size: 42px;
    color: var(--text-title);
}

.page-title p { 
    font-size: 16px; 
    font-weight: 500; 
}

.section-title { 
    font-size: 28px; 
    font-weight: 800; 
    margin-bottom: 30px; 
    color: var(--text-title); 
}

.level-title {
    font-family: 'Paytone One', sans-serif;
    font-size: 2.5rem;
    color: #000;
    margin-bottom: 30px;
    letter-spacing: -0.5px;
}

/* Bouton "Explorer les recettes" */
.btn-explore {
    display: inline-block;
    background-color: var(--brown-btn);
    color: #000;
    font-weight: 800;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    transition: transform 0.3s ease, filter 0.3s ease;
}
.btn-explore:hover {
    transform: translateY(-3px);
    filter: brightness(0.9);
    color: #000;
}

/* Typographie spécifique pour le grand chiffre 404 */
.error-code {
    font-family: 'Paytone One', sans-serif;
    font-size: clamp(6rem, 15vw, 10rem);
    color: var(--purple-text, #8A4BAF);
    line-height: 1;
    text-shadow: 4px 4px 0px var(--purple-light, #F8F2FB);
    letter-spacing: -2px;
}

/* =========================================
   5. CATÉGORIES ET TAGS
   ========================================= */
.tag { 
    padding: 5px 15px; 
    border-radius: 20px; 
    font-size: 12px; 
    font-weight: 600; 
}

.tag-pink { background-color: #FFD6E5; color: #D1497B; }
.tag-purple { background-color: #E8D5F8; color: var(--purple-text); }
.tag-blue { background-color: #D6E4FF; color: #4A72B2; }


/* =========================================
   6. SUGGESTIONS CARDS
   ========================================= */
.suggestion-card {
    border: 1px solid var(--border-color);
    border-radius: 30px; 
    text-align: center; 
    padding-bottom: 20px;
    background-color: var(--bg-color);
    transition: all 0.3s ease; 
    cursor: pointer;
}
.suggestion-card:hover {
    transform: translateY(-5px); 
    background-color: var(--purple-light);
    border-color: var(--purple-mid);
}
.suggestion-img { 
    width: calc(100% - 16px); 
    height: 180px; 
    object-fit: cover; 
    margin: 8px auto 12px auto; 
    border-radius: 22px; 
    display: block;
}
.suggestion-tag {
    display: inline-block; 
    background-color: var(--purple-light); 
    color: var(--purple-text);
    padding: 3px 12px; 
    border-radius: 15px; 
    font-size: 10px; 
    font-weight: 700; 
    margin-bottom: 10px;
    transition: all 0.3s ease;
}
.suggestion-card:hover .suggestion-tag {
    background-color: var(--bg-color); 
}
.suggestion-title { 
    font-size: 18px; 
    font-weight: 800; 
    margin-bottom: 10px;
    transition: color 0.3s ease;
}
.suggestion-card:hover .suggestion-title {
    color: var(--purple-text);
}
.suggestion-desc { 
    font-size: 11px; 
    color: var(--text-light); 
    padding: 0 15px; 
    margin-bottom: 20px; 
}
.suggestion-meta { 
    display: flex; 
    justify-content: space-between; 
    padding: 0 20px; 
    font-size: 11px; 
    color: var(--text-light); 
    font-weight: 600;
    transition: color 0.3s ease;
}
.suggestion-card:hover .suggestion-meta {
    color: var(--purple-text);
}

/* =========================================
   6. CATEGORIES CARDS
   ========================================= */
.category-card {
    background-color: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 30px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}
.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(138, 75, 175, 0.1);
    border-color: var(--purple-mid);
}

.category-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    margin: 2px auto 5px auto; 
    border-radius: 25px; 
    display: block;
}

.category-card h4 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text-main);
}

.btn-category {
    display: block;
    background-color: var(--purple-light);
    color: var(--text-main);
    font-weight: 700;
    font-size: 14px;
    padding: 10px;
    border-radius: 20px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}
.category-card:hover .btn-category {
    background-color: var(--purple-dark);
    color: white;
}

.category-card:hover {
    background-color: var(--purple-light);
}

.category-card:hover .category-title {
    color: var(--purple-text);
}

.category-card {
    position: relative; 
}

.btn-category::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1; 
}

/* =========================================
   RÈGLES RESPONSIVES (SMARTPHONES UNIQUEMENT)
   ========================================= */

@media (max-width: 767px) {
    /* HERO SECTION */
    .hero-image-container { min-height: 150px !important; display: flex; align-items: center; justify-content: center; overflow: visible !important; }
    .hero-shape-bg { top: -10% !important; right: -15% !important; width: 80% !important; height: auto !important; aspect-ratio: 1 / 1 !important; border-radius: 50% !important; }
    .hero-img { max-width: 70% !important; margin-top: -60px !important; transform: scale(1.1) translateX(0) rotate(-12deg) !important; }

    /* TEXTES GLOBAUX */
    .responsive-title { font-size: 3rem !important; }
    .section-title { font-size: 1.5rem !important; line-height: 1.4; }
    
    /* CATÉGORIES (Cartes réduites et textes contrôlés) */
    .category-card { padding: 8px !important; border-radius: 25px !important; }
    .category-card img { height: 90px !important; border-radius: 15px !important; margin-bottom: 6px !important; }
    .category-title { 
        font-size: 12px !important; 
        margin-bottom: 8px !important;
        /* L'astuce pour le texte trop long : on le force sur une ligne avec "..." */
        white-space: nowrap; 
        overflow: hidden; 
        text-overflow: ellipsis; 
    }
    .category-card .btn-category { font-size: 11px !important; padding: 5px 8px !important; border-radius: 25px !important;}

    /* SUGGESTIONS */
    .suggestion-img { height: 130px !important; }
    .suggestion-title { font-size: 14px !important; }
    .suggestion-desc { font-size: 11px !important; }
    .suggestion-meta span { font-size: 10px !important; }

    /* QUIZ (Beaucoup plus compacts, proportionnels au téléphone) */
    .quiz-hz-card { padding: 10px 12px !important; border-radius: 50px !important; }
    .quiz-hz-img { width: 65px !important; height: 50px !important; border-radius: 25px !important; }
    .quiz-hz-title { font-size: 12.5px !important; line-height: 1.2 !important; }
    .btn-quiz-play { padding: 6px 14px !important; font-size: 11px !important; border-radius: 25px !important; }
}

/* =========================================
   7. FOOTER GLOBAL
   ========================================= */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-footer {
    margin-top: auto; 
    background-image: url('../img/poly-grid.svg');
    background-size: auto 100%;
    background-position: top center;
    background-repeat: repeat-x;
    border-radius: 40px 40px 0 0; 
    padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
}