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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Converter */
.converter-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.input-side, .output-side {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    min-width: 300px;
    flex: 1;
    max-width: 400px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

input[type="number"], select {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

input[type="number"]:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e1e5e9;
}

.unit-btn {
    padding: 12px 16px;
    border: none;
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.unit-btn.active {
    background: #667eea;
    color: white;
}

.unit-btn:hover:not(.active) {
    background: #f8f9fa;
}

/* Direction Toggle */
.direction-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn {
    width: 60px;
    height: 60px;
    border: none;
    background: white;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.swap-btn:hover {
    transform: rotate(180deg);
    background: #667eea;
    color: white;
}

/* Result Display */
.result-container {
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-display {
    text-align: center;
    width: 100%;
}

.quantity-result {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 20px;
    word-break: break-word;
}

.price-breakdown {
    border-top: 1px solid #e1e5e9;
    padding-top: 15px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.price-row span:first-child {
    color: #666;
}

.price-row span:last-child {
    font-weight: 600;
}

/* Historical Section */
.historical-section {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.historical-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.historical-header h3 {
    color: #333;
    font-size: 1.5rem;
}

.date-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.date-controls label {
    font-weight: 600;
    color: #555;
}

.date-controls input[type="date"] {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
}

.chart-container {
    height: 400px;
    margin-top: 20px;
}

/* Controls */
.controls {
    text-align: center;
    margin-bottom: 40px;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e1e5e9;
}

.btn-secondary:hover {
    background: #e9ecef;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Messages */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.toast.error {
    background: #dc3545;
}

.toast.success {
    background: #28a745;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Footer */
footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .converter-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .input-side, .output-side {
        min-width: auto;
        max-width: none;
    }
    
    .direction-toggle {
        order: -1;
    }
    
    .swap-btn {
        transform: rotate(90deg);
    }
    
    .swap-btn:hover {
        transform: rotate(270deg);
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .historical-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-controls {
        justify-content: center;
    }
    
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .input-side, .output-side {
        padding: 20px;
    }
    
    .date-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .quantity-result {
        font-size: 1.5rem;
    }
} 