/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Theme Variables */
:root {
    /* Light Theme (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #F8F9FA;
    --bg-accent: #0A2342;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-accent: #ff4800; /* light-red */
    --text-light: #ffffff;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    
    /* Couleurs principales HebergHub */
    --hub-blue: #0A2342;        /* Bleu principal */
    --hub-blue-rgb: 10, 35, 66;
    --hub-light-blue: #1D3557;  /* Bleu secondaire */
    --hub-light-blue-rgb: 29, 53, 87;
    --hub-orange: #ff4800;      /* Orange accent (light-red) */
    --hub-orange-rgb: 255, 72, 0;
    --hub-dark-red: #e03f00;    /* Rouge foncé */
    --hub-dark-red-rgb: 224, 63, 0;
    --hub-gray: #F8F9FA;        /* Gris clair */
    
    /* Couleurs principales (mapping vers les nouvelles couleurs) */
    --primary-color: var(--hub-blue);
    --primary-dark: var(--hub-light-blue);
    --primary-light: var(--hub-light-blue);
    --secondary-color: var(--hub-orange);
    --accent-color: var(--hub-orange);
    
    /* Couleurs neutres (mise à jour) */
    --background: var(--bg-primary);
    --background-light: var(--hub-gray);
    --background-dark: #f3f4f6;
    --border-light: var(--hub-gray);
    
    /* Couleurs d'état */
    --success-color: #10b981;
    --success-color-rgb: 16, 185, 129;
    --warning-color: var(--hub-orange);
    --warning-color-rgb: var(--hub-orange-rgb);
    --error-color: var(--hub-dark-red);
    --error-color-rgb: var(--hub-dark-red-rgb);
    --info-color: var(--hub-light-blue);
    --info-color-rgb: var(--hub-light-blue-rgb);
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Typographie */
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Espacements */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;
    
    /* Bordures */
    --border-radius-sm: 0.25rem;
    --border-radius-md: 0.375rem;
    --border-radius-lg: 0.5rem;
    --border-radius-xl: 0.75rem;
    --border-radius-2xl: 1rem;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a; /* slate-900 */
    --bg-secondary: #1e293b; /* slate-800 */
    --bg-accent: #334155; /* slate-700 */
    --text-primary: #f8fafc; /* slate-50 */
    --text-secondary: #cbd5e1; /* slate-300 */
    --text-accent: #ff4800; /* orange reste identique */
    --text-light: #ffffff;
    --border-color: #475569; /* slate-600 */
    --card-bg: #1e293b; /* slate-800 */
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    
    /* Mise à jour des variables de base pour le thème sombre */
    --background: var(--bg-primary);
    --background-light: var(--bg-secondary);
    --background-dark: var(--bg-accent);
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Transitions globales pour le changement de thème */
*, *::before, *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Amélioration des transitions pour les éléments interactifs */
.btn, .form-input, .theme-toggle {
    transition: all 0.3s ease;
}

/* Animation pour le changement de thème */
@keyframes themeTransition {
    0% { opacity: 0.8; }
    100% { opacity: 1; }
}

[data-theme] {
    animation: themeTransition 0.3s ease;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* Navigation */
.nav-link {
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #ff4800;
}

/* Theme Toggle Button */
.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    min-width: 60px;
    min-height: 30px;
    border-radius: 15px;
    background-color: var(--bg-secondary);
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

.theme-toggle::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--hub-orange);
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle::after {
    transform: translateX(28px);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    width: 16px;
    height: 16px;
    z-index: 1;
    color: var(--text-primary);
    transition: opacity 0.3s ease;
}

[data-theme="light"] .theme-toggle .moon-icon {
    opacity: 0.5;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0.5;
}

[data-theme="light"] .theme-toggle .sun-icon {
    opacity: 1;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
}

/* Theme-specific overrides */
[data-theme="dark"] .bg-white {
    background-color: var(--card-bg) !important;
}

[data-theme="dark"] .bg-hub-gray {
    background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] .bg-gray-50 {
    background-color: var(--bg-secondary) !important;
}

/* Textes */
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-gray-700 {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-gray-900 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-hub-blue {
    color: var(--text-primary) !important;
}

/* Bordures et ombres */
[data-theme="dark"] .border-gray-200 {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .shadow-lg,
[data-theme="dark"] .shadow-md,
[data-theme="dark"] .shadow-sm,
[data-theme="dark"] .shadow-xl {
    box-shadow: var(--card-shadow) !important;
}

/* Navigation en mode sombre */
[data-theme="dark"] .bg-hub-blue {
    background-color: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-color);
}

/* Footer en mode sombre */
[data-theme="dark"] .footer {
    background-color: var(--bg-accent) !important;
}

/* Form inputs */
[data-theme="dark"] .form-input {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .form-input:focus {
    border-color: var(--hub-orange) !important;
    box-shadow: 0 0 0 3px rgba(255, 72, 0, 0.1) !important;
}

[data-theme="dark"] .form-input::placeholder {
    color: var(--text-secondary) !important;
    opacity: 0.7;
}

/* Tabs */
.tab-btn {
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.tab-btn.active {
    background-color: var(--hub-orange);
    color: white;
    font-weight: 500;
}

[data-theme="dark"] .tab-btn {
    color: var(--text-primary);
}

[data-theme="dark"] .tab-btn.active {
    background-color: var(--hub-orange);
    color: white;
}

/* Detailed mode */
.border-b {
    border-bottom-width: 1px;
}

[data-theme="dark"] .border-gray-100 {
    border-color: var(--border-color) !important;
}

/* Expense categories */
#detailed-mode h4 {
    font-weight: 600;
}

#detailed-mode .form-input {
    height: 40px;
    font-size: 0.95rem;
}

/* Results */
#detailed-result-income,
#detailed-result-expenses,
#detailed-result-remaining {
    transition: color 0.3s ease;
}

/* Advice text */
#detailed-advice-text {
    white-space: pre-line;
}

