/*
 * report-fitness.css — MyBest24 Fitness Panel Styles
 *
 * 2-column exercise layout — COPIED from report-food.css and report-activity.css:
 *
 *   report-food.css pattern:
 *     .report-food-chart-section { display:flex; flex-direction:row; ... }
 *     .report-food-icon-col { flex-shrink:0; width:48px; ... }
 *     .report-food-chart-content { flex:1; min-width:0; }
 *
 *   report-activity.css pattern:
 *     .report-activity-section-wrap { display:flex; flex-direction:row; ... }
 *     .report-activity-icon-col { flex-shrink:0; width:48px; ... }
 *     .report-activity-section-content { flex:1; min-width:0; }
 *
 *   Fitness exercise rows copy this exactly as:
 *     .fitness-exercise-row (wrapper)
 *     .fitness-exercise-icon-col (left)
 *     .fitness-exercise-content (right)
 *
 * Weekly top reuses .report-activity-section-wrap and .report-activity-icon-col
 * directly from report-activity.css — no re-definition needed.
 */


/* ── Panel body ───────────────────────────────────────────────────────────── */

/* stage.css sets max-height: 70vh — match it as a min-height so the panel
   top stays anchored when daily content is sparse (e.g. rest day, empty state).
   dvh excludes iOS Safari browser chrome. Same fix as #food-panel. */
#fitness-panel .stage-panel-body {
    padding-bottom: 56px;
    min-height: 70vh;
    min-height: 70dvh;
}


/* ── Daily: ring row ──────────────────────────────────────────────────────── */

.fitness-ring-row {
    display: flex;
    justify-content: center;
    padding: 16px 0 8px;
}

/* Ring size override: 80px (matches stage.css expanded mode ring).
   Default stage-ring-wrap is 44×44; fitness panel uses larger ring as focal point. */
.fitness-main-ring-cell .stage-ring-wrap { width: 80px; height: 80px; }
.fitness-main-ring-cell .stage-ring-svg  { width: 80px; height: 80px; }
.fitness-main-ring-cell .stage-ring-icon { width: 32px; height: 32px; }
.fitness-main-ring-cell .stage-ring-hours { font-size: 1rem; font-weight: 700; }
.fitness-main-ring-cell .stage-ring-label { font-size: 0.75rem; }

.fitness-ring-done-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-color);
    text-align: center;
    margin-top: 2px;
}


/* ── Empty state ──────────────────────────────────────────────────────────── */

.fitness-empty-state { padding: 14px 0 6px; }
.fitness-empty-text  { font-size: 0.88rem; color: var(--text-muted, rgba(255,255,255,0.5)); margin: 0; }


/* ── ─────────────────────────────────────────────────────────────────────── ──
   2-COLUMN EXERCISE LAYOUT
   Copied from report-food.css (.report-food-chart-section, .report-food-icon-col,
   .report-food-chart-content) and report-activity.css (.report-activity-section-wrap,
   .report-activity-icon-col, .report-activity-section-content).
   ── ─────────────────────────────────────────────────────────────────────── */

.fitness-exercises-list { display: flex; flex-direction: column; }

