:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #0ea5e9;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    min-height: 100vh;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Navbar */
.navbar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.025em;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 48px;
    background: var(--bg-primary);
    padding: 48px 24px 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.currency-selector {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.currency-selector label {
    font-weight: 600;
    font-size: 1rem;
}

.currency-selector select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 35px 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
    max-width: 200px;
}

.currency-selector select:hover {
    border-color: var(--primary-color);
}

.currency-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.currency-selector select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.currency-selector label {
    color: var(--text-secondary);
}

.main-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.6;
}

/* Tabs */
.calculator-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-button {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.tab-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Calculator Panels */
.calculator-panel {
    display: none;
    animation: fadeIn 0.4s ease-in;
}

.calculator-panel.active {
    display: block;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    background: var(--bg-primary);
    padding: 48px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Input Section */
.input-section h2,
.results-section h2 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--text-primary);
}

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix,
.input-suffix {
    position: absolute;
    color: var(--text-secondary);
    font-weight: 600;
    pointer-events: none;
}

.input-prefix {
    left: 15px;
}

.input-suffix {
    right: 15px;
}

input[type="number"],
select {
    width: 100%;
    padding: 12px 45px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

select {
    padding: 12px 15px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23718096' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 45px;
}

.input-with-select {
    display: flex;
    gap: 8px;
}

.input-with-select input {
    flex: 1;
    padding-right: 15px;
}

.unit-select {
    width: 110px;
    padding: 12px 35px 12px 12px;
    background-position: right 8px center;
    font-size: 0.9rem;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-top: 12px;
}

.calculate-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

.calculate-btn:active {
    transform: scale(0.98);
}

/* Results Section */
.results-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 15px;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.result-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    min-width: 0;
    overflow: hidden;
}

.result-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.result-card.primary {
    grid-column: 1 / -1;
    background: var(--primary-color);
    color: white;
}

.result-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
}

.result-card.primary .result-label {
    opacity: 0.95;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    word-break: break-word;
}

.result-card.primary .result-value {
    font-size: 1.8rem;
}

/* Breakdown Section */
.breakdown-section {
    margin-top: 30px;
}

.breakdown-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
}

.breakdown-legend {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-item strong {
    color: var(--text-primary);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 64px;
    padding: 32px 24px;
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .calculator-grid {
        padding: 25px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .result-card.primary {
        grid-column: 1;
    }

    .tab-button {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .main-title {
        font-size: 1.8rem;
    }

    .calculator-grid {
        padding: 20px;
        gap: 20px;
    }

    .input-section h2,
    .results-section h2 {
        font-size: 1.5rem;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .result-card.primary .result-value {
        font-size: 1.8rem;
    }

    .calculate-btn {
        font-size: 1rem;
        padding: 14px 24px;
    }
}

/* Loading State */
.calculate-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Smooth Transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Input Number Arrows Styling */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 0;
    cursor: pointer;
}

input[type="number"]:hover::-webkit-inner-spin-button,
input[type="number"]:hover::-webkit-outer-spin-button {
    opacity: 0.5;
}
