/* BMI Calculator Styles */
:root {
    /* Colors */
    --purple: #AF52DE;
    --blue: #007AFF;
    --green: #34C759;
    --yellow: #FFCC00;
    --orange: #FF9500;
    --red: #FF3B30;
    --pink: #FF69B4;
    --gray: #8E8E93;
    
    /* Background Colors */
    --bg-light: #F2F2F7;
    --bg-dark: rgba(0, 0, 0, 0.95);
    --card-light: #FFFFFF;
    --card-dark: rgba(255, 255, 255, 0.1);
    
    /* Text Colors */
    --text-primary-light: #000000;
    --text-primary-dark: #FFFFFF;
    --text-secondary-light: #666666;
    --text-secondary-dark: rgba(255, 255, 255, 0.7);
    
    /* Shadow */
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Vazirmatn', 'Shabnam', system-ui, -apple-system, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary-light);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    body {
        background: var(--bg-dark);
        color: var(--text-primary-dark);
    }
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== HEADER / BACK BUTTON ===== */
        .top-nav {
            position: sticky;
            top: 0;
            z-index: 100;
            background: var(--bg);
            border-bottom: 1px solid rgba(128,128,128,0.15);
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .back-btn {
            display: flex;
            align-items: center;
            gap: 5px;
            color: var(--orange);
            text-decoration: none;
            font-size: 15px;
            font-weight: 600;
            padding: 6px 10px;
            border-radius: 8px;
            transition: background 0.2s;
        }

        .back-btn:hover {
            background: rgba(255,149,0,0.12);
        }

        .back-btn svg {
            width: 18px;
            height: 18px;
        }

        .top-nav-title {
            font-size: 16px;
            font-weight: 700;
            color: var(--text-primary);
            flex: 1;
            text-align: center;
        }
        
/* Header Section */
.header-section {
    background: linear-gradient(135deg, rgba(175, 82, 222, 0.3), rgba(0, 122, 255, 0.2));
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.header-text h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary-light);
    margin-bottom: 4px;
}

.header-text p {
    font-size: 12px;
    color: var(--text-secondary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .header-text h1 {
        color: var(--text-primary-dark);
    }
    
    .header-text p {
        color: var(--text-secondary-dark);
    }
}

.help-btn {
    background: none;
    border: none;
    color: var(--purple);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.help-btn:hover {
    background: rgba(175, 82, 222, 0.1);
    transform: scale(1.1);
}

/* Card Styles */
.card {
    background: var(--card-light);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 20px var(--shadow-light);
    transition: all 0.3s ease;
}

@media (prefers-color-scheme: dark) {
    .card {
        background: var(--card-dark);
        box-shadow: none;
    }
}

/* Section Title */
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary-light);
    margin-bottom: 12px;
}

@media (prefers-color-scheme: dark) {
    .section-title {
        color: var(--text-primary-dark);
    }
}

.section-title svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Age Group Selection */
.age-group-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.age-btn {
    background: rgba(175, 82, 222, 0.1);
    border: 1px solid rgba(175, 82, 222, 0.2);
    color: var(--purple);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.age-btn:hover {
    background: rgba(175, 82, 222, 0.15);
    transform: translateY(-1px);
}

.age-btn.active {
    background: var(--purple);
    color: white;
    border-color: var(--purple);
}

.age-group-description {
    margin-top: 8px;
}

.info-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 122, 255, 0.1);
    border-radius: 8px;
}

.info-note svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.info-note p {
    font-size: 11px;
    color: var(--text-secondary-light);
    margin: 0;
    line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
    .info-note p {
        color: var(--text-secondary-dark);
    }
}

