/* ============================================
   MATHSETMOI - PAGE 3ÈME - CSS PRINCIPAL
   ============================================ */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --bg-color: #ecf0f1;
    --text-color: #2c3e50;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* HEADER */
.titre-3e {
    display: flex;
    align-items: center;          /* centre verticalement texte et images */
    justify-content: center;      /* centre le bloc global */
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    min-height: 80px; /* Hauteur MINIMALE fixe */
    /* Pas de max-height sur le conteneur */
}

.titre-3e h1 {
    margin: 0;
    font-size: 2.5rem;            /* même style que ton header h1 si tu veux */
    text-align: center;
}

.titre-img {
    height: 100%;
    max-height: 70px; /* Hauteur MAXIMALE contrôlée */
    object-fit: contain; /* L'image s'adapte sans déformation */
    width: auto;
}

.titre-img.gauche {
    margin-right: auto;           /* pousse le titre vers le centre */
    max-height: 80px; /* Légèrement plus grande */
}

.titre-img.droite {
    margin-left: auto;            /* pousse le titre vers le centre */
     max-height: 50px; /* Plus petite */
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.breadcrumb {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: white;
    text-decoration: none;
}

/* MAIN */
main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

section {
    background: white;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--secondary-color);
}

/* CHAPITRES */
.chapitres-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.chapitre-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    border-left: 4px solid var(--secondary-color);
    position: relative;
}

.chapitre-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.chapitre-card.prioritaire {
    border-left-color: var(--accent-color);
}

.chapitre-card.prioritaire::before {
    content: "⭐ Prioritaire";
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--accent-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
}

.chapitre-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.actions a, .btn {
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: white;
    background: var(--secondary-color);
}

.actions a:hover {
    background: #2980b9;
}

/* FORMULAIRE */
fieldset {
    border: 2px solid var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

legend {
    color: var(--primary-color);
    font-weight: bold;
    padding: 0 0.5rem;
}

label {
    display: block;
    margin: 0.5rem 0;
}

input[type="range"] {
    width: 100%;
}

button[type="submit"] {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
}

button[type="submit"]:hover {
    background: #229954;
}

/* ============================================
   UTILITAIRES IMPRESSION
   ============================================ */

.no-print {
    /* Masqué à l'impression */
}

@media print {
    .no-print {
        display: none !important;
    }
    
    /* Optimisations générales pour impression */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    body {
        background: white;
    }
    
    a[href]:after {
        content: none !important;
    }
}