/* Theme: What to Serve (Midnight & Gold)
Style: Elegant, Clean, Light Backgrounds
Fonts: Playfair Display + Lato
*/

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

:root {
    /* Palette Branding */
    --midnight-blue: #1B2631;
    --midnight-light: #2C3E50;
    --gold: #C5A059;
    --gold-light: #D4AF37;
    --gold-pale: #F9F1D8;
    
    /* Couleurs fonctionnelles */
    --primary-white: #ffffff;
    --bg-light: #F8F9FA;
    --text-dark: #2D3748;
    --text-light: #718096;
    --border-light: #E2E8F0;
    
    /* Accents feedback */
    --success-green: #27AE60;
    --warning-orange: #E67E22;
    --danger-red: #C0392B;

    /* Configuration */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    
    --font-h: 'Playfair Display', serif;
    --font-b: 'Lato', sans-serif;
    
    --smooth-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- SAFETY RESET --- */
.recipe-container, 
.recipe-container * {
    box-sizing: border-box;
}

/* --- BASE CONTAINER --- */
.recipe-container {
    font-family: var(--font-b);
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-dark);
    background: var(--primary-white);
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s ease-out;
}

.recipe-container.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Typography */
.recipe-container h1, 
.recipe-container h2, 
.recipe-container h3, 
.recipe-container h4 {
    font-family: var(--font-h);
    color: var(--midnight-blue);
    font-weight: 700;
    margin-top: 0;
    line-height: 1.2;
}

/* --- LOADER --- */
.page-loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--primary-white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    color: var(--gold);
}

.cooking-animation {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* --- SCROLL BAR --- */
.scroll-progress {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important; height: 4px !important;
    z-index: 10000 !important;
    pointer-events: none;
}

.scroll-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--gold);
    transition: width 0.1s linear;
}

/* --- HEADER --- */
.recipe-header-modern {
    background: var(--primary-white);
    padding: 0 0 40px 0;
    text-align: center;
}

/* Breadcrumbs */
.breadcrumb-nav {
    margin-bottom: 30px;
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.breadcrumb-link {
    color: var(--text-light);
    text-decoration: none;
    transition: var(--smooth-transition);
}

.breadcrumb-link:hover {
    color: var(--gold);
}

.breadcrumb-separator {
    margin: 0 10px;
    color: var(--gold-light);
}

.breadcrumb-current {
    color: var(--midnight-blue);
    font-weight: 700;
}

/* Title & Rating */
.recipe-title-modern {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--midnight-blue);
}

.recipe-rating-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.rating-stars {
    color: var(--gold);
    font-size: 1.1rem;
}

.rating-value {
    color: var(--text-dark);
    font-weight: 700;
    margin-left: 8px;
    font-size: 0.9rem;
}

.comments-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid transparent;
    transition: var(--smooth-transition);
}

.comments-link:hover {
    color: var(--gold);
    border-color: var(--gold);
}

.comments-link i {
    color: var(--gold);
    margin-right: 5px;
}

/* --- MAIN MEDIA --- */
.recipe-main-media {
    margin-bottom: 40px;
    position: relative;
}