/* Input Section */
.input-section {
    width: 100%;
    overflow-x: hidden; /* جلوگیری از اسکرول افقی意外 */
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

/* اطمینان از جمع‌شدگی (shrink) آیتم‌ها در فضای محدود */
.input-group {
    min-width: 0; /* کمک می‌کند محتوا از عرض والد بیشتر نشود */
    width: 100%;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.input-wrapper input {
    flex: 1;
    min-width: 0;         /* کلید اصلی: اجازه کوچک شدن به input می‌دهد */
    width: 100%;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

/* برای جلوگیری از سرریز در صفحه‌های کوچک */
@media (max-width: 640px) {
    .input-row {
        gap: 12px;
    }
    .input-wrapper {
        padding: 8px 12px;
    }
    .input-wrapper input {
        font-size: 20px;
    }
}

/* در صفحه‌های خیلی باریک، دو فیلد کنار هم می‌مانند اما کوچک‌تر می‌شوند */
@media (max-width: 480px) {
    .input-row {
        gap: 8px;
    }
    .input-wrapper {
        padding: 6px 10px;
    }
    .input-wrapper input {
        font-size: 18px;
    }
}

.input-wrapper:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary-light);
    text-align: center;
    outline: none;
    font-family: inherit;
}

@media (prefers-color-scheme: dark) {
    .input-wrapper input {
        color: var(--text-primary-dark);
    }
}

.input-wrapper input::placeholder {
    color: rgba(0, 122, 255, 0.4);
}

@media (prefers-color-scheme: dark) {
    .input-wrapper input::placeholder {
        color: rgba(255, 255, 255, 0.3);
    }
}

.input-suffix {
    font-size: 14px;
    font-weight: 600;
    margin-left: 8px;
}

.input-suffix.blue { color: var(--blue); }
.input-suffix.green { color: var(--green); }

/* Weight Input Specific Styling */
.input-group:nth-child(2) .input-wrapper {
    background: rgba(52, 199, 89, 0.1);
    border-color: rgba(52, 199, 89, 0.3);
}

.input-group:nth-child(2) .input-wrapper:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.1);
}

.input-group:nth-child(2) .input-wrapper input::placeholder {
    color: rgba(52, 199, 89, 0.4);
}

/* Gender Selection */
.gender-buttons {
    display: flex;
    gap: 12px;
}

.gender-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.3);
    border-radius: 12px;
    color: var(--blue);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.gender-btn:hover {
    background: rgba(0, 122, 255, 0.15);
    transform: translateY(-1px);
}

.gender-btn.active {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.gender-btn[data-gender="female"] {
    background: rgba(255, 105, 180, 0.1);
    border-color: rgba(255, 105, 180, 0.3);
    color: var(--pink);
}

.gender-btn[data-gender="female"]:hover {
    background: rgba(255, 105, 180, 0.15);
}

.gender-btn[data-gender="female"].active {
    background: var(--pink);
    color: white;
    border-color: var(--pink);
}

.gender-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Select Wrapper */
.select-wrapper {
    position: relative;
    background: rgba(128, 128, 128, 0.1);
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 12px;
    overflow: hidden;
}

.select-wrapper select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary-light);
    cursor: pointer;
    appearance: none;
    font-family: inherit;
    outline: none;
}

@media (prefers-color-scheme: dark) {
    .select-wrapper select {
        color: var(--text-primary-dark);
    }
}

.select-arrow {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary-light);
}

@media (prefers-color-scheme: dark) {
    .select-arrow {
        color: var(--text-secondary-dark);
    }
}

.select-wrapper:focus-within {
    border-color: var(--gray);
    box-shadow: 0 0 0 3px rgba(128, 128, 128, 0.1);
}

/* Age Display */
.age-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 105, 180, 0.1);
    border-radius: 10px;
    margin-top: 12px;
}

.age-display svg {
    width: 16px;
    height: 16px;
    fill: var(--pink);
}

.age-display span {
    font-size: 13px;
    color: var(--text-primary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .age-display span {
        color: var(--text-primary-dark);
    }
}

/* Calculate Button */
.calculate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--purple), var(--blue));
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(175, 82, 222, 0.4);
    transition: all 0.3s ease;
    font-family: inherit;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(175, 82, 222, 0.5);
}

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

.calculate-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Results Section */
.results-section {
    background: var(--card-light);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 20px var(--shadow-light);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

@media (prefers-color-scheme: dark) {
    .results-section {
        background: var(--card-dark);
        box-shadow: none;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.results-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.results-header svg {
    width: 24px;
    height: 24px;
    fill: var(--green);
}

.results-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary-light);
}

@media (prefers-color-scheme: dark) {
    .results-header h3 {
        color: var(--text-primary-dark);
    }
}

/* BMI Gauge Section */
.bmi-gauge-section {
    margin-bottom: 20px;
}

.gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.gauge-header span:first-child {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary-light);
}

@media (prefers-color-scheme: dark) {
    .gauge-header span:first-child {
        color: var(--text-primary-dark);
    }
}

.bmi-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary-light);
}

@media (prefers-color-scheme: dark) {
    .bmi-label {
        color: var(--text-secondary-dark);
    }
}