/* Form inputs */
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
    outline: none;
    border-color: var(--hub-orange);
    box-shadow: 0 0 0 3px rgba(255, 72, 0, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-base);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: var(--spacing-sm);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
}

.btn-large {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-lg);
}

.btn-hero-secondary {
    background-color: transparent;
    color: white;
    border: 2px solid white;
    font-weight: 600;
}

.btn-hero-secondary:hover {
    background-color: white;
    color: var(--hub-blue);
    border-color: white;
    transform: translateY(-2px);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--hub-blue) 0%, var(--hub-light-blue) 100%);
    color: white;
    padding: 5rem 0 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.badge-icon {
    font-size: 1.1rem;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.text-gradient {
    background: linear-gradient(45deg, var(--hub-orange), #ffa500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    margin-bottom: 2.5rem;
    opacity: 0.9;
    line-height: 1.6;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.btn-hero-primary {
    background: var(--hub-orange);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(255, 72, 0, 0.3);
}

.btn-hero-primary:hover {
    background: var(--hub-dark-red);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 72, 0, 0.4);
}

.btn-hero-secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-hero-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.2rem;
}

/* Hero Sections */
.hero-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.hero-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-xl);
    padding: 1.5rem;
    transition: all 0.3s ease;
    text-align: left;
}

.hero-section:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.section-icon {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.hero-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.hero-section p {
    margin-bottom: 1rem;
    opacity: 0.9;
    font-size: 0.95rem;
}

.section-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.tag {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Trust Indicators */
.hero-trust-indicators {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.trust-icon {
    font-size: 1.1rem;
}

/* Formulaire */
.form-input {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
    border-color: var(--hub-orange);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(255, 72, 0, 0.1);
}

.form-input::placeholder {
    color: #a0aec0;
    opacity: 1;
}

/* Résultat du calcul */
.result-card {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.result-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--hub-orange);
    margin-bottom: 0.5rem;
}

.result-label {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.detail-item {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--border-radius-lg);
}

.detail-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background-color: var(--hub-blue);
    color: white;
    padding: 4rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.footer-description {
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.footer-heading {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.footer-links {
    list-style: none;
}

.footer-link {
    margin-bottom: 0.75rem;
}

.footer-link a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link a:hover {
    color: var(--hub-orange);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 3rem;
    padding-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 4rem 0 3rem;
    }
    
    .hero-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-cta {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-hero-primary, .btn-hero-secondary {
        width: 100%;
        max-width: 300px;
    }
    
    .hero-sections {
        grid-template-columns: 1fr;
    }
    
    .hero-trust-indicators {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Conseils section */
.tips-section {
    padding: 4rem 0;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.tip-card {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s ease;
}

.tip-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.tip-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.tip-content {
    padding: 1.5rem;
}

.tip-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.tip-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.tip-link {
    display: inline-flex;
    align-items: center;
    color: var(--hub-orange);
    font-weight: 500;
    text-decoration: none;
    gap: 0.25rem;
    transition: all 0.2s ease;
}

.tip-link:hover {
    gap: 0.5rem;
}