/* Shared coaching components for the logger and progression page. */
:root {
    --coach: #7fffe8;
    --coach-soft: rgba(127, 255, 232, 0.06);
    --coach-border: rgba(127, 255, 232, 0.5);
    --coach-radius: 0;
    --coach-space: 20px;
}

.training-coach-shell { display: grid; gap: var(--coach-space); min-width: 0; }
.coach-heading { font-family: 'Bebas Neue', Impact, sans-serif; font-size: 2rem; line-height: 1.15; letter-spacing: 1px; overflow-wrap: anywhere; }
.coach-caption, .coach-rule-label { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.6; }
.coach-section { padding: var(--coach-space); border: 1px solid var(--border); border-radius: var(--coach-radius); background: var(--bg-secondary); min-width: 0; }
.coach-prescription { border-color: var(--coach-border); border-left: 3px solid var(--coach); background: var(--coach-soft); }
.coach-prescription[data-action="reduce"], .coach-prescription[data-action="setup"], .coach-prescription[data-action="incomplete"], .coach-prescription[data-action="return"] { border-left-color: var(--warning); }
.coach-action { color: var(--coach); font-size: 0.85rem; line-height: 1.5; font-weight: 700; }
.coach-weight { font-family: 'Bebas Neue', Impact, sans-serif; font-size: clamp(2.8rem, 7vw, 3.8rem); line-height: 1.1; margin: 12px 0; }
.coach-weight.coach-instruction { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.coach-set-target { font-size: 1rem; line-height: 1.6; }
.coach-reason { font-size: 0.9rem; line-height: 1.65; margin-top: 12px; overflow-wrap: anywhere; }
.coach-section-title { font-family: 'Bebas Neue', Impact, sans-serif; font-size: 1.3rem; letter-spacing: 1px; margin: 0 0 12px; }
.coach-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
.coach-rule-value { font-size: 0.9rem; line-height: 1.6; margin-top: 6px; }
.coach-disclosure { border-top: 1px solid var(--border); padding-top: 8px; }
.coach-disclosure summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-size: 0.9rem; line-height: 1.5; color: var(--text-primary); }
.coach-disclosure p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.7; margin-top: 12px; }
.coach-evidence { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 12px; }
.coach-evidence th, .coach-evidence td { padding: 12px 6px; text-align: left; border-bottom: 1px solid var(--border); }
.coach-evidence th { color: var(--text-secondary); font-size: 0.8rem; font-weight: normal; }
.coach-history-row { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.coach-history-row strong { display: block; font-size: 0.85rem; margin-bottom: 6px; }
.coach-season-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 14px 0; }
.coach-season-facts dt { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; margin-bottom: 6px; }
.coach-season-facts dd { font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.coach-live-status { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.coach-live-status strong { display: block; font-size: 0.9rem; margin-bottom: 4px; }
.coach-live-status[data-status="increase"] strong { color: var(--success); }
.coach-primary-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; margin-top: 16px; font-size: 0.85rem; font-family: 'Space Mono', monospace; cursor: pointer; color: var(--coach); background: var(--bg-secondary); border: 1px solid var(--coach-border); text-align: center; }
.coach-primary-link:hover { border-color: var(--coach); background: var(--bg-tertiary); }
.btn-coach { padding: 4px 10px; font-size: 0.77rem; background: var(--coach-soft); border: 1px solid var(--coach-border); color: var(--coach); font-family: 'Space Mono', monospace; cursor: pointer; transition: color 0.2s, background-color 0.2s, border-color 0.2s; text-transform: uppercase; letter-spacing: 1px; width: 100%; }
.btn-coach:hover { background: var(--bg-secondary); border-color: var(--coach); }
.btn-coach.achieved { border-color: var(--success); color: var(--success); background: rgba(0, 255, 136, 0.06); }

.exercise-coach-status { display: block; font-size: 0.8rem; line-height: 1.5; margin-top: 6px; color: var(--text-secondary); }
.exercise-coach-status[data-status="increase"] { color: var(--success); }
.coach-dialog-header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); z-index: 1; }
.coach-dialog-header .modal-title { margin: 0; }
.coach-dialog-header .btn { flex: 0 0 auto; min-height: 44px; }
#trainingPlanModal .modal { padding: 0; width: min(720px, calc(100vw - 32px)); max-width: 720px; max-height: 88vh; overflow-x: hidden; }
#trainingPlanModalContent { padding: 24px; }
#trainingPlanModal .modal-title:focus { outline: none; }
.coach-disclosure summary:focus-visible, .btn-coach:focus-visible, .coach-primary-link:focus-visible, .coach-dialog-header .btn:focus-visible { outline: 2px solid var(--coach); outline-offset: 4px; }
.training-plan-chart-plan { stroke: var(--text-secondary); }
.training-plan-chart { height: auto; }
.training-plan-chart-label { fill: var(--text-secondary); font-family: 'Space Mono', monospace; font-size: 16px; }
.training-plan-legend { color: var(--text-secondary); font-size: 0.8rem; }
.training-plan-legend .actual::before { background: var(--text-primary); }
.training-plan-legend .planned::before { background: var(--text-secondary); }

