/* ═══════════════════════════════════════════════════════════════
   FINANCIAL HEALTH QUICK-CHECK
   ═══════════════════════════════════════════════════════════════ */

.health-check-container {
    max-width: var(--container-max);
    margin: 0 auto var(--space-xl);
    padding: 0 var(--container-padding);
    box-sizing: border-box;
}

.health-check-card {
    display: block;
    width: 100%;
    max-width: 100%;
    text-align: left;
    cursor: pointer;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-lg) var(--space-xl);
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    font-family: inherit;
    color: var(--text-primary);
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
}

/* Top gradient accent bar */
.health-check-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.health-check-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.health-check-card:hover::before {
    opacity: 1;
}

.health-check-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.health-check-main {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.health-check-score-ring {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    transition: filter 0.3s ease;
}

.health-ring-svg {
    width: 100%;
    height: 100%;
}

.health-ring-bg {
    fill: none;
    stroke: var(--bg-secondary);
    stroke-width: 3.5;
}

.health-ring-fill {
    fill: none;
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dasharray 0.6s ease;
}

.health-ring-text {
    fill: var(--text-primary);
    font-size: 9px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
}

.health-check-info {
    flex: 1;
    min-width: 0;
}

.health-check-label {
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.health-check-summary {
    font-size: var(--text-body);
    color: var(--text-secondary);
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Details expand button */
.health-check-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: var(--space-sm);
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--primary);
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.health-check-card:hover .health-check-details-btn {
    opacity: 1;
}

.health-check-details-chevron {
    display: inline-block;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.health-check-card[aria-expanded="true"] .health-check-details-chevron {
    transform: rotate(180deg);
}

/* Breakdown (collapsible) */
.health-check-breakdown {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease, padding-top 0.3s ease;
    margin-top: 0;
    padding-top: 0;
}

.health-check-card[aria-expanded="true"] .health-check-breakdown {
    max-height: 300px;
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--glass-border);
}

.health-factor {
    display: grid;
    grid-template-columns: 100px 1fr auto auto;
    align-items: center;
    gap: var(--space-xs) var(--space-sm);
    padding: 8px 0;
}

.health-factor + .health-factor {
    border-top: 1px solid rgba(128, 128, 128, 0.1);
}

.health-factor-label {
    font-size: var(--text-caption);
    color: var(--text-secondary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.health-factor-bar-track {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.health-factor-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.health-factor-success { background: var(--success); box-shadow: 0 0 8px rgba(52, 199, 89, 0.3); }
.health-factor-warning { background: var(--warning); box-shadow: 0 0 8px rgba(255, 149, 0, 0.3); }
.health-factor-danger  { background: var(--danger);  box-shadow: 0 0 8px rgba(255, 59, 48, 0.3); }
.health-factor-neutral { background: var(--text-secondary); opacity: 0.4; }

.health-factor-value {
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    min-width: 40px;
    white-space: nowrap;
}

.health-factor-pts {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: right;
}

/* ── Level-specific styles ─────────────────────────────────── */

/* Good — green gradient background + top bar + ring glow */
.health-check-good {
    background: linear-gradient(135deg,
        rgba(52, 199, 89, 0.06) 0%,
        rgba(48, 209, 88, 0.03) 50%,
        rgba(0, 122, 255, 0.04) 100%);
    border-color: rgba(52, 199, 89, 0.2);
}
.health-check-good::before {
    background: linear-gradient(90deg, #34c759, #30d158, #0071e3);
}
.health-check-good .health-check-score-ring {
    filter: drop-shadow(0 0 12px rgba(52, 199, 89, 0.35));
}
.health-check-good:hover {
    border-color: rgba(52, 199, 89, 0.35);
}

/* Fair — amber gradient background + top bar + ring glow */
.health-check-fair {
    background: linear-gradient(135deg,
        rgba(255, 149, 0, 0.06) 0%,
        rgba(255, 204, 0, 0.03) 50%,
        rgba(175, 82, 222, 0.04) 100%);
    border-color: rgba(255, 149, 0, 0.2);
}
.health-check-fair::before {
    background: linear-gradient(90deg, #ff9500, #ffcc00, #af52de);
}
.health-check-fair .health-check-score-ring {
    filter: drop-shadow(0 0 12px rgba(255, 149, 0, 0.35));
}
.health-check-fair:hover {
    border-color: rgba(255, 149, 0, 0.35);
}

/* Needs Attention — red gradient background + top bar + ring glow */
.health-check-needs-attention {
    background: linear-gradient(135deg,
        rgba(255, 59, 48, 0.06) 0%,
        rgba(255, 149, 0, 0.03) 50%,
        rgba(175, 82, 222, 0.04) 100%);
    border-color: rgba(255, 59, 48, 0.2);
}
.health-check-needs-attention::before {
    background: linear-gradient(90deg, #ff3b30, #ff9500, #af52de);
}
.health-check-needs-attention .health-check-score-ring {
    filter: drop-shadow(0 0 12px rgba(255, 59, 48, 0.35));
}
.health-check-needs-attention:hover {
    border-color: rgba(255, 59, 48, 0.35);
}

/* ── Dark mode ─────────────────────────────────────────────── */
[data-theme="dark"] .health-check-card {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #2a2a2f;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .health-check-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .health-check-good {
    background: linear-gradient(135deg,
        rgba(52, 199, 89, 0.1) 0%,
        rgba(48, 209, 88, 0.05) 50%,
        rgba(0, 122, 255, 0.06) 100%);
    border-color: rgba(52, 199, 89, 0.15);
}

[data-theme="dark"] .health-check-fair {
    background: linear-gradient(135deg,
        rgba(255, 149, 0, 0.1) 0%,
        rgba(255, 204, 0, 0.05) 50%,
        rgba(175, 82, 222, 0.06) 100%);
    border-color: rgba(255, 149, 0, 0.15);
}

[data-theme="dark"] .health-check-needs-attention {
    background: linear-gradient(135deg,
        rgba(255, 59, 48, 0.1) 0%,
        rgba(255, 149, 0, 0.05) 50%,
        rgba(175, 82, 222, 0.06) 100%);
    border-color: rgba(255, 59, 48, 0.15);
}

/* ── Tablet ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .health-factor {
        grid-template-columns: 90px 1fr auto auto;
        gap: var(--space-xs);
    }

    .health-check-card {
        padding: var(--space-md) var(--space-lg);
    }

    .health-check-score-ring {
        width: 64px;
        height: 64px;
    }
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .health-factor {
        grid-template-columns: 70px 1fr auto;
        gap: 4px var(--space-xs);
    }

    .health-factor-pts {
        display: none;
    }

    .health-check-card {
        padding: var(--space-md);
    }

    .health-check-score-ring {
        width: 56px;
        height: 56px;
    }

    .health-check-main {
        gap: var(--space-md);
    }
}

@media (prefers-reduced-motion: reduce) {
    .health-ring-fill,
    .health-factor-bar,
    .health-check-breakdown,
    .health-check-card,
    .health-check-score-ring {
        transition: none;
    }
}


