/* SONNY Dashboard — Health Tab v1 */

/* ── Loading ─────────────────────────────────────────────── */
.health-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}
.health-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout Rows & Cols ──────────────────────────────────── */
.health-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}
.health-col {
    flex: 1;
    min-width: 0;
}
.health-col-cards {
    flex: 2;
}
.health-col-gauge {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.health-col-sleep {
    flex: 1;
    max-width: 320px;
}
.health-col-trends {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.health-col-full {
    flex: 1;
}

/* ── Panels ──────────────────────────────────────────────── */
.health-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.health-panel-title {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.health-panel-body {
    padding: 14px;
}
.health-panel-chart {
    padding: 10px 14px;
    height: 200px;
    position: relative;
}

/* ── Metric Cards ────────────────────────────────────────── */
.health-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.health-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    transition: border-color 0.2s, transform 0.15s;
}
.health-card:hover {
    transform: translateY(-2px);
}
.health-card.good { border-color: var(--green); }
.health-card.warn { border-color: var(--yellow); }
.health-card.bad  { border-color: var(--red); }
.health-card.neutral { border-color: var(--border); }

.health-card-icon {
    font-size: 18px;
    margin-bottom: 4px;
}
.health-card-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}
.health-card.good .health-card-value { color: var(--green); }
.health-card.warn .health-card-value { color: var(--yellow); }
.health-card.bad .health-card-value  { color: var(--red); }

.health-card-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.health-card-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Fitness Age ─────────────────────────────────────────── */
.fitness-age-display {
    text-align: center;
    padding: 8px 0;
}
.fitness-age-number {
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
}
.fitness-age-number.good { color: var(--green); }
.fitness-age-number.bad  { color: var(--red); }
.fitness-age-number.neutral { color: var(--text-primary); }
.fitness-age-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.fitness-age-diff {
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
}
.fitness-age-diff.good { color: var(--green); }
.fitness-age-diff.bad  { color: var(--red); }

.fitness-age-target {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.fitness-age-target-label {
    font-size: 11px;
    color: var(--text-secondary);
}
.fitness-age-target-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.fitness-components {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.fitness-comp-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 11px;
}
.fitness-comp-label { color: var(--text-secondary); }
.fitness-comp-value { color: var(--text-primary); font-weight: 500; }

/* ── Intensity Ring ──────────────────────────────────────── */
.intensity-ring-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto;
}
.intensity-ring {
    width: 100%;
    height: 100%;
}
.intensity-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.intensity-ring-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.intensity-ring-label {
    font-size: 10px;
    color: var(--text-secondary);
}
.intensity-breakdown {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ── Sleep Times ─────────────────────────────────────────── */
.sleep-times {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Empty States ────────────────────────────────────────── */
.health-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}
.health-empty-small {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* ── Compact Data Table ──────────────────────────────────── */
.data-table-compact {
    font-size: 12px;
}
.data-table-compact th {
    font-size: 11px;
    padding: 6px 10px;
}
.data-table-compact td {
    padding: 5px 10px;
}

/* ── Mobile Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
    .health-row {
        flex-direction: column;
    }
    .health-row-top {
        flex-direction: column;
    }
    .health-col-sleep {
        max-width: 100%;
    }
    .health-col-gauge {
        flex-direction: row;
    }
    .health-cards {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    .health-card {
        padding: 10px 6px;
    }
    .health-card-value {
        font-size: 18px;
    }
    .health-panel-chart {
        height: 180px;
    }
    .fitness-age-number {
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    .health-col-gauge {
        flex-direction: column;
    }
    .health-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
