/* Calculator Styles */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #4facfe;
    --text-color: #333;
    --bg-color: #f8fafc;
    --white: #ffffff;
    --light-gray: #f1f5f9;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    color: var(--text-color);
}

/* Header and Navigation */
header {
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.breadcrumb {
    color: white;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.breadcrumb a:hover {
    opacity: 1;
}

.breadcrumb span {
    margin: 0 0.5rem;
    opacity: 0.6;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

/* Tab Navigation */
.tab-container {
    grid-column: 1 / -1;
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.tab-btn:hover {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    background: var(--white);
    color: var(--text-color);
    opacity: 1;
    box-shadow: var(--shadow);
}

/* Tab Content */
.tab-content {
    display: none;
    grid-column: 1;
}

.tab-content.active {
    display: block;
}

/* Calculator Styles */
.calculator {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* Display */
.display {
    background: var(--light-gray);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: right;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.previous-operand {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    min-height: 1.2rem;
}

.current-operand {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-color);
    word-wrap: break-word;
    word-break: break-all;
}

/* Button Grid */
.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

/* Button Base Styles */
.btn {
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 500;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    background: var(--white);
    color: var(--text-color);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

/* Button Variants */
.btn.number {
    background: var(--white);
    border: 1px solid var(--border-color);
}

.btn.number:hover {
    background: var(--light-gray);
}

.btn.operation {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    color: white;
    font-weight: 600;
}

.btn.operation:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

.btn.equals {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-weight: 600;
    font-size: 1.5rem;
}

.btn.equals:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn.clear {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-weight: 600;
}

.btn.clear:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.btn.memory {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn.memory:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.btn.decimal {
    background: var(--white);
    border: 1px solid var(--border-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.btn.decimal:hover {
    background: var(--light-gray);
}

.btn.zero {
    grid-column: span 1;
}

/* Info Section */
.info {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.info h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 2rem;
    font-weight: 300;
}

.info p {
    line-height: 1.6;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.features, .keyboard-shortcuts {
    margin-bottom: 2rem;
}

.features h3, .keyboard-shortcuts h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.features ul, .keyboard-shortcuts ul {
    list-style: none;
    padding-left: 0;
}

.features li, .keyboard-shortcuts li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.features li:last-child, .keyboard-shortcuts li:last-child {
    border-bottom: none;
}

.features li::before {
    content: "✓";
    color: #10b981;
    font-weight: bold;
    margin-right: 0.75rem;
}

kbd {
    background: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-family: monospace;
    font-size: 0.85rem;
    margin: 0 0.2rem;
}

/* Currency Converter Styles */
.converter {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.converter-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.currency-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.currency-input-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.currency-row {
    display: flex;
    gap: 0.75rem;
}

.currency-input {
    flex: 2;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    background: var(--white);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.currency-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.currency-input:read-only {
    background: var(--light-gray);
    color: var(--text-color);
    font-weight: 600;
}

.currency-select {
    flex: 1;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    background: var(--white);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.currency-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.swap-container {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
}

.swap-btn {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    transform: translateY(-2px) rotate(180deg);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

.swap-btn:active {
    transform: translateY(0) rotate(180deg);
}

.rate-info {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

.exchange-rate {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.last-updated {
    font-size: 0.85rem;
    color: #64748b;
}

.quick-amounts {
    text-align: center;
}

.quick-amounts h4 {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1rem;
}

.quick-btn-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-btn {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-color);
    min-width: 50px;
}

.quick-btn:hover {
    border-color: var(--primary-color);
    background: var(--light-gray);
    transform: translateY(-1px);
}

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

.converter-status {
    text-align: center;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.status-loading {
    background: #f59e0b;
    animation: pulse 1.5s infinite;
}

.status-dot.status-online {
    background: #10b981;
}

.status-dot.status-offline {
    background: #ef4444;
}

.status-dot.status-cached {
    background: #8b5cf6;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.api-attribution {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.7;
}

.api-attribution a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.api-attribution a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 2rem;
    }
    
    header {
        padding: 1rem;
    }
    
    .tab-container {
        margin-bottom: 1.5rem;
    }
    
    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .calculator, .converter {
        padding: 1.5rem;
    }
    
    .current-operand {
        font-size: 2rem;
    }
    
    .btn {
        padding: 0.8rem;
        font-size: 1rem;
        min-height: 50px;
    }
    
    .buttons {
        gap: 0.5rem;
    }
    
    .currency-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .currency-input, .currency-select {
        padding: 0.8rem;
        font-size: 1rem;
    }
    
    .swap-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .quick-btn-group {
        gap: 0.4rem;
    }
    
    .quick-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
        min-width: 45px;
    }
    
    .info {
        padding: 1.5rem;
    }
    
    .info h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .buttons {
        gap: 0.4rem;
    }
    
    .btn {
        padding: 0.6rem;
        font-size: 0.9rem;
        min-height: 45px;
    }
    
    .current-operand {
        font-size: 1.8rem;
    }
    
    .calculator, .converter {
        padding: 1rem;
    }
    
    .converter-container {
        gap: 1rem;
    }
    
    .currency-input, .currency-select {
        padding: 0.7rem;
        font-size: 0.95rem;
    }
    
    .swap-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .quick-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.85rem;
        min-width: 40px;
    }
    
    .rate-info {
        padding: 0.8rem;
    }
    
    .exchange-rate {
        font-size: 1rem;
    }
    
    .info {
        padding: 1rem;
    }
}

/* High DPI/Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn {
        border-width: 0.5px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #e2e8f0;
        --bg-color: #1e293b;
        --white: #334155;
        --light-gray: #475569;
        --border-color: #64748b;
    }
    
    .info {
        background: rgba(51, 65, 85, 0.95);
        color: var(--text-color);
    }
}

/* Animation for button presses */
@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.btn.pressed {
    animation: buttonPress 0.1s ease-in-out;
}