.main-image-container {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.recipe-main-image-modern {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.main-image-container:hover .recipe-main-image-modern {
    transform: scale(1.02);
}

/* Overlay Actions */
.image-overlay-actions {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--smooth-transition);
}

.main-image-container:hover .image-overlay-actions {
    opacity: 1;
    transform: translateY(0);
}

.overlay-btn {
    background: var(--primary-white);
    color: var(--midnight-blue);
    border: 1px solid var(--midnight-blue);
    padding: 8px 16px;
    border-radius: 30px;
    font-family: var(--font-b);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--smooth-transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.overlay-btn:hover {
    background: var(--midnight-blue);
    color: var(--gold);
}

/* Gallery */
.recipe-gallery {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.gallery-thumb {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--smooth-transition);
    border: 2px solid transparent;
}

.gallery-thumb:hover, .gallery-thumb.active {
    opacity: 1;
    border-color: var(--gold);
}

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

.gallery-more {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    background: var(--midnight-light);
    color: var(--primary-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

/* --- BADGES (Icons Only) --- */
.recipe-info-badges {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: 20px 0;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-icon {
    font-size: 1.4rem;
    color: var(--gold);
}

.badge-content {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.badge-value {
    font-weight: 700;
    color: var(--midnight-blue);
    font-size: 1rem;
    line-height: 1;
}

.badge-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* --- DESCRIPTION --- */
.recipe-description-modern {
    font-family: var(--font-h);
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    font-style: italic;
}

/* --- MAIN ACTIONS BAR --- */
.recipe-actions-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 50px;
}

.action-btn {
    padding: 14px 28px;
    border-radius: 2px; /* Coins un peu carrés pour le style élégant */
    font-family: var(--font-b);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--smooth-transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.primary-action {
    background: var(--midnight-blue);
    color: var(--primary-white);
    border: 1px solid var(--midnight-blue);
}

.primary-action:hover {
    background: var(--primary-white);
    color: var(--midnight-blue);
}

.secondary-action {
    background: var(--primary-white);
    color: var(--midnight-blue);
    border: 1px solid var(--border-light);
}

.secondary-action:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* --- GRID LAYOUT --- */
.recipe-main-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr; /* Sidebar gauche (ingrédients) plus petite */
    gap: 40px;
}

/* Sections communes */
.section-title {
    font-size: 1.8rem;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gold-pale);
    color: var(--midnight-blue);
}

/* --- INGREDIENTS HEADER & PORTIONS --- */
.ingredients-section {
    background: var(--bg-light);
    padding: 30px 20px;
    border-radius: var(--radius-md);
    text-align: center; /* Centre le contenu globalement */
}

.section-header {
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
}

.section-title {
    margin: 0;
    border: none;
    padding: 0;
}

/* Conteneur qui force le centrage sous le titre */
.portions-wrapper-center {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 25px;
}

/* La barre compacte */
.portions-adjuster {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--primary-white);
    border: 1px solid var(--border-light);
    border-radius: 50px;
    padding: 5px 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.portion-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-light);
    color: var(--midnight-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.portion-btn:active {
    background: var(--gold);
}

.portion-count {
    padding: 0 10px;
    font-weight: 800;
    color: var(--midnight-blue);
    font-size: 1.1rem;
    min-width: 25px;
    text-align: center;
}

/* Texte TOUJOURS visible */
.portion-label-text {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 1px;
    margin-right: 5px;
    font-family: var(--font-b);
    display: inline-block !important; /* Force l'affichage */
}



/* Visual Ingredients Grid */
.ingredients-subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 20px;
    font-style: italic;
}

.ingredients-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.ingredient-card-modern {
    background: var(--primary-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
    transition: var(--smooth-transition);
    cursor: pointer;
    position: relative;
}

.ingredient-card-modern:hover {
    border-color: var(--gold);
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}

.ingredient-card-modern.checked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.ingredient-card-modern img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    margin-bottom: 8px;
    border-radius: 50%; /* Cercle pour l'élégance */
}

.ingredient-name-modern {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
}

/* Ingredients List */
.ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ingredient-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: var(--smooth-transition);
}

.ingredient-item:last-child {
    border-bottom: none;
}

.ingredient-item:hover .ingredient-text {
    color: var(--midnight-blue);
}

.ingredient-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gold);
    border-radius: 50%;
    margin-right: 15px;
    margin-top: 3px;
    position: relative;
    flex-shrink: 0;
    transition: var(--smooth-transition);
}

.ingredient-item.checked .ingredient-checkbox {
    background: var(--gold);
    border-color: var(--gold);
}

.ingredient-item.checked .ingredient-checkbox::after {
    content: '✓';
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

.ingredient-item.checked .ingredient-text {
    text-decoration: line-through;
    color: var(--text-light);
}

.ingredient-text {
    font-size: 1rem;
    color: var(--text-dark);
}

/* --- INSTRUCTIONS --- */
.instructions-section {
    background: var(--primary-white);
}

.instruction-step {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.step-number {
    font-family: var(--font-h);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold-light);
    line-height: 1;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.step-content {
    flex: 1;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 40px;
}

.instruction-step:last-child .step-content {
    border-bottom: none;
}

.step-content p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.step-image-container {
    margin: 20px 0;
}

.step-image {
    max-width: 100%;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
}

.step-done-btn {
    background: transparent;
    border: 1px solid var(--text-light);
    color: var(--text-light);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--smooth-transition);
}

.step-done-btn:hover, .step-done-btn.completed {
    background: var(--success-green);
    border-color: var(--success-green);
    color: white;
}

/* --- EXTRA SECTIONS (Utensils, Tips, etc.) --- */
.section-card {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border-light);
}

