/* ===============================
   VARIABLES DE THÈME (INCHANGÉES)
================================ */
:root {
    --bg-body: #f5f5f5;
    --bg-card: #fff;
    --bg-sidebar: #f08a5b;
    --bg-sidebar-hover: #f3a480;
    --text-main: #222;
    --text-about: #444;
    --accent: #ff7a18;
    --hero-gradient: linear-gradient(135deg, #ffb347, #ffcc7a);
    --shadow-color: rgba(0,0,0,0.1);
    --overlay-bg: rgba(255, 255, 255, 0.3);
}

body.dark-theme {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-sidebar: #b91c1c;
    --bg-sidebar-hover: #dc2626;
    --text-main: #f5f5f5;
    --text-about: #ccc;
    --accent: #ef4444;
    --hero-gradient: linear-gradient(135deg, #991b1b, #ef4444);
    --shadow-color: rgba(0,0,0,0.5);
    --overlay-bg: rgba(0, 0, 0, 0.5);
}

/* ===============================
   RESET & BASE
================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Manrope", sans-serif;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    transition: background 0.4s, color 0.4s;
    overflow-x: hidden; /* Empêche le bug du scroll horizontal */
}

/* ===============================
   SIDEBAR
================================ */
nav {
    background-color: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 220px;
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    padding-top: 40px;
    transition: transform 0.3s ease-in-out; /* Plus fluide que 'left' */
}

nav.hidden {
    transform: translateX(-100%); /* Sort de l'écran */
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

nav li a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
}

nav li a:hover {
    background-color: var(--bg-sidebar-hover);
    color: #fff;
}

/* Hamburger */
.hamburger {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    z-index: 1101;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 4px;
    background: var(--text-main);
    margin-bottom: 5px;
    border-radius: 2px;
    transition: all 0.3s ease, background 0.4s;
}

.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(6.2px, 6.2px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(6.2px, -6.2px); }

#mainContent {
    margin-left: 0px;
    width: 100%;
    padding-top: 40px;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centre tout le contenu global */
}

#mainContent.shift {
    margin-left: 220px;
}

/* ===============================
   HERO
================================ */
.hero {
    text-align: center;
    padding: 60px 20px 40px 20px;
    background: var(--hero-gradient);
    color: var(--text-main);
    margin-bottom: 40px;
    width: 100%; /* Prend toute la largeur */
}

.hero h1 {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: 0.3s;
}

/* ===============================
   SECTIONS & GRID (CENTRAGE FIXÉ)
================================ */
section {
    margin-bottom: 50px;
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

section h2 {
    font-size: 1.8rem;
    text-align: center;
    color: var(--accent);
    margin-bottom: 25px;
}

/* Grille des recettes récentes */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    width: 100%;
    justify-content: center; /* Centre les éléments dans la grille */
}

.recipe-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 20px var(--shadow-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.4s;
    width: 280px;
}

.recipe-card img {
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: 15px;
    object-fit: cover;
    margin-bottom: 15px;
}

/* ===============================
   POPULAR SLIDER
================================ */
.slider-container {
    width: 100%;
    overflow-x: auto; /* Active le slider horizontal */
    padding-bottom: 20px;
    display: block; /* Important pour le scroll */
    -webkit-overflow-scrolling: touch; /* Scroll fluide sur iPhone */
}

.slider-container::-webkit-scrollbar {
    display: none; /* Cache la barre de scroll */
}

.slider {
    display: flex;
    gap: 20px;
    padding: 0 10px;
    justify-content: flex-start; /* Aligné à gauche à l'intérieur du scroll */
}

.slider .recipe-card {
    width: 280px; /* Taille fixe des cartes dans le slider */
    flex-shrink: 0; /* Empêche les cartes de s'écraser */
}

/* ===============================
   TOP & RAPIDE (LIMITATION TAILLE)
================================ */
.top-recipe .recipe-card,
.recipeRapide .recipe-card {
    max-width: 300px; /* Évite que l'image soit géante sur mobile */
}
.recipes-grid .recipe-card {
    background: var(--bg-card); /* VARIABLE */
    padding: 15px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 4px 10px var(--shadow-color); /* VARIABLE */
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.4s;
}

/* ===============================
   QUERIES PORTRAIT (iPhone 14 Pro)
================================ */
@media (max-width: 768px) {
    #mainContent { padding: 20px 10px; }
   
    #mainContent.shift {
        margin-left: 0; /* Ne pas décaler le contenu sur mobile (trop petit) */
    }
   
   .hero p {
       font-size: 1.5rem;
       max-width: 800px;
       margin: 0 auto;
   }

   section h2 {
       font-size: 2.1rem;
       text-align: center;
       color: var(--accent);
       margin-bottom: 25px;
   }

   
}

@media (orientation: portrait) {
    nav {
        width: 30%;
        padding-top: 80px
    }

    nav.hidden {
        left: -30%;
    }

    #mainContent.shift {
        margin-left: 30%;
    }

    nav li a {
        font-size: 2.8rem;
        padding: 25px 24px;
    }
   
   nav ul {
       list-style: none;
       padding: 0;
       margin: 0;
   }
   .hamburger {
        position: fixed;
        top: 20px;
        left: 20px;
        width: 60px;
        height: 48px;
    }

    .hamburger span {
        display: block;
        width: 100%;
        height: 8px;
        margin-bottom: 10px;
        border-radius: 4px;
    }
    .hamburger.open span:nth-child(1) {
        transform: rotate(45deg) translate(12.2px, 12.2px);
    }

    .hamburger.open span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.open span:nth-child(3) {
        transform: rotate(-45deg) translate(12.2px, -12.2px);
    }
}

/* Style de l'Overlay */
#overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(5px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 999;
}
#overlay.active { opacity: 1; pointer-events: auto; }





