/* ============================================
   Currency Converter - CSS Styling
   ============================================ */

/* Root Variables for Easy Customization */
:root {
    --primary-color: #007bff;
    --secondary-color: #0056b3;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --text-dark: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Dark Mode */
body.dark-mode {
    --light-bg: #1e1e1e;
    --text-dark: #f0f0f0;
    --text-muted: #b0b0b0;
    --border-color: #444;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.4);
}

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

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: var(--text-dark);
    transition: background 0.3s ease;
}

body.dark-mode {
    background: linear-gradient(135deg, #0b1220 0%, #0e1a2b 50%, #101a30 100%);
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: var(--secondary-color);
}

body.dark-mode .theme-toggle {
    background: #ffc107;
    color: #000;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    animation: slideDown 0.5s ease;
}

.header h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header p {
    font-size: 16px;
    opacity: 0.9;
}

/* Converter Section */
.converter-section {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    animation: slideUp 0.5s ease;
}

.converter-box {
    background: var(--light-bg);
    border-radius: 15px;
    padding: 40px;
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
}

input[type="number"],
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    color: var(--text-dark);
    background: var(--light-bg);
    transition: all 0.3s ease;
    font-family: inherit;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

input[type="number"]::placeholder {
    color: var(--text-muted);
}

.currency-symbol {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-weight: 600;
}

/* Swap Button */
.swap-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 20px;
    cursor: pointer;
    margin: 15px auto;
    display: block;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.swap-btn:hover {
    background: var(--secondary-color);
    transform: rotate(180deg) scale(1.1);
}

/* Convert Button */
.convert-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: var(--shadow);
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.convert-btn:active {
    transform: translateY(0);
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 4px solid var(--error-color);
    animation: slideDown 0.3s ease;
}

body.dark-mode .error-message {
    background: #5a2c2c;
    color: #f8b4b4;
}

/* Result Section */
.result-section {
    margin-top: 30px;
    animation: slideUp 0.3s ease;
}

.result-box {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 25px;
    border-radius: 12px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-item .label {
    font-size: 12px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.result-item .value {
    font-size: 24px;
    font-weight: 700;
}

.arrow {
    font-size: 28px;
    opacity: 0.8;
}

/* Rate Info */
.rate-info {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.rate-info p {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.source-info {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 8px;
}

.source-info.live {
    color: var(--success-color);
}

.source-info.cached {
    color: var(--warning-color);
}

/* Tabs */
.tabs-container {
    background: var(--light-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s ease;
}

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background: var(--light-bg);
}

.tab-btn {
    flex: 1;
    padding: 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-btn:hover {
    color: var(--text-dark);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: -2px;
}

.tab-content {
    padding: 30px;
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* History Styles */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-header h3 {
    color: var(--text-dark);
    font-size: 18px;
}

.clear-history-btn {
    padding: 8px 16px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    opacity: 0.8;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

body.dark-mode .history-item {
    background: #2a2a2a;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.history-conversion {
    display: flex;
    gap: 10px;
    align-items: center;
}

.history-arrow {
    color: var(--primary-color);
    font-weight: bold;
}

.history-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

.empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

/* Info Styles */
.info-content h3 {
    color: var(--text-dark);
    font-size: 22px;
    margin-bottom: 20px;
}

.info-section {
    margin-bottom: 25px;
}

.info-section h4 {
    color: var(--primary-color);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.info-section ul,
.info-section ol {
    margin-left: 20px;
    color: var(--text-dark);
    line-height: 1.8;
}

.info-section li {
    margin-bottom: 8px;
}

.info-section p {
    color: var(--text-dark);
    line-height: 1.6;
}

.currencies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.currency-badge {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-dark);
    text-align: center;
}

body.dark-mode .currency-badge {
    background: #2a2a2a;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Scrollbar Styling */
.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--light-bg);
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Footer */
.site-footer {
    margin: 40px auto 20px;
    padding: 20px;
    text-align: center;
    color: #f4f6ff;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

body.dark-mode .site-footer {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.28));
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e8ecff;
}

.footer-text {
    font-weight: 600;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
    color: #f8f9ff;
}

.footer-links {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #dfe6ff;
    font-size: 14px;
}

.footer-links a {
    color: #f5f8ff;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
    border-bottom: 1px solid transparent;
}

.footer-links a:hover {
    color: #ffe28a;
    border-color: #ffe28a;
}

.footer-separator {
    color: rgba(255, 255, 255, 0.6);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 36px;
    }

    .converter-box {
        padding: 25px;
    }

    .result-box {
        flex-direction: column;
        gap: 15px;
    }

    .arrow {
        transform: rotate(90deg);
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        border-bottom: none;
        border-right: 2px solid var(--border-color);
        padding: 12px;
        font-size: 12px;
    }

    .tab-btn.active {
        border-bottom: none;
        border-right: 3px solid var(--primary-color);
    }

    .currencies-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 28px;
    }

    .header p {
        font-size: 14px;
    }

    .converter-box {
        padding: 20px;
    }

    .form-group label {
        font-size: 12px;
    }

    input[type="number"],
    select {
        padding: 10px 12px;
        font-size: 14px;
    }

    .convert-btn {
        padding: 12px;
        font-size: 14px;
    }

    .result-item .value {
        font-size: 18px;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .theme-toggle,
    .tab-content:not(.active) {
        display: none;
    }

    .converter-box,
    .tabs-container {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}
