:root {
    --positive-color: #198754;
    --negative-color: #dc3545;
}

body {
    background-color: #f5f7fa;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: 1.3rem;
}
.navbar-brand i { color: #ffc107; }
.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    margin: 0 2px;
    transition: background 0.2s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); }
.nav-link.active { background: rgba(255,255,255,0.15) !important; }

/* Page header */
.page-header { padding: 1.5rem 0 0.5rem; }
.page-header h2 { font-weight: 700; color: #1a1a2e; }

/* Cards */
.card-panel {
    background: white;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

/* Rate highlight cards */
.rate-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0,0,0,0.04);
    height: 100%;
}
.rate-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.rate-card .currency-code { font-size: 1.1rem; font-weight: 700; color: #1a1a2e; }
.rate-card .currency-name { font-size: 0.8rem; color: #6c757d; }
.rate-card .rate-value { font-size: 1.5rem; font-weight: 700; color: #16213e; margin: 0.5rem 0; }
.rate-card .rate-change { font-size: 0.85rem; font-weight: 600; }

.rate-positive { color: var(--positive-color); }
.rate-negative { color: var(--negative-color); }

/* Currency circle badges */
.flag-circle {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: 700; color: white; flex-shrink: 0;
}
.small-circle {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; color: white; flex-shrink: 0;
}

/* Table */
.rates-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}
.rates-table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #eee;
}
.table th {
    font-weight: 600; font-size: 0.8rem;
    text-transform: uppercase; letter-spacing: 0.5px; color: #6c757d;
    border-bottom: 2px solid #eee;
}
.table td { vertical-align: middle; padding: 0.85rem 1rem; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background-color: #f8f9ff; }

/* Search */
.search-wrapper { position: relative; }
.search-wrapper i {
    position: absolute; left: 0.85rem; top: 50%;
    transform: translateY(-50%); color: #adb5bd;
}
.search-input {
    border-radius: 8px; border: 1px solid #dee2e6;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}

/* Converter */
.converter-card {
    background: white; border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 2rem; max-width: 560px; margin: 2rem auto;
}
.converter-card h3 { font-weight: 700; color: #1a1a2e; margin-bottom: 1.5rem; }
.amount-input { font-size: 1.5rem; font-weight: 600; padding: 0.75rem 1rem; }

.swap-btn {
    width: 48px; height: 48px; border-radius: 50%;
    border: 2px solid #dee2e6; background: white;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto; cursor: pointer; transition: all 0.3s;
    color: #0d6efd; font-size: 1.2rem;
}
.swap-btn:hover {
    background: #0d6efd; color: white;
    border-color: #0d6efd; transform: rotate(180deg);
}

.result-box {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
    border-radius: 12px; padding: 1.5rem; margin-top: 1.5rem;
    border: 1px solid rgba(13,110,253,0.1);
}
.result-primary { font-size: 1.75rem; font-weight: 700; color: #1a1a2e; margin-bottom: 0.5rem; }
.result-secondary { font-size: 0.9rem; color: #6c757d; }

.quick-pair-btn {
    border-radius: 20px; padding: 0.4rem 1rem;
    font-weight: 500; font-size: 0.85rem;
    border: 1.5px solid #dee2e6; background: white; color: #495057;
    transition: all 0.2s; cursor: pointer;
}
.quick-pair-btn:hover {
    border-color: #0d6efd; color: #0d6efd; background: #f0f4ff;
}

.history-link {
    display: inline-flex; align-items: center; gap: 0.35rem;
    color: #0d6efd; text-decoration: none; font-weight: 500;
    font-size: 0.9rem; margin-top: 1rem; transition: color 0.2s;
}
.history-link:hover { color: #0a58ca; }

/* History page */
.chart-container { position: relative; height: 400px; }
.pair-display {
    font-size: 1.1rem; font-weight: 700; color: #1a1a2e;
    background: #f0f4ff; padding: 0.35rem 1rem; border-radius: 8px;
    display: inline-block;
}

.period-btn {
    border-radius: 8px; padding: 0.45rem 1rem;
    font-weight: 600; font-size: 0.85rem;
    border: 1.5px solid #dee2e6; background: white; color: #495057;
    transition: all 0.2s; cursor: pointer;
}
.period-btn:hover { border-color: #0d6efd; color: #0d6efd; }
.period-btn.active { background: #0d6efd; border-color: #0d6efd; color: white; }

.stat-card {
    background: white; border-radius: 12px; padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); text-align: center; height: 100%;
}
.stat-label {
    font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px; color: #6c757d;
    margin-bottom: 0.25rem;
}
.stat-value { font-size: 1.4rem; font-weight: 700; color: #1a1a2e; }
.stat-high { border-top: 3px solid #198754; }
.stat-low { border-top: 3px solid #dc3545; }
.stat-avg { border-top: 3px solid #0d6efd; }
.stat-change { border-top: 3px solid #ffc107; }

.data-table-header { padding: 1rem 1.5rem; cursor: pointer; transition: background 0.15s; }
.data-table-header:hover { background: #f8f9fa; }

/* Updated badge */
.updated-badge {
    font-size: 0.8rem; color: #6c757d;
    display: flex; align-items: center; gap: 0.35rem;
}

/* Loading state */
.loading { opacity: 0.5; pointer-events: none; }

/* Stale data banner */
.stale-banner {
    background: #fff3cd; border: 1px solid #ffc107;
    border-radius: 8px; padding: 0.75rem 1rem;
    font-size: 0.85rem; color: #856404; margin-bottom: 1rem;
}

/* Convert button in table */
.btn-convert {
    font-size: 0.8rem; padding: 0.3rem 0.75rem; border-radius: 6px;
}

/* Currency inline in table */
.currency-inline {
    display: flex; align-items: center; gap: 0.75rem;
}

/* Language Switcher */
.lang-switcher-btn {
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 8px !important;
    padding: 0.35rem 0.85rem !important;
    font-size: 0.85rem;
}
.lang-dropdown {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.08);
    min-width: 240px;
    padding: 0.5rem;
}
.lang-dropdown .dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.15s;
}
.lang-dropdown .dropdown-item:hover { background: #f0f4ff; }
.lang-dropdown .dropdown-item.active {
    background: #0d6efd;
    color: white;
}
.lang-dropdown .dropdown-item.active .lang-english { color: rgba(255,255,255,0.7); }
.lang-flag { font-size: 1.2rem; flex-shrink: 0; }
.lang-native { font-weight: 500; }
.lang-english {
    font-size: 0.75rem;
    color: #6c757d;
    margin-left: auto;
}

/* Footer */
.footer {
    padding: 2rem 0; text-align: center;
    color: #adb5bd; font-size: 0.85rem;
}

/* Form styles */
.form-control, .form-select {
    border-radius: 10px; padding: 0.65rem 1rem;
    border: 1.5px solid #dee2e6;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}

/* Responsive */
@media (max-width: 767.98px) {
    .page-header h2 { font-size: 1.3rem; }
    .rate-card .rate-value { font-size: 1.25rem; }
}

@media (max-width: 575.98px) {
    .converter-card { margin: 1rem 0.5rem; padding: 1.5rem; }
    .amount-input { font-size: 1.25rem; }
    .result-primary { font-size: 1.4rem; }
    .chart-container { height: 250px; }
    .stat-value { font-size: 1.1rem; }
    .period-btn { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
}
