/**
 * convertisseur.tn - Stylesheet
 * Design moderne bancaire - Bleu BCT / Blanc / Vert
 */

:root {
    /* Couleurs BCT */
    --bct-blue: #003366;
    --bct-blue-light: #004080;
    --bct-blue-dark: #002244;
    --bct-green: #00A651;
    --bct-green-light: #00C853;
    
    /* Couleurs fonctionnelles */
    --gold: #D4AF37;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    
    /* Typographie */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Sans', monospace;
    
    /* Espacement */
    --section-padding: 4rem;
    --card-radius: 16px;
    --btn-radius: 8px;
}

/* Dark Mode Variables */
[data-bs-theme="dark"] {
    --bct-blue: #1a5490;
    --bct-blue-light: #2a6490;
    --bg-card: #1e1e1e;
    --text-muted: #a0a0a0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

[data-bs-theme="dark"] body {
    background-color: #121212;
    color: #e0e0e0;
}

/* Navigation */
.navbar {
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.bg-bct {
    background: linear-gradient(135deg, var(--bct-blue) 0%, var(--bct-blue-light) 100%) !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.brand-name {
    color: white;
    font-weight: 300;
}

.brand-tld {
    color: var(--bct-green);
    font-weight: 700;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.currency-icon {
    color: var(--bct-blue);
    font-weight: 700;
    font-size: 0.9rem;
}

.nav-link {
    font-weight: 500;
    position: relative;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--bct-green);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

/* Ticker des taux */
.rates-ticker {
    font-size: 0.85rem;
    white-space: nowrap;
}

.ticker-wrapper {
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.ticker-content {
    animation: ticker 30s linear infinite;
}

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.ticker-item .flag {
    font-size: 1.1rem;
}

.ticker-item .rate-value {
    color: var(--bct-blue);
    font-weight: 600;
}

[data-bs-theme="dark"] .ticker-item .rate-value {
    color: var(--bct-green-light);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--bct-blue) 0%, var(--bct-blue-dark) 100%);
    color: white;
    padding: 3rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
}

/* Convertisseur Card */
.converter-card {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    padding: 2rem;
    position: relative;
    z-index: 10;
    border: none;
}

[data-bs-theme="dark"] .converter-card {
    background: #1e1e1e;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.converter-title {
    color: var(--bct-blue);
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[data-bs-theme="dark"] .converter-title {
    color: var(--bct-green-light);
}

/* Input Groups */
.input-group-converter {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group-converter label {
    display: block;
    font-weight: 600;
    color: var(--bct-blue);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control-lg {
    border: 2px solid #e9ecef;
    border-radius: var(--btn-radius);
    padding: 1rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.form-control-lg:focus {
    border-color: var(--bct-blue);
    box-shadow: 0 0 0 0.25rem rgba(0, 51, 102, 0.25);
}

.currency-select {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-left: none;
    font-weight: 600;
    color: var(--bct-blue);
    cursor: pointer;
}

/* Swap Button */
.swap-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bct-green);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 166, 81, 0.4);
    position: relative;
    z-index: 5;
}

.swap-btn:hover {
    transform: rotate(180deg) scale(1.1);
    background: var(--bct-green-light);
    box-shadow: 0 6px 20px rgba(0, 166, 81, 0.6);
}

/* Result Display */
.result-display {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--btn-radius);
    padding: 1.5rem;
    text-align: center;
    margin-top: 1.5rem;
    border-left: 4px solid var(--bct-green);
}

[data-bs-theme="dark"] .result-display {
    background: linear-gradient(135deg, #2d2d2d 0%, #1e1e1e 100%);
    border-left-color: var(--bct-green);
}

.result-label {
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bct-blue);
    font-family: var(--font-mono);
    word-break: break-all;
}

[data-bs-theme="dark"] .result-value {
    color: var(--bct-green-light);
}

.result-rate {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* Boutons d'action */
.btn-bct {
    background: linear-gradient(135deg, var(--bct-green) 0%, var(--bct-green-light) 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--btn-radius);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 166, 81, 0.3);
}

.btn-bct:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 166, 81, 0.4);
    color: white;
}

.btn-outline-bct {
    border: 2px solid var(--bct-blue);
    color: var(--bct-blue);
    font-weight: 600;
    background: transparent;
}

.btn-outline-bct:hover {
    background: var(--bct-blue);
    color: white;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Table des taux */
.rates-table {
    background: white;
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

[data-bs-theme="dark"] .rates-table {
    background: #1e1e1e;
}

.rates-table thead {
    background: var(--bct-blue);
    color: white;
}

.rates-table th {
    font-weight: 600;
    padding: 1rem;
    border: none;
}

.rates-table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
}

[data-bs-theme="dark"] .rates-table td {
    border-bottom-color: #333;
    color: #e0e0e0;
}

.currency-flag {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

.currency-name {
    font-weight: 600;
    color: var(--bct-blue);
}

[data-bs-theme="dark"] .currency-name {
    color: var(--bct-green-light);
}

.rate-change {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.rate-up {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.rate-down {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

/* Cards */
.info-card {
    background: white;
    border-radius: var(--card-radius);
    padding: 1.5rem;
    height: 100%;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .info-card {
    background: #1e1e1e;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.info-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--bct-blue) 0%, var(--bct-blue-light) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: white;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%) !important;
    margin-top: auto;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.hover-white:hover {
    color: white !important;
    padding-left: 0.25rem;
    transition: all 0.3s ease;
}

.text-bct {
    color: var(--bct-green) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .converter-card {
        padding: 1.5rem;
        margin: 0 -0.75rem;
        border-radius: 0;
    }
    
    .result-value {
        font-size: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .navbar, .footer, .rates-ticker, .action-buttons, .theme-toggle {
        display: none !important;
    }
    
    .converter-card {
        box-shadow: none;
        border: 2px solid #333;
    }
    
    body {
        background: white;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
}

.toast {
    background: white;
    border-left: 4px solid var(--bct-green);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* Loading spinner */
.spinner-bct {
    color: var(--bct-blue);
}

/* Accessibility */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible */
*:focus-visible {
    outline: 3px solid var(--bct-green);
    outline-offset: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--bct-blue);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bct-blue-light);
}