/* === CALCULATRICE NUMÉRIQUE - CSS === */

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

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

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

.calculator-section p {
    color: #555;
    text-align: center;
    margin-bottom: 32px;
    line-height: 1.5;
}

/* Conteneur de la calculatrice */
.calculator-container {
    background: #2d3748;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    margin: 0 auto;
}

/* Écran de la calculatrice */
.calculator-screen {
    background: #1a202c;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #4a5568;
    min-height: 144px; /* Augmentation de 20% : 120px * 1.2 = 144px */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.screen-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.display-line {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    color: #e2e8f0;
    text-align: right;
    word-wrap: break-word;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.display-line.result-line {
    font-size: 1.4rem;
    font-weight: 600;
    color: #68d391;
    border-top: 1px solid #4a5568;
    padding-top: 8px;
}

/* Grille des boutons */
.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

/* Styles des boutons - Base */
.calc-btn {
    background: #4a5568;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    padding: 16px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.calc-btn:hover {
    background: #5a6578;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.calc-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Boutons de chiffres - Spécificité élevée */
.calc-btn.number-btn {
    background: #2d3748 !important;
    font-size: 1.2rem;
}

.calc-btn.number-btn:hover {
    background: #3a4552 !important;
}

/* Boutons d'opérateurs - Spécificité élevée */
.calc-btn.operator-btn {
    background: #3182ce !important;
    font-size: 1.1rem;
}

.calc-btn.operator-btn:hover {
    background: #2c5aa0 !important;
}

/* Boutons de fonctions - Spécificité élevée */
.calc-btn.function-btn {
    background: #805ad5 !important;
    font-size: 0.9rem;
    padding: 12px 6px;
}

.calc-btn.function-btn:hover {
    background: #6b46c1 !important;
}

/* Boutons spéciaux - Spécificité élevée */
.calc-btn[data-function="off"] {
    background: #e53e3e !important;
    font-weight: 700;
}

.calc-btn[data-function="off"]:hover {
    background: #c53030 !important;
}

.calc-btn[data-function="equals"] {
    background: #38a169 !important;
    font-size: 1.2rem;
    font-weight: 700;
}

.calc-btn[data-function="equals"]:hover {
    background: #2f855a !important;
}

.calc-btn[data-function="delete"] {
    background: #dd6b20 !important;
    font-size: 1.1rem;
}

.calc-btn[data-function="delete"]:hover {
    background: #c05621 !important;
}

/* Boutons de mode actifs */
.calc-btn.active {
    background: #f6ad55 !important;
    color: #2d3748;
    font-weight: 700;
}

.calc-btn.active:hover {
    background: #ed8936 !important;
}

/* Section d'aide */
.help-section {
    background: #f8fafc;
    border-radius: 16px;
    box-shadow: 0 2px 12px #e0e7ef;
    padding: 32px 24px;
    max-width: 1000px;
    margin: 40px auto 0 auto;
    transition: all 0.3s ease;
}

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

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

.help-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.help-category {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.help-category:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.help-category h3 {
    color: #6366f1;
    font-size: 1.2rem;
    margin-bottom: 12px;
    font-weight: 600;
}

.help-category ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-category li {
    color: #555;
    line-height: 1.6;
    margin-bottom: 8px;
    padding-left: 16px;
    position: relative;
}

.help-category li::before {
    content: "•";
    color: #6366f1;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.help-category strong {
    color: #3b3b5c;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-section,
    .help-section {
        margin: 20px 16px 0 16px;
        padding: 24px 16px;
    }
    
    .calculator-container {
        padding: 16px;
    }
    
    .calculator-buttons {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 8px;
        width: 100%;
    }
    
    .calc-btn {
        padding: 12px 6px !important;
        font-size: 0.9rem !important;
        min-height: 45px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Réduction de la police pour les boutons de mode en mobile */
    .calc-btn.math-sci-btn .button-text {
        font-size: 0.6rem !important;
    }
    
    .calc-btn.angle-btn .button-text {
        font-size: 0.6rem !important;
    }
    
    .display-line {
        font-size: 1.1rem;
    }
    
    .display-line.result-line {
        font-size: 1.3rem;
    }
    
    .help-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .calculator-buttons {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 6px;
        width: 100%;
    }
    
    .calc-btn {
        padding: 10px 4px !important;
        font-size: 0.8rem !important;
        min-height: 40px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Réduction encore plus importante de la police pour les boutons de mode */
    .calc-btn.math-sci-btn .button-text {
        font-size: 0.5rem !important;
    }
    
    .calc-btn.angle-btn .button-text {
        font-size: 0.5rem !important;
    }
    
    .display-line {
        font-size: 1rem;
    }
    
    .display-line.result-line {
        font-size: 1.2rem;
    }
    
    .calculator-screen {
        padding: 16px;
        min-height: 180px; /* Augmentation de 20% : 150px * 1.2 = 180px */
    }
}

/* Pour les très petits écrans, utiliser 6 colonnes */
@media (max-width: 360px) {
    .calculator-buttons {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 4px;
        width: 100%;
    }
    
    .calc-btn {
        padding: 8px 2px !important;
        font-size: 0.7rem !important;
        min-height: 35px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Réduction maximale de la police pour les boutons de mode */
    .calc-btn.math-sci-btn .button-text {
        font-size: 0.4rem !important;
    }
    
    .calc-btn.angle-btn .button-text {
        font-size: 0.4rem !important;
    }
    
    .calculator-screen {
        padding: 12px;
        min-height: 100px;
    }
    
    .display-line {
        font-size: 0.9rem;
    }
    
    .display-line.result-line {
        font-size: 1.1rem;
    }
}

/* Animations */
@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.calc-btn.pressed {
    animation: buttonPress 0.1s ease;
}


/* Indicateurs de mode */
.mode-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f6ad55;
    color: #2d3748;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Styles pour les erreurs */
.error-display {
    color: #e53e3e;
    font-weight: 700;
    animation: errorBlink 0.5s ease-in-out;
}

@keyframes errorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Styles pour les résultats scientifiques */
.scientific-notation {
    font-size: 0.9rem;
    color: #68d391;
}

/* Styles pour les fonctions actives */
.function-active {
    background: #f6ad55 !important;
    color: #2d3748 !important;
    box-shadow: 0 0 8px rgba(246, 173, 85, 0.5);
}

/* Styles pour les boutons avec superscript */
.calc-btn sup {
    font-size: 0.7em;
    vertical-align: super;
    line-height: 0;
}

/* Styles pour les boutons de mode - Supprimés car redondants */

/* Styles pour le bouton Math/Sci fusionné - Spécificité élevée */
.calc-btn.math-sci-btn {
    background: #f6ad55 !important; /* Orange par défaut */
    color: #2d3748;
    font-weight: 700;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
}

.calc-btn.math-sci-btn:hover {
    background: #ed8936 !important;
    transform: translateY(-1px);
}

.calc-btn.math-sci-btn.math-active {
    background: #f6e05e !important; /* Jaune pour mode Math */
    color: #2d3748;
    box-shadow: 0 0 8px rgba(246, 224, 94, 0.5);
}

.calc-btn.math-sci-btn.sci-active {
    background: #68d391 !important; /* Vert pour mode Sci */
    color: #2d3748;
    box-shadow: 0 0 8px rgba(104, 211, 145, 0.5);
}

/* Styles pour le bouton Deg/Rad - Spécificité élevée */
.calc-btn.angle-btn {
    background: #68d391 !important; /* Vert par défaut */
    color: #2d3748;
    font-weight: 700;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
}

.calc-btn.angle-btn:hover {
    background: #48bb78 !important;
    transform: translateY(-1px);
}

.calc-btn.angle-btn.deg-active {
    background: #f6e05e !important; /* Jaune pour degrés */
    color: #2d3748;
    box-shadow: 0 0 8px rgba(246, 224, 94, 0.5);
}

.calc-btn.angle-btn.rad-active {
    background: #68d391 !important; /* Vert pour radians */
    color: #2d3748;
    box-shadow: 0 0 8px rgba(104, 211, 145, 0.5);
}

/* Styles pour les indicateurs de boutons */
.button-text {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.button-indicator {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.2);
    color: #2d3748;
    min-width: 30px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Indicateurs spécifiques pour Math/Sci - Spécificité élevée */
.calc-btn.math-sci-btn .button-indicator {
    background: rgba(0, 0, 0, 0.15);
}

.calc-btn.math-sci-btn.math-active .button-indicator {
    background: rgba(0, 0, 0, 0.25);
    color: #2d3748;
}

.calc-btn.math-sci-btn.sci-active .button-indicator {
    background: rgba(0, 0, 0, 0.25);
    color: #2d3748;
}

/* Indicateurs spécifiques pour Deg/Rad - Spécificité élevée */
.calc-btn.angle-btn .button-indicator {
    background: rgba(0, 0, 0, 0.15);
}

.calc-btn.angle-btn.deg-active .button-indicator {
    background: rgba(0, 0, 0, 0.25);
    color: #2d3748;
}

.calc-btn.angle-btn.rad-active .button-indicator {
    background: rgba(0, 0, 0, 0.25);
    color: #2d3748;
}