/* Thèmes de couleur légers */
.light-theme { background: #FDFBF7; border-color: var(--gold-pale); } /* Teinte crème */

.utensils-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.utensil-card-modern {
    text-align: center;
    padding: 15px;
    background: var(--primary-white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
}

.utensil-card-modern img {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
}

.utensil-name-modern {
    font-size: 0.85rem;
    font-weight: 600;
}

.affiliate-badge {
    position: absolute;
    top: 5px; right: 5px;
    color: var(--gold);
    font-size: 0.8rem;
}

/* Tips Grid */
.tips-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.tip-card {
    background: var(--primary-white);
    padding: 20px;
    border-left: 4px solid var(--gold);
    display: flex;
    gap: 15px;
}

.tip-icon {
    color: var(--gold);
    font-size: 1.2rem;
    margin-top: 2px;
}

/* Storing / Troubleshoot Grid */
.storing-grid {
    display: grid;
    gap: 15px;
}

.storing-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.storing-icon {
    color: var(--midnight-blue);
    font-size: 1.1rem;
    margin-top: 2px;
}

/* --- NUTRITION --- */
.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    text-align: center;
}

.nutrition-item {
    padding: 15px;
    background: var(--primary-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.nutrition-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--midnight-blue);
    font-family: var(--font-h);
}

.nutrition-label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
}

/* --- FAQ --- */
.faq-item {
    border-bottom: 1px solid var(--border-light);
}

.faq-question {
    padding: 15px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--midnight-blue);
}

.faq-question:hover {
    color: var(--gold);
}

.faq-arrow {
    transition: transform 0.3s;
    font-size: 0.8rem;
}

.faq-item.active .faq-arrow {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer p {
    padding-bottom: 15px;
    color: var(--text-dark);
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

/* --- REVIEWS --- */
.reviews-grid {
    display: grid;
    gap: 20px;
}

.review-card {
    background: var(--primary-white);
    padding: 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.review-name {
    font-weight: 700;
    color: var(--midnight-blue);
}

.review-rating i {
    color: var(--gold);
    font-size: 0.8rem;
}

.review-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* --- TIMER SIDEBAR (Floating) --- */
.timer-sidebar {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 990;
    transition: transform 0.3s ease;
}

.timer-card {
    background: var(--midnight-blue);
    color: var(--primary-white);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-hover);
    width: 180px;
}

.timer-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    color: var(--gold);
}

.timer-display {
    font-family: monospace;
    font-size: 2rem;
    margin-bottom: 15px;
}

.custom-timer {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.custom-timer input {
    width: 60px;
    padding: 5px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    text-align: center;
    border-radius: 4px;
}

.timer-set-btn {
    background: var(--gold);
    border: none;
    color: var(--midnight-blue);
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.timer-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--smooth-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-btn:hover {
    background: var(--gold);
    color: var(--midnight-blue);
}

/* --- FLOATING ACTIONS (Mobile/Desktop) --- */
.floating-actions {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 995;
}

.recipe-fab {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-white);
    color: var(--midnight-blue);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-hover);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--smooth-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.recipe-fab:hover {
    background: var(--midnight-blue);
    color: var(--gold);
    transform: scale(1.1);
}

/* --- YOUTUBE --- */
.youtube-video-section {
    margin: 40px 0;
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
}

.video-container-standard, .video-container-short {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
    margin: 20px auto;
}

.video-container-standard {
    padding-bottom: 56.25%; /* 16:9 */
    max-width: 100%;
}

.video-container-short {
    max-width: 350px;
    height: 600px;
}

.video-container-standard iframe, 
.video-container-short iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border: 0;
}

.video-disclaimer {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 10px;
}

/* --- MODAL --- */
.image-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(27, 38, 49, 0.95); /* Midnight blue opacity */
    z-index: 999999;
    cursor: pointer;
    justify-content: center;
    align-items: center;
}

.image-modal.show {
    display: flex;
}

#modal-image {
    max-width: 90%;
    max-height: 90vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.modal-close {
    position: absolute;
    top: 20px; right: 30px;
    color: var(--primary-white);
    font-size: 40px;
    font-weight: 300;
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .recipe-main-grid {
        grid-template-columns: 1fr;
    }
    
    .timer-sidebar {
        position: static;
        transform: none;
        width: 100%;
        margin: 30px 0;
    }
    
    .timer-card {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 20px;
    }
    
    .recipe-title-modern {
        font-size: 2.2rem;
    }
}

@media (max-width: 600px) {
    .recipe-container {
        padding: 0 15px;
    }
    
    .recipe-header-modern {
        padding: 0;
    }
    
    .recipe-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-btn {
        justify-content: center;
    }
    
    .recipe-info-badges {
        gap: 15px;
    }
    
    .badge-item {
        width: 45%;
        justify-content: center;
        flex-direction: column;
        text-align: center;
    }
    
    .badge-content {
        align-items: center;
    }
    
    .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print Styles */
@media print {
    .recipe-actions-bar,
    .timer-sidebar,
    .floating-actions,
    .page-loader,
    .image-overlay-actions {
        display: none !important;
    }
    
    .recipe-container {
        box-shadow: none;
        margin: 0;
        max-width: 100%;
    }
    
    a { text-decoration: none; color: black; }
}