/* ============================================
 * H1-HARMONIZATION-FIX.CSS
 * Harmonisation des styles du titre H1 
 * entre categories.php et recette.php
 * ============================================ */

/* ============================================
 * STYLES COMMUNS POUR TOUS LES H1
 * Appliqué à la fois sur categories.php et recette.php
 * ============================================ */

/* Styles de base pour tous les H1 principaux */
.main-content h1,
.main-content h1.main-title,
.recette-header h1,
.recette-header h1.main-title,
.categories-recettes-page .main-content h1,
.recette-page .recette-header h1,
.profil-header h1.main-title,
.contact-content h1.page-title {
    /* Typographie */
    font-size: 1.7rem !important;
    line-height: 1.3 !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    
    /* Couleurs */
    color: var(--text-color) !important;
    
    /* Espacement */
    margin-top: 0 !important;
    margin-bottom: 30px !important;
    padding-bottom: 10px !important;
    
    /* Positionnement pour la ligne décorative */
    position: relative !important;
    display: inline-block !important;
    
    /* Réinitialisation */
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* Ligne décorative sous le H1 - Style unifié */
.main-content h1::after,
.main-content h1.main-title::after,
.recette-header h1::after,
.recette-header h1.main-title::after,
.categories-recettes-page .main-content h1::after,
.recette-page .recette-header h1::after,
.profil-header h1.main-title::after,
.contact-content h1.page-title::after {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    bottom: -2px !important;
    width: 100px !important;
    height: 3px !important;
    background-color: var(--primary-color) !important;
    border-radius: 0 !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

/* ============================================
 * RESPONSIVE - TABLETTES ET GRANDS ÉCRANS
 * ============================================ */

@media screen and (max-width: 1200px) {
    .main-content h1,
    .main-content h1.main-title,
    .recette-header h1,
    .recette-header h1.main-title,
    .categories-recettes-page .main-content h1,
    .recette-page .recette-header h1,
    .profil-header h1.main-title,
    .contact-content h1.page-title {
        font-size: 1.6rem !important;
    }
}

@media screen and (max-width: 1024px) {
    .main-content h1,
    .main-content h1.main-title,
    .recette-header h1,
    .recette-header h1.main-title,
    .categories-recettes-page .main-content h1,
    .recette-page .recette-header h1,
    .profil-header h1.main-title,
    .contact-content h1.page-title {
        font-size: 1.5rem !important;
        margin-bottom: 25px !important;
    }
}

/* ============================================
 * RESPONSIVE - TABLETTES
 * ============================================ */

@media screen and (max-width: 768px) {
    .main-content h1,
    .main-content h1.main-title,
    .recette-header h1,
    .recette-header h1.main-title,
    .categories-recettes-page .main-content h1,
    .recette-page .recette-header h1,
    .profil-header h1.main-title,
    .contact-content h1.page-title {
        font-size: 1.5rem !important;
        margin-bottom: 25px !important;
        padding-bottom: 8px !important;
    }

    /* Ajustement de la ligne décorative pour tablettes */
    .main-content h1::after,
    .main-content h1.main-title::after,
    .recette-header h1::after,
    .recette-header h1.main-title::after,
    .categories-recettes-page .main-content h1::after,
    .recette-page .recette-header h1::after,
    .profil-header h1.main-title::after,
    .contact-content h1.page-title::after {
        width: 80px !important;
        height: 3px !important;
    }
}

/* ============================================
 * RESPONSIVE - SMARTPHONES (largeur moyenne)
 * ============================================ */

@media screen and (min-width: 321px) and (max-width: 480px) {
    .main-content h1,
    .main-content h1.main-title,
    .recette-header h1,
    .recette-header h1.main-title,
    .categories-recettes-page .main-content h1,
    .recette-page .recette-header h1,
    .profil-header h1.main-title,
    .contact-content h1.page-title {
        font-size: 1.4rem !important;
        line-height: 1.75rem !important;
        margin-bottom: 20px !important;
        padding-bottom: 8px !important;
    }

    /* Ligne décorative plus petite sur mobile */
    .main-content h1::after,
    .main-content h1.main-title::after,
    .recette-header h1::after,
    .recette-header h1.main-title::after,
    .categories-recettes-page .main-content h1::after,
    .recette-page .recette-header h1::after,
    .profil-header h1.main-title::after,
    .contact-content h1.page-title::after {
        width: 70px !important;
        height: 2.5px !important;
    }
}

/* ============================================
 * RESPONSIVE - PETITS SMARTPHONES
 * ============================================ */

@media screen and (max-width: 320px) {
    .main-content h1,
    .main-content h1.main-title,
    .recette-header h1,
    .recette-header h1.main-title,
    .categories-recettes-page .main-content h1,
    .recette-page .recette-header h1,
    .profil-header h1.main-title,
    .contact-content h1.page-title {
        font-size: 1.25rem !important;
        line-height: 1.65rem !important;
        margin-bottom: 20px !important;
        padding-bottom: 8px !important;
    }

    /* Ligne décorative encore plus petite */
    .main-content h1::after,
    .main-content h1.main-title::after,
    .recette-header h1::after,
    .recette-header h1.main-title::after,
    .categories-recettes-page .main-content h1::after,
    .recette-page .recette-header h1::after,
    .profil-header h1.main-title::after,
    .contact-content h1.page-title::after {
        width: 60px !important;
        height: 2px !important;
    }
}

/* ============================================
 * MODE SOMBRE
 * ============================================ */

.dark-mode .main-content h1,
.dark-mode .main-content h1.main-title,
.dark-mode .recette-header h1,
.dark-mode .recette-header h1.main-title,
.dark-mode .categories-recettes-page .main-content h1,
.dark-mode .recette-page .recette-header h1,
.dark-mode .profil-header h1.main-title,
.dark-mode .contact-content h1.page-title {
    color: white !important;
}

.dark-mode .main-content h1::after,
.dark-mode .main-content h1.main-title::after,
.dark-mode .recette-header h1::after,
.dark-mode .recette-header h1.main-title::after,
.dark-mode .categories-recettes-page .main-content h1::after,
.dark-mode .recette-page .recette-header h1::after,
.dark-mode .profil-header h1.main-title::after,
.dark-mode .contact-content h1.page-title::after {
    background-color: var(--primary-color) !important;
}

/* ============================================
 * SPÉCIFICITÉS PAR PAGE (si nécessaire)
 * ============================================ */

/* Ajustements spécifiques pour la page categories si besoin */
.categories-recettes-page .main-content h1 {
    /* Maintenir l'alignement gauche par défaut */
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Ajustements spécifiques pour la page recette si besoin */
.recette-page .recette-header h1 {
    /* Maintenir l'alignement gauche par défaut */
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Ajustements spécifiques pour la page profil */
.profil-header h1.main-title {
    /* Pas de margin-bottom pour le profil (géré par le layout du header) */
    margin-bottom: 0 !important;
}

/* ============================================
 * CORRECTION DE CONFLITS POTENTIELS
 * Force l'application des styles avec !important
 * pour surcharger les styles existants
 * ============================================ */

/* S'assurer que le H1 reste inline-block pour la ligne décorative */
.main-content h1,
.recette-header h1,
.profil-header h1.main-title,
.contact-content h1.page-title {
    display: inline-block !important;
    width: auto !important;
    max-width: 100% !important;
}

/* Reset de styles potentiellement conflictuels */
/* Exception pour les icônes Font Awesome (i, .fa-*) et les SVG */
.main-content h1 *:not(i):not([class*="fa-"]):not(svg):not(circle):not(.profil-nutrition-icon),
.recette-header h1 *:not(i):not([class*="fa-"]):not(svg):not(circle):not(.profil-nutrition-icon) {
    all: unset !important;
    display: inline !important;
    font: inherit !important;
    color: inherit !important;
}

/* Styles pour les icônes SVG dans les H1 (nutrition, etc.) */
.main-content h1 svg.profil-nutrition-icon {
    display: inline-block !important;
    width: 32px !important;
    height: 32px !important;
    vertical-align: middle !important;
    margin-right: 0.2rem !important;
    color: var(--primary-color, #FF6B6B) !important;
    flex-shrink: 0 !important;
}

.main-content h1 svg.profil-nutrition-icon .nutrition-circle {
    stroke-dasharray: 1005.31 !important;
    stroke-dashoffset: 251.33 !important; /* 75% visible */
    transform: rotate(-90deg) !important;
    transform-origin: center !important;
}
