/* styles.css - Version complète avec support dark mode */

:root {
    /* Mode clair (par défaut) */
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --accent-color: #4cc9f0;
    --success-color: #4ade80;
    --danger-color: #f87171;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f3f4f6;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 0.5rem;
    --radius-lg: 1rem;
    --transition: all 0.3s ease;
    
    /* Nouvelles variables pour dark mode */
    --border-color: #e5e7eb;
    --hover-bg: #f3f4f6;
    --card-bg: #ffffff;
    --body-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* MODE SOMBRE */
[data-theme="dark"] {
    --primary-color: #6366f1;
    --secondary-color: #4338ca;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-dark: #f9fafb;
    --text-light: #d1d5db;
    --bg-light: #374151;
    --bg-white: #1f2937;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    
    --border-color: #4b5563;
    --hover-bg: #4b5563;
    --card-bg: #1f2937;
    --body-bg: linear-gradient(135deg, #111827 0%, #1f2937 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    background: var(--body-bg);
    height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-dark);
    width: 100%;
    overflow: hidden;
}

/* BOUTONS FLOTTANTS */
.floating-home-btn {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4361ee;
    text-decoration: none;
    font-size: 1.2rem;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(67, 97, 238, 0.1);
}

.floating-home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.15);
    background: #4361ee;
    color: white;
    border-color: #4361ee;
}

.floating-home-btn:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

.floating-home-btn i {
    transition: all 0.2s ease;
}

/* BOUTON DARK MODE */
.dark-mode-toggle {
    position: fixed;
    top: 24px;
    left: 84px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4361ee;
    text-decoration: none;
    font-size: 1.2rem;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(67, 97, 238, 0.1);
    cursor: pointer;
}

.dark-mode-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.15);
    background: #4361ee;
    color: white;
    border-color: #4361ee;
}

.dark-mode-toggle:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

.dark-mode-toggle i {
    transition: all 0.3s ease;
}

.dark-mode-toggle.rotating i {
    transform: rotate(180deg);
}

/* Boutons en mode sombre */
[data-theme="dark"] .floating-home-btn,
[data-theme="dark"] .dark-mode-toggle {
    background: rgba(31, 41, 55, 0.95);
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .floating-home-btn:hover,
[data-theme="dark"] .dark-mode-toggle:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .floating-home-btn {
        top: 20px;
        left: 20px;
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    
    .dark-mode-toggle {
        top: 20px;
        left: 76px;
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
}

/* Structure principale */
.calculator-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    min-height: 0;
}

@media (min-width: 768px) {
    .calculator-container {
        grid-template-columns: 1fr 300px;
    }
}

/* Cartes de contenu */
.calculator-card, .api-info-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    transition: var(--transition);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
    border: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .calculator-card, .api-info-card {
        padding: 1.5rem;
    }
}

.calculator-card:hover, .api-info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* En-tête et titres */
.calculator-header {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.calculator-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.tagline {
    color: var(--text-light);
    font-style: italic;
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

/* Navigation par onglets */
.tab-navigation {
    display: flex;
    justify-content: center;
    margin: 1rem auto;
    background-color: var(--bg-light);
    border-radius: 8px;
    padding: 4px;
    max-width: 350px;
    border: 1px solid var(--border-color);
}

.tab-button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
    justify-content: center;
}

.tab-button.active {
    background-color: var(--primary-color);
    color: white;
}

.tab-button:hover:not(.active) {
    background-color: var(--hover-bg);
}

/* Formulaires et entrées */
.input-row {
    margin-bottom: 12px;
}

.input-row label {
    display: block;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.input-row input, .input-row select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: var(--card-bg);
    color: var(--text-dark);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.input-row input:focus, .input-row select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.1);
}

.input-row input:hover, .input-row select:hover {
    border-color: var(--accent-color);
}

/* Boutons d'opération */
.operation-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
}

.op-button {
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-light);
    border-radius: 6px;
    font-size: 1.1rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-dark);
}

.op-button.active {
    background-color: var(--primary-color);
    color: white;
}

.op-button:hover:not(.active) {
    background-color: var(--hover-bg);
}

/* Boutons principaux */
.calculate-btn, .plot-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.calculate-btn:hover, .plot-btn:hover {
    background-color: #22c55e;
}

/* Affichage des résultats */
.result-container {
    background-color: var(--bg-light);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    margin: 15px 0;
    border: 1px solid var(--border-color);
}

.result-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.result-value:hover {
    transform: scale(1.02);
    color: var(--accent-color);
}

.operation-text {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

/* Historique */
.history-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex: 1;
    min-height: 0;
}

.history-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.history-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--card-bg);
}

.history-item {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: var(--text-dark);
}

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

.history-item:hover:not(.empty-message) {
    background-color: var(--hover-bg);
}

/* Informations sur l'API */
.api-info-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.api-info-card p {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.api-status {
    margin: 1rem 0;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #9ca3af;
}

.status-dot.online {
    background-color: var(--success-color);
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}

.status-dot.offline {
    background-color: var(--danger-color);
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.2);
}

.api-url {
    color: var(--primary-color);
    font-family: monospace;
    font-size: 0.8rem;
    padding: 0.5rem;
    background-color: var(--bg-light);
    border-radius: var(--radius);
    word-break: break-all;
    border: 1px solid var(--border-color);
}

.api-routes, .keyboard-shortcuts {
    margin-top: 1rem;
}

.route-title {
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.api-routes ul, .keyboard-shortcuts ul {
    list-style: none;
}

.api-routes li, .keyboard-shortcuts li {
    margin-bottom: 0.25rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--primary-color);
    font-size: 0.8rem;
    color: var(--text-dark);
}

.api-routes code, .keyboard-shortcuts code {
    font-family: monospace;
    background-color: var(--bg-light);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

/* Pied de page */
footer {
    text-align: center;
    color: var(--text-light);
    padding: 0.5rem;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    font-weight: 500;
    max-width: 250px;
    animation: slideInRight 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.notification.success {
    background: var(--success-color);
    color: white;
}

.notification.error {
    background: var(--danger-color);
    color: white;
}

[data-theme="dark"] .notification {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Animations */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background-color: var(--success-color); color: white; }
    100% { transform: scale(1); }
}

.result-value.updated {
    animation: pulse 0.5s ease-out;
}

/* Ajustements pour mobile */
@media (max-width: 768px) {
    .calculator-container {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .calculator-card, .api-info-card {
        padding: 0.75rem;
    }
    
    .tab-navigation {
        max-width: 100%;
        flex-wrap: wrap;
    }
    
    .tab-button {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

/* États de focus améliorés pour le mode sombre */
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Scrollbars pour le mode sombre */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    background-color: var(--bg-light);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-light);
}