/* BMI Gauge */
.bmi-gauge {
    position: relative;
    height: 30px;
    margin-bottom: 16px;
}

.gauge-track {
    display: flex;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    gap: 2px;
}

.gauge-segment {
    flex: 1;
    height: 100%;
}

.gauge-segment.severe-underweight { background: var(--purple); }
.gauge-segment.underweight { background: var(--blue); }
.gauge-segment.healthy { background: var(--green); }
.gauge-segment.overweight { background: var(--yellow); }
.gauge-segment.obese { background: var(--orange); }
.gauge-segment.severe-obese { background: var(--red); }

.gauge-indicator {
    position: absolute;
    top: -5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

.indicator-triangle {
    width: 16px;
    height: 10px;
    background: white;
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.indicator-circle {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin-top: -1px;
}

/* Gauge Labels */
.gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-secondary-light);
    margin-bottom: 16px;
}

@media (prefers-color-scheme: dark) {
    .gauge-labels {
        color: var(--text-secondary-dark);
    }
}

/* BMI Value */
.bmi-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 20px;
}

.bmi-value #bmiNumber {
    font-size: 48px;
    font-weight: 700;
    color: var(--green);
    font-family: 'SF Pro Display', system-ui, sans-serif;
}

.bmi-unit {
    font-size: 14px;
    color: var(--text-secondary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .bmi-unit {
        color: var(--text-secondary-dark);
    }
}

/* Status Section */
.status-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(52, 199, 89, 0.2);
}

.status-icon svg {
    width: 24px;
    height: 24px;
    fill: var(--green);
}

.status-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-label {
    font-size: 12px;
    color: var(--text-secondary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .status-label {
        color: var(--text-secondary-dark);
    }
}

.status-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--green);
}

.percentile-section {
    text-align: left;
}

.percentile-label {
    font-size: 12px;
    color: var(--text-secondary-light);
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

@media (prefers-color-scheme: dark) {
    .percentile-label {
        color: var(--text-secondary-dark);
    }
}

.percentile-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--purple);
}

/* Details Section */
.details-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.detail-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    border-radius: 12px;
    gap: 8px;
}

.detail-card.blue {
    background: rgba(0, 122, 255, 0.1);
}

@media (prefers-color-scheme: dark) {
    .detail-card.blue {
        background: rgba(0, 122, 255, 0.15);
    }
}

.detail-card.green {
    background: rgba(52, 199, 89, 0.1);
}

@media (prefers-color-scheme: dark) {
    .detail-card.green {
        background: rgba(52, 199, 89, 0.15);
    }
}

.detail-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .detail-card-header {
        color: var(--text-secondary-dark);
    }
}

.detail-card-header svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.detail-card.blue .detail-card-header svg {
    fill: var(--blue);
}

.detail-card.green .detail-card-header svg {
    fill: var(--green);
}

.detail-card-value {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.detail-card-value span:first-child {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary-light);
}

@media (prefers-color-scheme: dark) {
    .detail-card-value span:first-child {
        color: var(--text-primary-dark);
    }
}

.detail-unit {
    font-size: 12px;
    color: var(--text-secondary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .detail-unit {
        color: var(--text-secondary-dark);
    }
}

/* Weight Difference */
.weight-difference {
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 149, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    .weight-difference {
        background: rgba(255, 149, 0, 0.15);
    }
}

.weight-difference.over {
    background: rgba(255, 149, 0, 0.1);
}

.weight-difference.under {
    background: rgba(0, 122, 255, 0.1);
}

@media (prefers-color-scheme: dark) {
    .weight-difference.over {
        background: rgba(255, 149, 0, 0.15);
    }
    
    .weight-difference.under {
        background: rgba(0, 122, 255, 0.15);
    }
}

.weight-diff-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.weight-diff-content svg {
    width: 16px;
    height: 16px;
    fill: var(--orange);
}

.weight-difference.under svg {
    fill: var(--blue);
}

#weightDiffText {
    font-size: 14px;
    color: var(--text-secondary-light);
    font-weight: 500;
    flex: 1;
}

@media (prefers-color-scheme: dark) {
    #weightDiffText {
        color: var(--text-secondary-dark);
    }
}

#weightDiffValue {
    font-size: 16px;
    font-weight: 700;
    color: var(--orange);
}

.weight-difference.under #weightDiffValue {
    color: var(--blue);
}

