/* ============================================
   eGFR Calculator — Medical Blue Theme
   CKD-EPI 2021 (Race-Free)
   ============================================ */

/* ---- Container ---- */
.egfr-calculator-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1e293b;
    line-height: 1.6;
}

.egfr-calculator-container *,
.egfr-calculator-container *::before,
.egfr-calculator-container *::after {
    box-sizing: border-box;
}

/* ---- Hero ---- */
.egfr-hero {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
    color: #fff;
    text-align: center;
    padding: 48px 32px 40px;
    border-radius: 16px;
    margin-bottom: 32px;
}

.egfr-hero h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.egfr-hero .hero-subtitle {
    font-size: 1.05rem;
    opacity: 0.9;
    margin: 0 0 24px;
    font-weight: 400;
}

.egfr-hero .hero-badges {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.egfr-hero .badge {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 16px;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

.egfr-hero .badge-icon {
    margin-right: 4px;
}

/* ---- Stats Row ---- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #1d4ed8;
    margin-bottom: 4px;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

/* ---- Privacy Notice ---- */
.privacy-notice {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #1d4ed8;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1e40af;
    margin-bottom: 32px;
}

/* ---- Calculator Form ---- */
.calculator-form-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: #1e293b;
}

.form-group .label-note {
    font-weight: 400;
    font-size: 0.82rem;
    color: #64748b;
}

.form-group input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="number"]:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
    background: #fff;
}

.input-hint {
    display: block;
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 6px;
}

/* ---- Creatinine Unit Toggle ---- */
.input-with-toggle {
    display: flex;
    gap: 0;
    align-items: stretch;
}

.input-with-toggle input[type="number"] {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex: 1;
    min-width: 0;
}

.unit-toggle {
    display: flex;
    flex-shrink: 0;
}

.unit-toggle .unit-btn {
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-left: none;
    background: #f1f5f9;
    font-size: 0.88rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.unit-toggle .unit-btn:first-child {
    border-left: none;
}

.unit-toggle .unit-btn:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.unit-toggle .unit-btn.active {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}

.unit-toggle .unit-btn:hover:not(.active) {
    background: #e2e8f0;
    color: #334155;
}

/* ---- Radio Toggle ---- */
.radio-toggle {
    display: flex;
    gap: 12px;
}

.toggle-btn {
    flex: 1;
    cursor: pointer;
}

.toggle-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-btn span {
    display: block;
    text-align: center;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
    transition: all 0.2s;
}

.toggle-btn input[type="radio"]:checked + span {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}

.toggle-btn:hover span {
    border-color: #93c5fd;
}

/* ---- Submit Button ---- */
.form-submit {
    text-align: center;
    margin-top: 28px;
}

.submit-btn {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
    color: #fff;
    border: none;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.3);
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.4);
}

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

/* ---- Results Section ---- */
.results-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    margin-bottom: 32px;
}

.results-section h2 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 24px;
}

/* ---- eGFR Value Display ---- */
.egfr-value-display {
    text-align: center;
    margin-bottom: 24px;
}

.egfr-big-number {
    font-size: 4rem;
    font-weight: 900;
    color: #1d4ed8;
    line-height: 1;
    margin-bottom: 4px;
}

.egfr-unit {
    font-size: 1rem;
    color: #64748b;
    font-weight: 500;
}

/* ---- CKD Stage Card ---- */
.ckd-stage-card {
    text-align: center;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 2px solid #e2e8f0;
}

