:root {
    --primary-color: #0ea5e9; /* Sky Blue */
    --primary-dark: #0284c7;
    --accent-color: #f43f5e; /* Rose for alerts */
    --success-color: #10b981; /* Emerald */
    --warning-color: #f59e0b; /* Amber */
    --bg-color: #f8fafc; /* Slate 50 */
    --card-bg: #ffffff;
    --text-main: #0f172a; /* Slate 900 */
    --text-secondary: #64748b; /* Slate 500 */
    --border-color: #e2e8f0;
    --input-bg: #f8fafc;
    --rec-bg: #f0f9ff;
    --rec-border: #bae6fd;
    --rec-title: #0369a1;
    --rec-text: #0c4a6e;
    --radius-lg: 16px;
    --radius-md: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --primary-color: #38bdf8; /* Lighter Sky Blue */
    --primary-dark: #0ea5e9;
    --accent-color: #fb7185; /* Rose for alerts */
    --success-color: #34d399; /* Emerald */
    --warning-color: #fbbf24; /* Amber */
    --bg-color: #0f172a; /* Slate 900 */
    --card-bg: #1e293b; /* Slate 800 */
    --text-main: #f1f5f9; /* Slate 100 */
    --text-secondary: #94a3b8; /* Slate 400 */
    --border-color: #334155;
    --input-bg: #1e293b;
    --rec-bg: #1e3a5f;
    --rec-border: #2563eb;
    --rec-title: #60a5fa;
    --rec-text: #bfdbfe;
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    padding: 1rem;
}

@media (min-width: 768px) {
    body {
        padding: 2rem;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    header {
        margin-bottom: 3rem;
    }

    header h1 {
        font-size: 2.5rem;
    }

    header p {
        font-size: 1.1rem;
    }
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 900px) {
    .grid-layout {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

@media (min-width: 768px) {
    .card {
        padding: 2rem;
    }
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f1f5f9;
}

@media (min-width: 768px) {
    .card h2 {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
        padding-bottom: 0.75rem;
    }
}

.form-group-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
    .form-group-title {
        font-size: 0.9rem;
        margin-top: 1.5rem;
        margin-bottom: 1rem;
    }
}

.form-group-title:first-of-type {
    margin-top: 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 600px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.input-group {
    margin-bottom: 1rem;
}

.input-group.full-width {
    grid-column: 1 / -1;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
    background-color: var(--card-bg);
}

/* Fix autofill styles for dark mode */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--input-bg) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
}

[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--input-bg) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
}

.hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 2rem;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* Results Section */
.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 600px) {
    .results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
    }
}

.chart-container {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--input-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .chart-container {
        margin-bottom: 2rem;
        padding: 1.5rem;
    }
}

.chart-container h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

@media (min-width: 768px) {
    .chart-container h3 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
}

.chart-container canvas {
    max-height: 250px;
}

@media (min-width: 768px) {
    .chart-container canvas {
        max-height: 300px;
    }
}

.metric-card {
    background: var(--input-bg);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.metric-unit {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #e2e8f0;
    color: #64748b;
}

.status-badge.success { background-color: #dcfce7; color: #166534; }
.status-badge.warning { background-color: #fef3c7; color: #92400e; }
.status-badge.danger { background-color: #fee2e2; color: #991b1b; }

.interpretation-box {
    margin-bottom: 2rem;
}

.interpret-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}

@media (min-width: 600px) {
    .interpret-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
    }
}

.interpret-item:last-child {
    border-bottom: none;
}

.interpret-item .label {
    font-weight: 500;
    color: var(--text-secondary);
}

.interpret-item .value {
    font-weight: 600;
}

.recommendation-box {
    background-color: var(--rec-bg);
    border: 1px solid var(--rec-border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

@media (min-width: 768px) {
    .recommendation-box {
        padding: 1.5rem;
    }
}

.recommendation-box h3 {
    color: var(--rec-title);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    border-bottom: none;
}

@media (min-width: 768px) {
    .recommendation-box h3 {
        font-size: 1.1rem;
    }
}

.recommendation-box p {
    color: var(--rec-text);
    font-size: 0.875rem;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .recommendation-box p {
        font-size: 0.95rem;
    }
}

/* Theme & Language Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

@media (min-width: 600px) {
    .controls {
        flex-direction: row;
        gap: 0.75rem;
        justify-content: center;
        margin-bottom: 1.5rem;
    }
}

.toggle-btn {
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-main);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

@media (min-width: 600px) {
    .toggle-btn {
        width: auto;
        padding: 0.5rem 1rem;
    }
}

.toggle-btn:hover {
    background-color: var(--input-bg);
    border-color: var(--primary-color);
}

.toggle-btn svg {
    width: 16px;
    height: 16px;
}