@media (max-width: 600px) {
    :root { --coach-space: 16px; }
    #trainingPlanModal .modal { width: 100%; max-width: 100%; max-height: 100vh; max-height: 100dvh; height: 100vh; height: 100dvh; border: 0; }
    .coach-dialog-header { padding: 12px 16px; }
    #trainingPlanModalContent { padding: 16px; }
    .coach-rules { grid-template-columns: 1fr; gap: 16px; }
    .coach-season-facts { grid-template-columns: 1fr; }
    .coach-season-facts > div { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .coach-season-facts dt { margin: 0; }
    .training-plan-chart-label { font-size: 32px; }
}

@media (max-width: 360px) {
    .training-plan-chart-label { font-size: 36px; }
}

.exercise-coach-status[hidden], #coachNextWeight[hidden], #coachOtherLifts[hidden] { display: none; }
.training-plan-chart-dot { fill: var(--text-primary); }

/* Keep prose readable while retaining the logger's display type and numeric styling. */
#trainingPlanModal {
    --coach-body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#trainingPlanModal :is(.coach-reason, .coach-caption, .coach-rule-label, .coach-rule-value,
    .coach-disclosure p, .coach-disclosure summary, .coach-season-facts dt,
    .coach-set-note, .coach-chart-note, .training-plan-chart-empty, .training-plan-legend) {
    font-family: var(--coach-body-font);
}
#trainingPlanModal .coach-reason { font-size: 1rem; line-height: 1.65; }
#trainingPlanModal .coach-disclosure p { font-size: 0.95rem; }
#trainingPlanModal .coach-caption { font-size: 0.95rem; }
#trainingPlanModal .coach-section { background: var(--bg-secondary); }
#trainingPlanModal .coach-prescription { background: var(--coach-soft); }
.coach-set-chart { display: grid; gap: 12px; margin: 18px 0; }
.coach-set-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 82px; column-gap: 12px; row-gap: 4px; align-items: center; font-size: 0.8rem; }
.coach-set-result { text-align: right; }
.coach-set-load { grid-column: 2; }
.coach-set-status { grid-column: 3; text-align: right; }
.coach-rep-track { position: relative; height: 12px; background: var(--bg-tertiary); }
.coach-rep-fill { display: block; height: 100%; width: var(--rep-fill); background: var(--coach); }
.coach-set-row[data-state="below"] .coach-rep-fill { background: var(--warning); }
.coach-set-row[data-state="missing"] .coach-rep-track { border: 1px dashed var(--text-secondary); }
.coach-rep-marker { position: absolute; left: var(--rep-marker); top: -3px; bottom: -3px; border-left: 2px solid var(--text-primary); }
.coach-set-note, .coach-chart-note { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }
#trainingPlanModal .training-plan-chart-card { padding: 0; border: 0; background: transparent; margin-top: 16px; }
#trainingPlanModal .training-plan-chart-actual { stroke: var(--coach); }
#trainingPlanModal .training-plan-chart-dot { fill: var(--coach); }
#trainingPlanModal .training-plan-legend .actual::before { background: var(--coach); }
#trainingPlanModal .training-plan-chart-label { font-family: var(--coach-body-font); }
@media (max-width: 600px) {
    .coach-set-row { grid-template-columns: 42px minmax(0, 1fr) 74px; column-gap: 8px; font-size: 0.75rem; }
}
