/*
  =================================================================
  فایل استایل اختصاصی محاسبه‌گر BMI کودکان و نوجوانان
  نسخه: 2.0 - بهینه‌سازی شده با A11y (Contrast) و E-E-A-T
  =================================================================
*/

/* --- Segmented Control (Gender) --- */
.segmented-control {
    display: flex;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    overflow: hidden;
}
.segmented-control input[type="radio"] { position: absolute; clip: rect(0, 0, 0, 0); pointer-events: none; }
.segmented-control label {
    flex: 1; text-align: center; padding: 12px 10px; font-size: 1rem;
    font-weight: bold; cursor: pointer; transition: var(--transition-fast);
    color: var(--light-text-color); background-color: var(--bg-color);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.segmented-control label:not(:last-child) { border-left: 1px solid var(--border-color); /* RTL */ }
.segmented-control input[type="radio"]:checked + label { background-color: var(--primary-color); color: white; }

/* --- Date Input --- */
.date-input {
    width: 100%; padding: 14px 20px; border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small); font-size: 1.1rem;
    font-family: var(--font-family-base); background-color: white;
}
.date-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.1); outline: none;
}

/* --- Custom Child BMI Result Card --- */
.result-card-child-bmi {
    color: white;
    border-radius: var(--border-radius-base);
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 15px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out; 
}
.result-card-child-bmi.visible { opacity: 1; transform: translateY(0); }

.result-section {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: var(--border-radius-base);
}
.result-section h4 { font-size: 0.95rem; opacity: 0.9; margin-bottom: 8px; font-weight: bold; }
.result-section p { margin: 0; }

.calculated-bmi .result-value { font-size: 1.5rem; font-weight: bold; }

.main-result .percentile-value { font-size: 1.2rem; font-weight: bold; margin-bottom: 5px; opacity: 0.9; }
.main-result .result-category { font-size: clamp(1.6rem, 5vw, 2rem); font-weight: bold; }

.explanation .result-explanation { font-size: 0.95rem; line-height: 1.6; }

.result-card-child-bmi .secondary-cta {
    background-color: white;
    font-weight: bold;
    margin-top: 10px;
}
.result-card-child-bmi .secondary-cta:hover { background-color: rgba(255, 255, 255, 0.8); }

/* --- Result Card Color Coding --- */

/* A11y FIX: Changed text color to dark for contrast */
.result-card-child-bmi.status-underweight { 
    background: linear-gradient(145deg, #0dcaf0, #3dd5f3); /* Light Blue */
    color: var(--text-color); /* Was white, failed contrast */
}
.result-card-child-bmi.status-underweight .result-section { background-color: rgba(0, 0, 0, 0.05); }
.result-card-child-bmi.status-underweight .secondary-cta { 
    color: #0d8a9e; 
    background-color: var(--text-color);
}
.result-card-child-bmi.status-underweight .secondary-cta:hover { background-color: #495057;}


.result-card-child-bmi.status-healthy { background: linear-gradient(145deg, var(--cat-تغذیه-و-وزن, #20c997), #26deaa); } /* Green */
.result-card-child-bmi.status-healthy .secondary-cta { color: var(--cat-تغذیه-و-وزن, #20c997); }

.result-card-child-bmi.status-overweight { background: linear-gradient(145deg, var(--cat-کودک-و-نوزاد, #ffc107), #ffd43b); color: var(--text-color); } /* Yellow */
.result-card-child-bmi.status-overweight .secondary-cta { color: #e6a800; background-color: var(--text-color);}
.result-card-child-bmi.status-overweight .secondary-cta:hover { background-color: #495057;}
.result-card-child-bmi.status-overweight .result-section { background-color: rgba(0, 0, 0, 0.05); } 

.result-card-child-bmi.status-obese { background: linear-gradient(145deg, var(--cat-تحلیل-پزشکی, #dc3545), #f05d6a); } /* Red */
.result-card-child-bmi.status-obese .secondary-cta { color: var(--cat-تحلیل-پزشکی, #dc3545); }


/* --- Content Table --- */
.bmi-table-container { overflow-x: auto; margin: 20px 0; }
table { width: 100%; border-collapse: collapse; text-align: center; }
th, td { padding: 12px 15px; border: 1px solid var(--border-color); vertical-align: middle; }
th { background-color: var(--bg-color); font-weight: bold; }
/* Status colors */
table .status-underweight { background-color: rgba(13, 202, 240, 0.1); }
table .status-healthy { background-color: rgba(32, 201, 151, 0.1); }
table .status-overweight { background-color: rgba(255, 193, 7, 0.1); }
table .status-obese { background-color: rgba(220, 53, 69, 0.1); }

/* --- A11y: Reduce Motion --- */
@media (prefers-reduced-motion: reduce) {
  .result-card-child-bmi,
  .result-card-child-bmi.visible {
    transition: none;
    opacity: 1;
    transform: translateY(0);
  }
  
  html {
    scroll-behavior: auto;
  }
  
  .segmented-control label {
    transition: none;
  }
}