.stage-label {
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stage-name {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stage-description {
    font-size: 0.92rem;
    color: #475569;
    line-height: 1.5;
}

/* CKD Stage Color Variants */
.ckd-stage-card.stage-g1 {
    background: #f0fdf4;
    border-color: #22c55e;
}
.ckd-stage-card.stage-g1 .stage-label { color: #16a34a; }
.ckd-stage-card.stage-g1 .stage-name { color: #15803d; }

.ckd-stage-card.stage-g2 {
    background: #f7fee7;
    border-color: #84cc16;
}
.ckd-stage-card.stage-g2 .stage-label { color: #65a30d; }
.ckd-stage-card.stage-g2 .stage-name { color: #4d7c0f; }

.ckd-stage-card.stage-g3a {
    background: #fefce8;
    border-color: #eab308;
}
.ckd-stage-card.stage-g3a .stage-label { color: #ca8a04; }
.ckd-stage-card.stage-g3a .stage-name { color: #a16207; }

.ckd-stage-card.stage-g3b {
    background: #fff7ed;
    border-color: #f97316;
}
.ckd-stage-card.stage-g3b .stage-label { color: #ea580c; }
.ckd-stage-card.stage-g3b .stage-name { color: #c2410c; }

.ckd-stage-card.stage-g4 {
    background: #fef2f2;
    border-color: #ef4444;
}
.ckd-stage-card.stage-g4 .stage-label { color: #dc2626; }
.ckd-stage-card.stage-g4 .stage-name { color: #b91c1c; }

.ckd-stage-card.stage-g5 {
    background: #fef2f2;
    border-color: #991b1b;
}
.ckd-stage-card.stage-g5 .stage-label { color: #991b1b; }
.ckd-stage-card.stage-g5 .stage-name { color: #7f1d1d; }

/* ---- Kidney Function Gauge ---- */
.kidney-gauge-section {
    margin-bottom: 24px;
}

.kidney-gauge-section h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
    text-align: center;
}

.kidney-gauge {
    position: relative;
    padding-bottom: 32px;
}

.gauge-track {
    display: flex;
    height: 28px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

.gauge-zone {
    transition: opacity 0.2s;
}

/* Zone widths proportional to eGFR range (0-120 scale) */
.gauge-zone.gauge-g5 {
    flex: 15;
    background: #991b1b;
}

.gauge-zone.gauge-g4 {
    flex: 15;
    background: #ef4444;
}

.gauge-zone.gauge-g3b {
    flex: 15;
    background: #f97316;
}

.gauge-zone.gauge-g3a {
    flex: 15;
    background: #eab308;
}

.gauge-zone.gauge-g2 {
    flex: 30;
    background: #84cc16;
}

.gauge-zone.gauge-g1 {
    flex: 30;
    background: #22c55e;
}

.gauge-marker {
    position: absolute;
    top: -6px;
    transition: left 0.6s ease-out;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
}

.marker-arrow {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #1e293b;
}

.marker-value {
    margin-top: 2px;
    background: #1e293b;
    color: #fff;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 36px;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    padding: 0 2px;
}

/* ---- Interpretation & Action Cards ---- */
.interpretation-card,
.action-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.interpretation-card h3,
.action-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
}

.interpretation-card p {
    margin: 0 0 8px;
    font-size: 0.93rem;
    color: #334155;
}

.action-card ul {
    margin: 0;
    padding-left: 20px;
}

.action-card li {
    font-size: 0.93rem;
    color: #334155;
    margin-bottom: 8px;
    line-height: 1.5;
}

/* ---- Result Actions ---- */
.result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 24px 0;
}

.mdcv2-print-btn,
.mdcv2-share-btn {
    padding: 10px 24px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.mdcv2-print-btn:hover,
.mdcv2-share-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* ---- History ---- */
.mdcv2-history-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
    margin-top: 8px;
}

.mdcv2-history-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
}

.history-date {
    color: #94a3b8;
}

.history-result {
    font-weight: 600;
    color: #1e293b;
}

.mdcv2-clear-history {
    margin-top: 12px;
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.82rem;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}

.mdcv2-clear-history:hover {
    color: #ef4444;
    border-color: #fca5a5;
}

/* ---- Retake ---- */
.retake-wrapper {
    text-align: center;
    margin-top: 20px;
}

.retake-btn {
    padding: 12px 36px;
    border: 2px solid #1d4ed8;
    border-radius: 10px;
    background: transparent;
    color: #1d4ed8;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.retake-btn:hover {
    background: #1d4ed8;
    color: #fff;
}

/* ---- Education Tabs ---- */
.education-tabs {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tab-nav {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    flex: 1;
    padding: 14px 12px;
    border: none;
    background: #f8fafc;
    font-size: 0.88rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.tab-btn.active {
    background: #fff;
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
}

.tab-content {
    display: none;
    padding: 28px 32px;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 16px;
}

.tab-content h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1d4ed8;
    margin: 20px 0 10px;
}

.tab-content p {
    font-size: 0.93rem;
    color: #334155;
    margin-bottom: 12px;
}

.tab-content ul {
    padding-left: 20px;
    margin-bottom: 16px;
}

.tab-content li {
    font-size: 0.93rem;
    color: #334155;
    margin-bottom: 8px;
    line-height: 1.5;
}

/* CKD Stage Info Blocks (in tabs) */
.ckd-stage-info {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    background: #f8fafc;
}

.ckd-stage-info h4 {
    margin-top: 0;
}

.ckd-stage-info p {
    margin-bottom: 8px;
}

.ckd-stage-info p:last-child {
    margin-bottom: 0;
}

/* ---- FAQ Accordion ---- */
.faq-section {
    margin-bottom: 32px;
}

.faq-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 20px;
    text-align: center;
}

.faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    background: #fff;
}

.faq-question {
    width: 100%;
    padding: 16px 20px;
    border: none;
    background: #fff;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.faq-question::after {
    content: "+";
    font-size: 1.3rem;
    font-weight: 700;
    color: #1d4ed8;
    flex-shrink: 0;
    margin-left: 16px;
    transition: transform 0.2s;
}

.faq-item.active .faq-question::after {
    content: "\2212";
}

.faq-question:hover {
    background: #f8fafc;
}

.faq-answer {
    display: none;
    padding: 0 20px 16px;
}

.faq-item.active .faq-answer {
    display: block;
}

.faq-answer p {
    font-size: 0.92rem;
    color: #475569;
    line-height: 1.6;
    margin: 0 0 8px;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

/* ---- Medical Disclaimer ---- */
.medical-disclaimer {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 32px;
}

.medical-disclaimer h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #92400e;
    margin: 0 0 8px;
}

.medical-disclaimer p {
    font-size: 0.88rem;
    color: #78350f;
    margin: 0;
    line-height: 1.6;
}

/* ---- Related Calculators ---- */
.related-calculators {
    margin-bottom: 32px;
}

.related-calculators h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 20px;
    text-align: center;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.related-card {
    display: block;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.related-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.1);
    transform: translateY(-2px);
}

.related-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #1d4ed8;
    margin: 0 0 6px;
}

.related-card p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* ---- References ---- */
.references-section {
    margin-bottom: 32px;
}

.references-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 16px;
    text-align: center;
}

.references-section ol {
    padding-left: 24px;
    margin: 0;
}

.references-section li {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.5;
}

.references-section a {
    color: #1d4ed8;
    text-decoration: none;
}

.references-section a:hover {
    text-decoration: underline;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
    .egfr-hero {
        padding: 32px 20px 28px;
    }

    .egfr-hero h1 {
        font-size: 1.6rem;
    }

    .egfr-hero .hero-subtitle {
        font-size: 0.9rem;
    }

    .stats-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .calculator-form-section {
        padding: 20px;
    }

    .input-with-toggle {
        flex-direction: column;
    }

    .input-with-toggle input[type="number"] {
        border-radius: 10px;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .unit-toggle {
        width: 100%;
    }

    .unit-toggle .unit-btn {
        flex: 1;
        border-left: 2px solid #e2e8f0;
        border-top: none;
        border-radius: 0;
    }

    .unit-toggle .unit-btn:first-child {
        border-left: 2px solid #e2e8f0;
        border-bottom-left-radius: 10px;
    }

    .unit-toggle .unit-btn:last-child {
        border-top-right-radius: 0;
        border-bottom-right-radius: 10px;
    }

    .unit-toggle .unit-btn.active {
        border-color: #1d4ed8;
    }

    .radio-toggle {
        flex-direction: column;
        gap: 8px;
    }

    .results-section {
        padding: 20px;
    }

    .egfr-big-number {
        font-size: 3rem;
    }

    .tab-nav {
        flex-wrap: nowrap;
    }

    .tab-btn {
        font-size: 0.78rem;
        padding: 12px 8px;
    }

    .tab-content {
        padding: 20px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
    }

    .mdcv2-print-btn,
    .mdcv2-share-btn {
        width: 100%;
    }

    .gauge-labels {
        font-size: 0.65rem;
    }
}
