/* === PAGE CALCULATRICE GRAPHIQUE - CSS OPTIMISÉ === */

/* Header de la page calculatrice */
.page-header.cours-particuliers-header {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 120px 0 80px;
    position: relative;
    color: white;
    text-align: center;
}

.page-header.cours-particuliers-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.page-header .header-content {
    position: relative;
    z-index: 2;
}

.page-header .page-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.page-header .page-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Section principale de la calculatrice */
.graph-calc-section {
    background: #f8fafc;
    border-radius: 16px;
    box-shadow: 0 2px 12px #e0e7ef;
    padding: 32px 24px;
    max-width: 600px;
    margin: 40px auto 0 auto;
    transition: all 0.3s ease;
}

.graph-calc-section:hover {
    box-shadow: 0 4px 20px #e0e7ef;
}

.graph-calc-section h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #3b3b5c;
    text-align: center;
    font-weight: 700;
}

.graph-calc-section p {
    color: #555;
    text-align: center;
    margin-bottom: 10px;
    margin-top: 0.5rem;
    line-height: 1.5;
}

/* Formulaire de la calculatrice */
#graph-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

#graph-form label {
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 0;
    line-height: 1.2;
    font-size: 0.95rem;
}

#graph-form input[type="text"],
#graph-form input[type="number"] {
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 1rem;
    background: #fff;
    transition: all 0.2s ease;
    margin-bottom: 0;
    box-shadow: 0 1px 2px #e0e7ef33;
    width: 300px;
    margin-left: 5px;
}

#graph-form input[type="text"]:focus,
#graph-form input[type="number"]:focus {
    border: 1.5px solid #6366f1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#graph-form input[type="number"] {
    width: 80px;
    margin-right: 10px;
}

#graph-form input[type="number"]:last-of-type {
    margin-right: 0;
}

/* Fieldset pour la fenêtre d'affichage */
#graph-form fieldset {
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    background: #f1f5f9;
    margin-bottom: 6px;
    padding: 8px 8px 4px 8px;
    transition: all 0.2s ease;
}

#graph-form fieldset:hover {
    border-color: #6366f1;
    background: #f8fafc;
}

#graph-form legend {
    font-size: 1.05rem;
    color: #6366f1;
    font-weight: 600;
    margin-bottom: 0;
    padding: 0 8px;
}

/* Bouton de tracé */
#tracer-btn {
    background: linear-gradient(90deg, #6366f1, #764ba2);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 0;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    box-shadow: 0 2px 8px #c7d2fe55;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tracer-btn:hover {
    background: linear-gradient(90deg, #764ba2, #6366f1);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px #c7d2fe55;
}

#tracer-btn:active {
    transform: translateY(0);
}

/* Résultat du graphique */
#graph-result {
    margin: 40px auto 0 auto;
    text-align: center;
    max-width: 900px;
    width: 100%;
}

/* Canvas du graphique */
#graph-canvas {
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
    background: white;
    display: block;
    margin: 0 auto;
    cursor: crosshair;
    transition: all 0.3s ease;
}

#graph-canvas:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.25);
    transform: translateY(-2px);
}

#graph-result img {
    border-radius: 12px;
    margin-top: 0;
    box-shadow: 0 4px 16px #c7d2fe55;
    width: 100%;
    max-width: 900px;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.3s ease;
}

#graph-result img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 24px #c7d2fe55;
}

/* Messages d'erreur */
#graph-result p {
    color: #ef4444;
    font-weight: 500;
    padding: 16px;
    background: #fef2f2;
    border-radius: 8px;
    border: 1px solid #fecaca;
    margin: 20px 0;
}

/* Messages de chargement */
#graph-result p.loading-message {
    color: #6366f1;
    background: #f0f9ff;
    border-color: #bae6fd;
}

/* Bloc d'analyse mathématique */
.analyse-math-block {
    background: #f1f5fa;
    border-radius: 14px;
    box-shadow: 0 2px 10px #e0e7ef55;
    padding: 28px 24px 18px 24px;
    margin: 36px auto 0 auto;
    max-width: 900px;
    color: #1e293b;
    font-size: 1.08rem;
    transition: all 0.3s ease;
}

.analyse-math-block:hover {
    box-shadow: 0 4px 16px #e0e7ef55;
}

.analyse-math-block h3 {
    color: #6366f1;
    font-size: 1.3rem;
    margin-top: 0;
    margin-bottom: 18px;
    text-align: center;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.analyse-fonction {
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e7ef;
    transition: all 0.2s ease;
}

.analyse-fonction:hover {
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    padding: 12px;
    margin: 0 -12px 18px -12px;
}

.analyse-fonction:last-child {
    border-bottom: none;
}

.analyse-fonction ul {
    margin: 8px 0 0 0;
    padding-left: 18px;
}

.analyse-fonction li {
    margin-bottom: 4px;
    line-height: 1.5;
}

.analyse-fonction b {
    color: #3b3b5c;
    font-weight: 600;
}

/* Gestion des erreurs de formulaire */
.fonction-error {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 4px;
    margin-left: 5px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header .page-title {
        font-size: 2.5rem;
    }
    
    .page-header .page-subtitle {
        font-size: 1.2rem;
    }
    
    .graph-calc-section {
        margin: 20px 16px 0 16px;
        padding: 24px 16px;
    }
    
    #graph-form input[type="text"] {
        width: 100%;
        margin-left: 0;
    }
    
    #graph-form input[type="number"] {
        width: 70px;
        margin-right: 8px;
    }
    
    .analyse-math-block {
        margin: 20px 16px 0 16px;
        padding: 20px 16px;
    }
    
    #graph-result {
        margin: 20px 16px 0 16px;
    }
    
    /* Canvas responsive en mobile */
    #graph-canvas {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .page-header .page-title {
        font-size: 2rem;
    }
    
    .page-header .page-subtitle {
        font-size: 1rem;
    }
    
    .graph-calc-section h2 {
        font-size: 1.6rem;
    }
    
    #tracer-btn {
        padding: 10px 0;
        font-size: 1rem;
    }
    
    .analyse-math-block h3 {
        font-size: 1.1rem;
    }
    
    /* Canvas pour très petits écrans */
    #graph-canvas {
        max-height: 300px;
    }
}
