:root {
    --primary: #1e3a5f;
    --accent: #0d9488;
    --background: #f5f7fa;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: 40px 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.app-header .subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Wizard Progress */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    padding: 0 20px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
}

.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    font-family: 'Space Mono', monospace;
}

.progress-step.active .step-number {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.progress-step.completed .step-number {
    background: var(--success);
    color: white;
}

.step-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

.progress-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 10px;
    max-width: 150px;
}

.progress-step.completed ~ .progress-line {
    background: var(--success);
}

/* Wizard Content */
.wizard-content {
    position: relative;
    min-height: 500px;
}

.wizard-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card */
.card {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.card h2 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.step-description {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1rem;
}
.step-description.small {
    margin-top: 10px;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.base-select {
    margin-bottom: 30px;
}

.base-select label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.base-select select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.2s;
}

.base-select select:focus {
    outline: none;
    border-color: var(--accent);
}

.amount-input-group {
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.08) 0%, rgba(30, 58, 95, 0.05) 100%);
    border-radius: 20px;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
    position: relative;
    overflow: hidden;
}

.amount-input-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--primary) 100%);
}

.amount-input-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--primary);
    font-size: 1.1rem;
    letter-spacing: 0.3px;
}

.amount-input-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.amount-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.15), 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.amount-input {
    flex: 1;
    padding: 18px 24px;
    border: none;
    font-size: 1.5rem;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: var(--primary);
    background: transparent;
    min-width: 0;
}

.amount-input:focus {
    outline: none;
}

.amount-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.amount-currency {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--accent) 0%, #0b7d72 100%);
    padding: 18px 28px;
    font-size: 1.2rem;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 1px;
    box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.1);
}

.input-hint {
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-style: italic;
}

.input-hint::before {
    content: '💡';
    font-size: 1.1rem;
}

/* Country Selection */
.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.country-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface);
}

.country-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.country-card.selected {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.1) 0%, rgba(13, 148, 136, 0.05) 100%);
}

.country-card .flag {
    font-size: 3rem;
    margin-bottom: 10px;
}

.country-card .country-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.country-card .currency-code {
    font-family: 'Space Mono', monospace;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Exchange Rates */
.rates-container {
    margin-bottom: 30px;
}

.rate-item {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: var(--background);
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
}

.rate-item .country-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rate-item .flag {
    font-size: 2rem;
}

.rate-item .currency {
    font-family: 'Space Mono', monospace;
    font-weight: 600;
    color: var(--primary);
}

.rate-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rate-input-group input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.rate-input-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.rate-input-group .base-currency {
    color: var(--text-secondary);
    font-weight: 500;
}

.rate-source {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.rate-source.manual {
    color: var(--warning);
}

/* Inflation */
.inflation-controls {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--background);
    border-radius: 12px;
}

.inflation-controls label {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
}

.inflation-controls select {
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface);
    cursor: pointer;
}

.inflation-container {
    margin-bottom: 30px;
}

.inflation-item {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: var(--background);
    border-radius: 12px;
    margin-bottom: 15px;
}

.inflation-item .country-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inflation-item .flag {
    font-size: 2rem;
}

.inflation-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.inflation-input {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.inflation-input label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.inflation-input input {
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
}

.inflation-input input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Results */
.results-table-container {
    overflow-x: auto;
    margin-bottom: 30px;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
}

.results-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
}

.results-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.results-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    font-family: 'Space Mono', monospace;
}

.results-table tbody tr:hover {
    background: var(--background);
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

/* Results Header */
.results-header {
    margin-bottom: 30px;
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.results-header h2 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.results-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Comparison Cards */
.comparison-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.comparison-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.comparison-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.card-country-code {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    font-family: 'Space Mono', monospace;
}

.card-country-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
    font-family: 'Space Mono', monospace;
}

.card-change {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
}

.card-change.negative {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.card-change.positive {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.change-icon {
    font-size: 1.2rem;
}

/* Detailed Table */
.detailed-results {
    margin-top: 40px;
    padding: 30px;
    background: var(--background);
    border-radius: 12px;
}

.detailed-results h3 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.chart-subtitle {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.detailed-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 20px;
}

.detailed-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
}

.detailed-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.detailed-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
}

.detailed-table tbody tr:hover {
    background: var(--background);
}

.detailed-table .country-cell {
    font-weight: 600;
    vertical-align: middle;
}

.detailed-table td.negative {
    color: var(--error);
    font-weight: 600;
}

.chart-container {
    margin-top: 40px;
    padding: 30px;
    background: var(--background);
    border-radius: 12px;
    position: relative;
}

.chart-container h3 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 450px;
    min-height: 300px;
}

#purchasing-power-chart,
#bar-chart {
    width: 100% !important;
    height: 100% !important;
    max-height: 100%;
}

/* Chart responsive adjustments */
@media (max-width: 768px) {
    .chart-wrapper {
        height: 350px;
        min-height: 250px;
    }
}

@media (max-width: 480px) {
    .chart-wrapper {
        height: 300px;
        min-height: 200px;
    }
}

/* Buttons */
.step-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'DM Sans', sans-serif;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0b7d72;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    background: var(--border);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--accent);
}

/* Loading */
.loading-indicator {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading-indicator.active {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--error);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-width: 400px;
}

.error-message.active {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .app-header h1 {
        font-size: 1.8rem;
    }
    
    .app-header .subtitle {
        font-size: 0.95rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .wizard-progress {
        flex-wrap: wrap;
        gap: 10px;
        padding: 0 10px;
    }
    
    .progress-line {
        display: none;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .step-label {
        font-size: 0.8rem;
    }
    
    .country-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .country-card {
        padding: 15px;
    }
    
    .country-card .flag {
        font-size: 2rem;
    }
    
    .amount-input-group {
        padding: 20px;
        border-radius: 16px;
    }
    
    .amount-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .amount-input {
        font-size: 1.2rem;
        padding: 14px 18px;
    }
    
    .amount-currency {
        text-align: center;
        padding: 14px 18px;
        font-size: 1rem;
        min-width: auto;
        border-radius: 0 0 10px 10px;
    }
    
    .rate-item {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .inflation-item {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .inflation-inputs {
        grid-template-columns: 1fr;
    }
    
    .comparison-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .chart-container {
        padding: 20px;
    }
    
    .chart-wrapper {
        height: 300px;
    }
    
    .detailed-results {
        padding: 20px;
    }
    
    .detailed-table {
        font-size: 0.85rem;
    }
    
    .detailed-table th,
    .detailed-table td {
        padding: 10px 8px;
    }
    
    .step-actions {
        flex-direction: column;
    }
    
    .step-actions button {
        width: 100%;
    }
    
    .results-header h2 {
        font-size: 1.5rem;
    }
    
    .results-subtitle {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 25px 15px;
    }
    
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .card h2 {
        font-size: 1.5rem;
    }
    
    .chart-container h3,
    .detailed-results h3 {
        font-size: 1.2rem;
    }
    
    .chart-wrapper {
        height: 250px;
    }
    
    .comparison-card {
        padding: 20px;
    }
    
    .card-country-code {
        font-size: 2rem;
    }
    
    .card-value {
        font-size: 1.2rem;
    }
}