/* All CSS is now in a single block for better encapsulation and control */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
    --primary-color: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #22c55e;
    --warning-color: #f97316;
    --danger-color: #ef4444;
    --neutral-color: #6b7280;
    --bg-light: #f9fafb;
    --bg-dark: #e5e7eb;
}

body {
    font-family: 'Inter', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    min-height: 100vh;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

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

.pie-container {
    position: relative;
    height: 350px;
    width: 100%;
    max-width: 500px;
    margin: 1rem auto;
}

@media (max-width: 768px) {
    .chart-container { height: 300px; }
    .pie-container { height: 300px; }
}

input[type="number"], input[type="range"], select {
    transition: all 0.3s ease;
}

input[type="number"]:focus, select:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    background: #e5e7eb;
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: var(--primary-color);
    height: 20px;
    width: 20px;
    border-radius: 50%;
    margin-top: -7px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

input[type="range"]::-moz-range-thumb {
    background: var(--primary-color);
    height: 20px;
    width: 20px;
    border-radius: 50%;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 300px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    text-align: left;
    border-radius: 8px;
    padding: 12px 16px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -150px;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    line-height: 1.5;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: var(--secondary-color) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
    transform: translateY(-5px);
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
    cursor: help;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: #4b5563; /* Dark gray for better contrast */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

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

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

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.input-group label {
    flex: 1;
    font-weight: 500;
    color: #374151;
}

.input-group input,
.input-group select {
    flex: 0 0 auto;
    width: 150px;
}

.slider-container {
    margin-bottom: 1.5rem;
}

.slider-value {
    display: inline-block;
    min-width: 80px;
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

/* Updated Summary Card Styling */
.summary-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.summary-card .metric-label {
    color: #4b5563;
}

.summary-card .metric-value {
    color: #111827;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    color: #1f2937;
}

.metric-label {
    color: var(--neutral-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scenario-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 0.5rem;
    padding: 0.25rem;
    margin-bottom: 2rem;
}

.scenario-button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--neutral-color);
    font-weight: 500;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.scenario-button.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.loading-spinner {
    display: none;
    width: 40px;
    height: 40px;
    margin: 2rem auto;
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.fade-in {
    animation: fadeIn 0.5s ease;
}

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

.highlight-positive {
    color: var(--success-color);
}

.highlight-negative {
    color: var(--danger-color);
}

.recommendation-box {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.comparison-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.comparison-table tr:hover {
    background: #f9fafb;
}

.error-message, .info-message {
    color: var(--danger-color);
    font-weight: bold;
    text-align: center;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.error-message { background: #fef2f2; color: #ef4444; }
.info-message { background: #eff6ff; color: #3b82f6; }
.message-show { opacity: 1; }

/* Mobile responsiveness improvements */
@media (max-width: 768px) {
    .input-group input,
    .input-group select {
        width: 120px;
    }
    .slider-value {
        min-width: 60px;
    }
    .metric-value {
        font-size: 1.5rem;
    }
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    .scenario-button {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}
