/*
  =================================================================
  فایل استایل اختصاصی تحلیل‌گر eGFR (عملکرد کلیه)
  نسخه: 1.1 - بهینه‌سازی A11y
  =================================================================
*/

/* --- Segmented Control for 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;
    color: var(--light-text-color);
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    
    /* === تغییر ۱: افزودن احترام به prefers-reduced-motion === */
    @media (prefers-reduced-motion: no-preference) {
        transition: var(--transition-fast);
    }
}

.segmented-control label:not(:last-child) {
    border-left: 1px solid var(--border-color); /* For RTL */
}

.segmented-control input[type="radio"]:checked + label {
    background-color: var(--primary-color);
    color: white;
}

.segmented-control input[type="radio"]:focus-visible + label {
    outline: 3px solid var(--secondary-color);
    outline-offset: -3px;
    z-index: 1;
}

/* --- Input with Unit --- */
.input-wrapper .input-unit {
    position: absolute;
    left: 15px; /* For RTL */
    top: 50%;
    transform: translateY(-50%);
    color: var(--light-text-color);
    font-size: 0.9rem;
    font-weight: bold;
    pointer-events: none;
}

.input-wrapper input[type="number"] {
    padding-left: 75px; /* Space for the unit */
}

/* --- Result Card Color Coding (KDIGO Stages) --- */
.result-card .unit {
    font-size: 1rem;
    opacity: 0.8;
    margin-top: -10px;
}

.result-card.status-g1 { background: linear-gradient(145deg, var(--cat-تغذیه-و-وزن), #26deaa); } /* Green */
.result-card.status-g2 { background: linear-gradient(145deg, #a5d6a7, #81c784); } /* Light Green */
.result-card.status-g3a { background: linear-gradient(145deg, var(--cat-کودک-و-نوزاد), #ffd43b); } /* Yellow */
.result-card.status-g3b { background: linear-gradient(145deg, var(--cat-تناسب-اندام), #ff9a4f); } /* Orange */
.result-card.status-g4 { background: linear-gradient(145deg, var(--cat-تحلیل-پزشکی), #f05d6a); } /* Red */
.result-card.status-g5 { background: linear-gradient(145deg, #b71c1c, #e53935); } /* Dark Red */

/* Fix text color for light/yellow/orange backgrounds */
.result-card.status-g2 .result-header,
.result-card.status-g2 .result-interpretation,
.result-card.status-g3a .result-header,
.result-card.status-g3a .result-interpretation,
.result-card.status-g3b .result-header,
.result-card.status-g3b .result-interpretation {
    color: var(--text-color);
}
.result-card.status-g2 .result-header h3,
.result-card.status-g2 .result-interpretation p,
.result-card.status-g3a .result-header h3,
.result-card.status-g3a .result-interpretation p,
.result-card.status-g3b .result-header h3,
.result-card.status-g3b .result-interpretation p {
    color: var(--text-color);
    opacity: 0.85; /* Slightly darker */
}
/* .result-value handled by base */
.result-card.status-g2 .result-category,
.result-card.status-g3a .result-category,
.result-card.status-g3b .result-category {
    color: var(--text-color);
}
.result-card.status-g2 .cta-button.secondary-cta,
.result-card.status-g3a .cta-button.secondary-cta,
.result-card.status-g3b .cta-button.secondary-cta {
    background: var(--text-color);
    color: white;
}
.result-card.status-g2 .cta-button.secondary-cta:hover,
.result-card.status-g3a .cta-button.secondary-cta:hover,
.result-card.status-g3b .cta-button.secondary-cta:hover {
    background: #495057;
}


/* --- Content Table Styles --- */
.egfr-table-container {
    overflow-x: auto;
    margin: 20px 0;
}
table { width: 100%; border-collapse: collapse; text-align: right; /* RTL */ }
th, td { padding: 12px 15px; border: 1px solid var(--border-color); vertical-align: middle; }
th { background-color: var(--bg-color); font-weight: bold; text-align: center; } /* Center align headers */
td:first-child { text-align: center; font-weight: bold; } /* Center align stage names */

/* Status colors for tables */
table .status-g1 { background-color: rgba(32, 201, 151, 0.1); }
table .status-g2 { background-color: rgba(165, 214, 167, 0.2); }
table .status-g3a { background-color: rgba(255, 193, 7, 0.1); }
table .status-g3b { background-color: rgba(253, 126, 20, 0.1); }
table .status-g4 { background-color: rgba(220, 53, 69, 0.1); }
table .status-g5 { background-color: rgba(183, 28, 28, 0.1); }

/* === تغییر ۲: افزودن احترام به prefers-reduced-motion برای transition کارت نتیجه === */
@media (prefers-reduced-motion: reduce) {
    .result-card {
        transition: none;
    }
}