:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #ffffff;
    --surface-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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: 8px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #94a3b8;
    --background-color: #0f172a;
    --surface-color: #1e293b;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.logo i {
    font-size: 28px;
}

.logo span {
    color: var(--text-primary);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.theme-toggle:hover {
    background-color: var(--surface-color);
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 60px 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Content */
.main-content {
    padding: 40px 0;
}

.converter-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .converter-container {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.converter-card,
.rates-card,
.chart-card,
.history-card,
.content-card,
.feature-card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.converter-card {
    padding: 0;
}

.converter-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.converter-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.last-updated {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.converter-body {
    padding: 30px;
}

/* Currency Input */
.currency-input-group {
    margin-bottom: 20px;
}

.currency-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-with-select {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background-color: var(--surface-color);
}

.input-with-select input {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
}

.input-with-select input:focus {
    outline: none;
}

.currency-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 15px;
    background-color: var(--card-bg);
    border-left: 1px solid var(--border-color);
}

.flag-container {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
}

.flag-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.currency-selector select {
    border: none;
    background: none;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 100px;
}

.currency-selector select:focus {
    outline: none;
}

/* Swap Button */
.swap-container {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.swap-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.swap-btn:hover {
    background-color: var(--primary-dark);
    transform: rotate(180deg);
}

/* Conversion Details */
.conversion-details {
    text-align: center;
    margin: 25px 0;
    padding: 20px;
    background-color: var(--surface-color);
    border-radius: var(--radius);
}

.exchange-rate {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.conversion-time {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 14px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--surface-color);
}

.btn-sm {
    padding: 8px 15px;
    font-size: 13px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Rates Card */
.rates-card {
    padding: 25px;
}

.rates-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.rates-table {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.rate-item:last-child {
    border-bottom: none;
}

.rate-currency {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.rate-value {
    font-weight: 600;
    color: var(--primary-color);
}

.rate-change {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.rate-change.positive {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.rate-change.negative {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* Chart Section */
.chart-section {
    margin-bottom: 40px;
}

.chart-card {
    padding: 25px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.chart-controls select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--card-bg);
    color: var(--text-primary);
}

.chart-container {
    height: 300px;
    position: relative;
}

/* History Section */
.history-section {
    margin-bottom: 40px;
}

.history-card {
    padding: 25px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--surface-color);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.history-details {
    display: flex;
    align-items: center;
    gap: 15px;
}

.history-amount {
    font-weight: 600;
    color: var(--text-primary);
}

.history-currencies {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.history-rate {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.history-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Content Sections */
.content-section {
    padding: 60px 0;
    background-color: var(--surface-color);
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

.content-card {
    padding: 30px;
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.content-card h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.content-card p {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.content-card ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

.content-card li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Features Section */
.features-section {
    padding: 60px 0;
    background-color: var(--background-color);
}

.features-section h2 {
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.feature-card {
    padding: 30px;
    text-align: center;
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 28px;
}

.feature-card h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Currencies Section */
.currencies-section {
    padding: 60px 0;
    background-color: var(--surface-color);
}

.currencies-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.currencies-section p {
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-secondary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.currencies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.currency-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background-color: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.currency-badge:hover {
    border-color: var(--primary-color);
}

.currency-badge .flag {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    overflow: hidden;
}

.currency-badge .flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.currency-code {
    font-weight: 600;
    color: var(--text-primary);
}

.currency-name {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* FAQ Section */
.faq-section {
    padding: 60px 0;
    background-color: var(--background-color);
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-primary);
}

.faq-grid {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 15px;
    overflow: hidden;
    background-color: var(--card-bg);
}

.faq-question {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background-color: var(--surface-color);
}

.faq-question h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}

.faq-question i {
    color: var(--text-muted);
    transition: var(--transition);
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: var(--transition);
}

.faq-item.active .faq-answer {
    padding: 0 20px 20px;
    max-height: 500px;
}

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
.footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: var(--primary-color);
}

.footer-section p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--surface-color);
    border-radius: 50%;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
    color: white;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    color: var(--text-muted);
    margin-bottom: 10px;
}

.footer-bottom a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-bottom a:hover {
    color: var(--primary-color);
}

.disclaimer {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .converter-body {
        padding: 20px;
    }
    
    .input-with-select {
        flex-direction: column;
    }
    
    .currency-selector {
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding: 10px 15px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    background-color: var(--success-color);
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* Add these to your existing CSS */

/* Loading States */
.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Currency badges grid responsiveness */
@media (max-width: 768px) {
    .currencies-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Better rate display for small values */
.rate-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Historical chart empty state */
.chart-container {
    position: relative;
}

.chart-container .no-data {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}

/* Enhanced currency dropdowns */
.currency-selector select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px auto;
    border: none;
    padding-right: 30px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

[data-theme="dark"] .currency-selector select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
}

/* Input focus states */
.input-with-select:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* Rate change indicators */
.rate-change {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.rate-change.positive {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.rate-change.negative {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* Auto-refresh indicator */
.last-updated {
    display: flex;
    align-items: center;
    gap: 5px;
}

.refresh-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Add to your existing CSS */

.currency-count {
    font-size: 0.8em;
    color: var(--text-muted);
    font-weight: normal;
}

.currency-count-info {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.currency-badge.unavailable {
    opacity: 0.6;
    position: relative;
}

.currency-badge.unavailable::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius);
}

.converter-header .currency-count {
    font-size: 0.7em;
    margin-left: 5px;
    color: var(--text-muted);
}

/* Enhanced unavailable state */
.currency-badge.unavailable .currency-code::after {
    content: ' (Rate unavailable)';
    font-size: 0.7em;
    color: var(--danger-color);
    margin-left: 5px;
}