/* Healthy Range */
.healthy-range {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: rgba(52, 199, 89, 0.1);
    border-radius: 12px;
}

@media (prefers-color-scheme: dark) {
    .healthy-range {
        background: rgba(52, 199, 89, 0.15);
    }
}

.healthy-range-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .healthy-range-header {
        color: var(--text-secondary-dark);
    }
}

.healthy-range-header svg {
    width: 16px;
    height: 16px;
    fill: var(--green);
}

.healthy-range-values {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--green);
}

.range-separator {
    font-size: 14px;
    color: var(--text-secondary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .range-separator {
        color: var(--text-secondary-dark);
    }
}

.range-unit {
    font-size: 12px;
    color: var(--text-secondary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .range-unit {
        color: var(--text-secondary-dark);
    }
}

/* Note Section */
.note-section {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: rgba(128, 128, 128, 0.1);
    border-radius: 10px;
    margin-bottom: 16px;
}

@media (prefers-color-scheme: dark) {
    .note-section {
        background: rgba(255, 255, 255, 0.05);
    }
}

.note-section svg {
    width: 16px;
    height: 16px;
    fill: var(--gray);
    flex-shrink: 0;
    margin-top: 2px;
}

.note-section span {
    font-size: 11px;
    color: var(--text-secondary-light);
    line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
    .note-section span {
        color: var(--text-secondary-dark);
    }
}

/* Share Section */
.share-section {
    margin-top: 8px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: 1px solid var(--purple);
    color: var(--purple);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.share-btn:hover {
    background: rgba(175, 82, 222, 0.1);
    transform: translateY(-1px);
}

.share-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Help Sheet */
.help-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.help-sheet.show {
    opacity: 1;
    visibility: visible;
}

.help-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--card-light);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow-y: auto;
    padding: 20px;
}

@media (prefers-color-scheme: dark) {
    .help-content {
        background: var(--bg-dark);
    }
}

.help-sheet.show .help-content {
    transform: translateY(0);
}

.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 10;
}

.help-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary-light);
}

@media (prefers-color-scheme: dark) {
    .help-header h2 {
        color: var(--text-primary-dark);
    }
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary-light);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    .close-btn {
        color: var(--text-secondary-dark);
    }
}

.close-btn:hover {
    background: rgba(128, 128, 128, 0.1);
    color: var(--text-primary-light);
}

@media (prefers-color-scheme: dark) {
    .close-btn:hover {
        color: var(--text-primary-dark);
    }
}

.close-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Help Body */
.help-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.help-section {
    background: var(--card-light);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px var(--shadow-light);
}

@media (prefers-color-scheme: dark) {
    .help-section {
        background: var(--card-dark);
        box-shadow: none;
    }
}

.help-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.help-section-title.purple { color: var(--purple); }
.help-section-title.blue { color: var(--blue); }
.help-section-title.green { color: var(--green); }
.help-section-title.orange { color: var(--orange); }
.help-section-title.red { color: var(--red); }

.help-section-title svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.help-section p {
    font-size: 14px;
    color: var(--text-primary-light);
    line-height: 1.6;
    margin-bottom: 12px;
}

@media (prefers-color-scheme: dark) {
    .help-section p {
        color: var(--text-secondary-dark);
    }
}

.help-section p:last-child {
    margin-bottom: 0;
}

/* Formula Card */
.formula-card {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
}

@media (prefers-color-scheme: dark) {
    .formula-card {
        background: rgba(0, 0, 0, 0.3);
    }
}

.formula-text {
    font-family: 'SF Mono', 'Monaco', monospace;
    font-size: 16px;
    color: var(--blue);
    font-weight: 600;
    margin-bottom: 8px;
}

.formula-card p {
    font-size: 12px;
    color: var(--text-secondary-light);
    margin: 0;
}

@media (prefers-color-scheme: dark) {
    .formula-card p {
        color: var(--text-secondary-dark);
    }
}

/* Categories List */
.categories-list,
.percentiles-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.category-item,
.percentile-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(128, 128, 128, 0.05);
    border-radius: 8px;
}

@media (prefers-color-scheme: dark) {
    .category-item,
    .percentile-item {
        background: rgba(255, 255, 255, 0.05);
    }
}

