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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a2980, #26d0ce);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

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

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

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 15px;
}

.api-status {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 0.9rem;
    margin-top: 10px;
}

#api-status-indicator {
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 500;
}

.status-online {
    background-color: rgba(46, 204, 113, 0.9);
    color: white;
}

.status-offline {
    background-color: rgba(231, 76, 60, 0.9);
    color: white;
}

#last-updated {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
}

/* Main Content */
main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 900px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.converter-card, .chart-card, .history-card {
    background-color: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.converter-card h2, .chart-card h2, .history-card h2 {
    color: #1a2980;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
}

/* Converter Form */
.converter-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
}

.input-group label, .currency-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #444;
}

.amount-input {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#amount {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 500;
    transition: border-color 0.3s;
}

#amount:focus {
    border-color: #26d0ce;
    outline: none;
}

.quick-amounts {
    display: flex;
    gap: 10px;
}

.quick-btn {
    padding: 8px 15px;
    background-color: #f1f8ff;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.quick-btn:hover {
    background-color: #e1f0ff;
    border-color: #26d0ce;
}

.currency-selectors {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 15px;
}

.select-wrapper {
    position: relative;
}

select {
    width: 100%;
    padding: 15px 40px 15px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    background-color: white;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.3s;
}

select:focus {
    border-color: #26d0ce;
    outline: none;
}

.select-wrapper i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.swap-currencies {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding-bottom: 8px;
}

#swap-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #1a2980;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#swap-btn:hover {
    background-color: #26d0ce;
    transform: rotate(180deg);
}

.rate-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
}

.rate-info p {
    font-weight: 500;
}

#current-rate {
    color: #1a2980;
    font-weight: 600;
}

.refresh-btn {
    padding: 8px 15px;
    background-color: #1a2980;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn:hover {
    background-color: #26d0ce;
}

.convert-btn {
    padding: 18px;
    background: linear-gradient(to right, #1a2980, #26d0ce);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.convert-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 15px rgba(0, 0, 0, 0.1);
}

/* Result Section */
.result-section {
    border-top: 2px solid #f0f0f0;
    padding-top: 25px;
}

.result-section h3 {
    color: #444;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.result-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, #f8f9ff, #e6f9ff);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 15px;
}

.from-result, .to-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.from-result span:first-child, .to-result span:first-child {
    font-size: 2.2rem;
    font-weight: 700;
    color: #1a2980;
}

.from-result span:last-child, .to-result span:last-child {
    font-size: 1.2rem;
    color: #666;
    font-weight: 500;
}

.result-box i {
    font-size: 1.8rem;
    color: #26d0ce;
}

.conversion-date {
    text-align: center;
    color: #777;
    font-size: 0.9rem;
}

/* Chart */
.chart-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

#chart-period {
    width: auto;
    padding: 10px 40px 10px 15px;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-info {
    text-align: center;
    color: #777;
    font-size: 0.9rem;
    margin-top: 15px;
}

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

.clear-btn {
    padding: 10px 20px;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-btn:hover {
    background-color: #ff5252;
}

.history-container {
    overflow-x: auto;
}

#history-table {
    width: 100%;
    border-collapse: collapse;
}

#history-table thead {
    background-color: #f1f8ff;
}

#history-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #1a2980;
    border-bottom: 2px solid #ddd;
}

#history-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

#history-table tr:hover {
    background-color: #f9f9f9;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #888;
    font-style: italic;
}

/* Footer */
footer {
    margin-top: 30px;
    color: white;
    text-align: center;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: center;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

.disclaimer {
    font-size: 0.9rem;
    opacity: 0.9;
}

.api-info {
    font-size: 0.9rem;
}

#api-key-status {
    font-weight: 600;
    color: #26d0ce;
}

.footer-note {
    margin-top: 10px;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .dashboard {
        gap: 20px;
    }
    
    .converter-card, .chart-card, .history-card {
        padding: 20px;
    }
    
    .currency-selectors {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 20px;
    }
    
    .swap-currencies {
        order: 2;
        padding-bottom: 0;
    }
    
    .currency-selector:first-child {
        order: 1;
    }
    
    .currency-selector:last-child {
        order: 3;
    }
    
    .rate-info {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .result-box {
        flex-direction: column;
        gap: 20px;
    }
    
    .from-result, .to-result {
        align-items: center;
    }
    
    .result-box i {
        transform: rotate(90deg);
    }
    
    .history-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .clear-btn {
        align-self: flex-start;
    }
}
