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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2.5rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.calculator-card,
.history-card,
.info-card {
    background: var(--card-bg);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.input-wrapper input,
.input-group input,
.input-group select {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

.input-wrapper input:focus,
.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.input-wrapper select {
    width: auto;
    min-width: 80px;
    cursor: pointer;
}

.calculate-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.calculate-btn:active {
    transform: translateY(0);
}

.results {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.results.hidden {
    display: none;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: 0.75rem;
}

.result-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.result-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
}

#bmiCategory {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
}

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

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

.category-overweight {
    background: #fef3c7;
    color: #92400e;
}

.category-obese {
    background: #fee2e2;
    color: #991b1b;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: 0.75rem;
    border-left: 4px solid var(--primary);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-stats {
    font-size: 0.875rem;
    font-weight: 500;
}

.history-bmi {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.bmi-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.clear-btn {
    margin-top: 1rem;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: var(--danger);
    color: white;
}

.clear-btn.hidden {
    display: none;
}

.bmi-scale {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bmi-range {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
}

.bmi-range.underweight {
    background: #dbeafe;
    color: #1e40af;
}

.bmi-range.normal {
    background: #dcfce7;
    color: #166534;
}

.bmi-range.overweight {
    background: #fef3c7;
    color: #92400e;
}

.bmi-range.obese {
    background: #fee2e2;
    color: #991b1b;
}

.range-label {
    font-weight: 500;
}

.range-value {
    font-weight: 600;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    color: white;
    opacity: 0.8;
    font-size: 0.875rem;
}

@media (min-width: 640px) {
    .container {
        padding: 3rem 2rem;
    }

    .input-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .input-group:last-child {
        grid-column: span 2;
    }

    h1 {
        font-size: 3rem;
    }
}