.category-color,
.percentile-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.category-color.blue,
.percentile-color.blue { background: var(--blue); }
.category-color.green,
.percentile-color.green { background: var(--green); }
.category-color.yellow,
.percentile-color.yellow { background: var(--yellow); }
.category-color.orange,
.percentile-color.orange { background: var(--orange); }
.category-color.red,
.percentile-color.red { background: var(--red); }
.category-color.purple,
.percentile-color.purple { background: var(--purple); }

.category-range,
.percentile-range {
    font-size: 13px;
    color: var(--text-secondary-light);
    flex: 1;
}

@media (prefers-color-scheme: dark) {
    .category-range,
    .percentile-range {
        color: var(--text-secondary-dark);
    }
}

.category-status,
.percentile-status {
    font-size: 13px;
    font-weight: 700;
}

.category-status.blue,
.percentile-status.blue { color: var(--blue); }
.category-status.green,
.percentile-status.green { color: var(--green); }
.category-status.yellow,
.percentile-status.yellow { color: var(--yellow); }
.category-status.orange,
.percentile-status.orange { color: var(--orange); }
.category-status.red,
.percentile-status.red { color: var(--red); }
.category-status.purple,
.percentile-status.purple { color: var(--purple); }

/* Warnings List */
.warnings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.warning-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary-light);
}

@media (prefers-color-scheme: dark) {
    .warning-item {
        color: var(--text-secondary-dark);
    }
}

.warning-item svg {
    width: 12px;
    height: 12px;
    fill: var(--red);
    flex-shrink: 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px;
    background: var(--card-light);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
    .loading-spinner {
        background: var(--card-dark);
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(175, 82, 222, 0.2);
    border-top: 4px solid var(--purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-spinner span {
    font-size: 14px;
    color: var(--text-primary-light);
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .loading-spinner span {
        color: var(--text-primary-dark);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .header-text h1 {
        font-size: 20px;
    }
    
    .input-row {
        grid-template-columns: 1fr;
    }
    
    .detail-cards {
        grid-template-columns: 1fr;
    }
    
    .gender-buttons {
        flex-direction: column;
    }
    
    .bmi-value #bmiNumber {
        font-size: 40px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .card {
        padding: 16px;
    }
    
    .header-section {
        padding: 16px;
    }
    
    .header-text h1 {
        font-size: 18px;
    }
    
    .bmi-value #bmiNumber {
        font-size: 36px;
    }
    
    .help-content {
        padding: 16px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(128, 128, 128, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.5);
}

/* Focus Styles */
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--purple);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .help-sheet,
    .loading-overlay,
    .share-section,
    .help-btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card,
    .results-section {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

.bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Results Category Colors */
.results-section.severe-underweight {
    border-color: var(--purple);
    background: linear-gradient(135deg, rgba(175, 82, 222, 0.1), rgba(175, 82, 222, 0.05));
}

.results-section.underweight {
    border-color: var(--blue);
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.1), rgba(0, 122, 255, 0.05));
}

.results-section.healthy {
    border-color: var(--green);
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(52, 199, 89, 0.05));
}

.results-section.overweight {
    border-color: var(--yellow);
    background: linear-gradient(135deg, rgba(255, 204, 0, 0.1), rgba(255, 204, 0, 0.05));
}

.results-section.obese {
    border-color: var(--orange);
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.1), rgba(255, 149, 0, 0.05));
}

.results-section.severe-obese {
    border-color: var(--red);
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.1), rgba(255, 59, 48, 0.05));
}

@media (prefers-color-scheme: dark) {
    .results-section.severe-underweight {
        background: linear-gradient(135deg, rgba(175, 82, 222, 0.15), rgba(175, 82, 222, 0.08));
    }
    
    .results-section.underweight {
        background: linear-gradient(135deg, rgba(0, 122, 255, 0.15), rgba(0, 122, 255, 0.08));
    }
    
    .results-section.healthy {
        background: linear-gradient(135deg, rgba(52, 199, 89, 0.15), rgba(52, 199, 89, 0.08));
    }
    
    .results-section.overweight {
        background: linear-gradient(135deg, rgba(255, 204, 0, 0.15), rgba(255, 204, 0, 0.08));
    }
    
    .results-section.obese {
        background: linear-gradient(135deg, rgba(255, 149, 0, 0.15), rgba(255, 149, 0, 0.08));
    }
    
    .results-section.severe-obese {
        background: linear-gradient(135deg, rgba(255, 59, 48, 0.15), rgba(255, 59, 48, 0.08));
    }
}