/* Row wrapper — mirrors .report-food-chart-section and .report-activity-section-wrap */
.fitness-exercise-row {
    display: flex;
    flex-direction: row;   /* ← the key rule that makes icons appear LEFT of text */
    align-items: flex-start;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.fitness-exercise-row:first-child { border-top: none; }

/* Left icon column — mirrors .report-food-icon-col and .report-activity-icon-col.
   No padding-top (food/activity add padding to align with bar chart headers;
   exercise rows don't have a section title above the icon). */
.fitness-exercise-icon-col {
    display: flex;
    flex-shrink: 0;        /* ← prevents column from collapsing */
    width: 64px;           /* wider than 48px in food/activity: exercise icons are 64px */
    align-items: flex-start;
    justify-content: center;
}

/* Right content column — mirrors .report-food-chart-content and
   .report-activity-section-content */
.fitness-exercise-content {
    flex: 1;
    min-width: 0;          /* ← prevents text from overflowing narrow panels */
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Title row: exercise name + optional duration */
.fitness-exercise-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.fitness-section-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main, #fff);
    line-height: 1.2;
    overflow-wrap: break-word;
    word-break: break-word;
}

.fitness-section-time {
    font-size: 0.72rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
}

.fitness-section-duration {
    font-size: 0.75rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
    white-space: nowrap;
    flex-shrink: 0;
}


/* ── Progress bar ─────────────────────────────────────────────────────────── */

.fitness-progress-wrap { display: flex; align-items: center; gap: 8px; }
.fitness-progress-track { flex: 1; height: 5px; background: rgba(255,255,255,0.10); border-radius: 3px; overflow: hidden; }
.fitness-progress-fill {
    height: 100%; background: var(--accent-color); border-radius: 3px;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.fitness-progress-fill--pulse { animation: fitnessPulse 2s ease-in-out infinite; }
@keyframes fitnessPulse { 0%,100% { opacity:1; } 50% { opacity:0.45; } }
@media (prefers-reduced-motion: reduce) {
    .fitness-progress-fill { transition: none; }
    .fitness-progress-fill--pulse { animation: none; }
}
.fitness-progress-label { font-size: 0.71rem; color: var(--text-muted, rgba(255,255,255,0.5)); white-space: nowrap; flex-shrink: 0; }


/* ── Goal / Log sub-blocks ────────────────────────────────────────────────── */

.fitness-section-block { display: flex; flex-direction: column; gap: 5px; }
.fitness-section-sub-label { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted, rgba(255,255,255,0.45)); }
.fitness-goal-pills { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fitness-goal-pill { display: inline-flex; align-items: center; background: color-mix(in srgb, var(--accent-color, #46a5ce) 16%, transparent); border: 1px solid var(--accent-color, #46a5ce); color: var(--accent-color, #46a5ce); border-radius: 16px; padding: 3px 9px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.fitness-goal-pill--default { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.18); color: var(--text-muted, rgba(255,255,255,0.45)); font-style: italic; }
.fitness-goal-last-session { font-size: 0.63rem; color: var(--text-muted, rgba(255,255,255,0.35)); font-style: italic; }
.fitness-log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.fitness-log-entry { font-size: 0.78rem; color: var(--text-muted, rgba(255,255,255,0.6)); line-height: 1.4; }
.fitness-log-more  { font-size: 0.72rem; color: var(--accent-color); list-style: none; }


/* ── Weekly horizontal bar chart ──────────────────────────────────────────── */
/* Each row: [day label 44px] | [bar + icons below, flex:1] | [duration 54px]  */

.fitness-hbar-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 0 6px;
}

.fitness-hbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fitness-hbar-label {
    flex-shrink: 0;
    width: 44px;
    font-size: 0.72rem;
    color: var(--text-muted, rgba(255,255,255,0.6));
    text-align: right;
    line-height: 1.2;
}

.fitness-hbar-row--today .fitness-hbar-label {
    color: var(--accent-color);
    font-weight: 700;
}

.fitness-hbar-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fitness-hbar-track {
    height: 18px;
    background: color-mix(in srgb, var(--accent-color) 14%, transparent);
    border-radius: 5px;
    overflow: hidden;
}

.fitness-hbar-track--empty {
    border: 1px solid color-mix(in srgb, var(--accent-color) 30%, transparent);
    background: transparent;
    overflow: visible;
}

.fitness-hbar-row--today .fitness-hbar-track:not(.fitness-hbar-track--empty) {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-color) 60%, transparent);
}

.fitness-hbar-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 5px;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.fitness-hbar-fill--over {
    background: color-mix(in srgb, var(--accent-color) 55%, white);
}

@media (prefers-reduced-motion: reduce) { .fitness-hbar-fill { transition: none; } }

/* Icons row sits directly under its bar — visually tied to it */
.fitness-hbar-icons {
    display: flex;
    justify-content: center; /* aligns REST DAY + multi-icon rows to the same center */
    gap: 4px;
    align-items: center;
    flex-wrap: nowrap;
}

.fitness-hbar-icon      { image-rendering: pixelated; flex-shrink: 0; display: block; }
.fitness-hbar-icon-more { font-size: 0.7rem; color: var(--text-muted, rgba(255,255,255,0.5)); line-height: 1; }

.fitness-hbar-duration {
    flex-shrink: 0;
    width: 54px;
    font-size: 0.72rem;
    color: var(--text-muted, rgba(255,255,255,0.6));
    text-align: right;
    white-space: nowrap;
    line-height: 1.3;
}

.fitness-hbar-over {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-color);
}


/* ── Weekly day list ──────────────────────────────────────────────────────── */

.fitness-week-list { display: flex; flex-direction: column; margin-top: 16px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.fitness-week-day { border-top: 1px solid rgba(255,255,255,0.07); }
.fitness-week-day-header { display: flex; align-items: center; width: 100%; padding: 11px 0; background: none; border: none; cursor: pointer; gap: 8px; color: var(--text-main, #fff); text-align: left; -webkit-tap-highlight-color: transparent; }
.fitness-week-day-label  { flex: 1; font-size: 0.85rem; font-weight: 600; }
.fitness-week-day-total  { font-size: 0.78rem; color: var(--text-muted, rgba(255,255,255,0.5)); flex-shrink: 0; }
.fitness-week-day-chevron { font-size: 1.8rem; line-height: 1; color: var(--text-muted, rgba(255,255,255,0.4)); transition: transform 0.18s; flex-shrink: 0; padding: 0 4px; }
.fitness-week-day-header[aria-expanded="true"]  .fitness-week-day-chevron { transform: rotate(180deg); }
.fitness-week-day-header[aria-expanded="false"] + .fitness-week-day-body  { display: none; }
.fitness-week-day-body { padding-bottom: 12px; }
.fitness-rest-day { font-size: 0.82rem; color: var(--text-muted, rgba(255,255,255,0.4)); font-style: italic; padding: 6px 0; }


/* ── Multicolor: fitness icons in panel ───────────────────────────────────── */
body.mode-multicolor #fitness-panel .fitness-exercise-icon,
body.mode-multicolor #fitness-panel .fitness-hbar-icon {
    filter: var(--filter-type-fitness, var(--icon-accent-filter)) !important;
}


/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .fitness-exercise-icon-col { width: 52px; }
    .fitness-section-label { font-size: 0.84rem; }
    .fitness-goal-pill { font-size: 0.72rem; }
}


/* ── Cally row — expanded view padding ──────────────────────────────────────
   In the 600px expanded panel, the Cally bubble and sprite go edge-to-edge.
   Adding horizontal padding gives the bubble breathing room on the left and
   the sprite room on the right, matching the screenshot. */

#fitness-panel.stage-panel-expanded .stage-cally-row {
    padding-left: 100px;
    padding-right: 100px;
}