/* CSS Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #16a34a;
    --warning-color: #ea580c;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.container {
    max-width: 900px;
    width: 100%;
}

/* Ad Slots */
.ad-slot {
    text-align: center;
    min-height: 50px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 15px;
}

h1 {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    color: var(--primary-color);
    margin-bottom: 6px;
    font-weight: 700;
}

.intro {
    color: var(--text-light);
    font-size: 0.9rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Layout - Two Columns */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* Form Styles */
#bmi-form {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

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

.input-group input,
.input-group select {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.dual-input {
    display: flex;
    gap: 10px;
}

.dual-input > div {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dual-input input {
    flex: 1;
}

.dual-input span {
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

/* Calculate Button */
#calculate-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#calculate-btn:hover {
    background: var(--primary-hover);
}

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

/* Right Column - Results & Info */
.right-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Results Section */
.results {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

.results.hidden {
    display: none !important;
}

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

.results h2 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.bmi-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.bmi-value .label {
    font-size: 1rem;
    color: var(--text-light);
}

.bmi-value .number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.category {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.category.underweight {
    background: #dbeafe;
    color: #1e40af;
}

.category.normal {
    background: #dcfce7;
    color: #166534;
}

.category.overweight {
    background: #ffedd5;
    color: #c2410c;
}

.category.obese {
    background: #fee2e2;
    color: #b91c1c;
}

.advice {
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Info Section */
.info-section {
    padding: 15px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.info-section h2 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1rem;
}

.bmi-chart {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.chart-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
}

.chart-row.underweight {
    background: #dbeafe;
    color: #1e40af;
}

.chart-row.normal {
    background: #dcfce7;
    color: #166534;
}

.chart-row.overweight {
    background: #ffedd5;
    color: #c2410c;
}

.chart-row.obese {
    background: #fee2e2;
    color: #b91c1c;
}

.disclaimer {
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 10px;
}

/* Footer */
footer {
    text-align: center;
    padding: 10px 0;
    color: var(--text-light);
    font-size: 0.8rem;
}

/* Responsive Design - Single Column on Mobile */
@media (max-width: 700px) {
    html, body {
        height: auto;
        overflow: auto;
    }

    body {
        align-items: flex-start;
        padding: 15px;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .bmi-chart {
        grid-template-columns: 1fr;
    }

    .dual-input {
        flex-direction: column;
        gap: 8px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .results {
        animation: none;
    }
}

/* Focus visible for keyboard navigation */
input:focus-visible,
select:focus-visible,
button:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}
