/* ========== WorkoutPage.kt ========== */

/* Page shell — full viewport height flex column so the video can absorb all free space. */
.workout-page-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* During workout, the TopBar's only job is navigation access (menu).
   The exercise name already dominates the content shell — showing it again in the
   bar is redundant noise. Scope this override so shared TopBar.kt stays unchanged. */
.workout-page-shell .top-bar-title {
    display: none;
}

/* Video — flex: 1 so it fills everything between the TopBar and the controls section.
   object-fit: contain letterboxes any aspect ratio (landscape or portrait) cleanly.
   position: relative needed for the paused overlay. */
.workout-video-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    background: #111111;
    display: flex;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Paused overlay — dims the video and shows a PAUSED label so the user always knows
   the workout state, even if they look away and back. pointer-events: none so clicks
   pass through to the play button below. */
.workout-paused-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.workout-paused-label {
    color: rgba(255, 255, 255, 0.88);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.22em;
}

.workout-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #111111;
}

.workout-video-placeholder {
    width: 100%;
    height: 100%;
    background: #1a1a1a;
}

/* Content column — mirrors WorkoutScreen.kt's Column(widthIn(max=600dp)).
   border-top bridges the hard cut between the dark video and the white shell. */
.workout-screen-shell {
    max-width: 600px;
    margin: 0 auto;
    padding: 6px 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    box-sizing: border-box;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

@media (max-width: 599px) {
    .workout-screen-shell {
        margin-top: auto;
    }
}

/* Exercise name — toUpperCase(Locale.current), titleMedium bold, 18sp, centered. */
.workout-screen-exercise-name {
    font-size: 18px;
    font-weight: 800;
    color: #2e2c28;
    text-align: center;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 4px 0 2px;
    width: 100%;
}

/* Next exercise row — "Next: ExerciseName" centered. */
.workout-screen-next-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0;
    width: 100%;
}

/* "Next:" rendered as a dim uppercase eyebrow label so the eye goes straight to
   the exercise name, not the word "Next". */
.workout-screen-next-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(46, 44, 40, 0.38);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.workout-screen-next-value {
    font-size: 14px;
    color: rgba(46, 44, 40, 0.7);
}

.workout-screen-last-exercise {
    font-size: 14px;
    color: rgba(46, 44, 40, 0.5);
    font-style: italic;
    margin: 0;
    text-align: center;
}

/* Timer row — 3-column grid: left spacer | timer (centred) | chip.
   Using a grid instead of position:absolute so the chip never overlaps the timer
   regardless of screen width. */
.workout-screen-timer-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    margin: 4px 0 2px;
}

@media (max-width: 599px) {
    .workout-screen-timer-row {
        column-gap: 12px;
    }
}

/* displaySmall typography — 36sp in Material3 = 36px on 1× web display. We use 52px to
   compensate for the same density difference that makes 40px buttons feel right here. */
.workout-screen-timer {
    grid-column: 2;
    font-size: 52px;
    font-weight: 900;
    color: #2e2c28;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -0.02em;
}

@media (max-width: 599px) {
    .workout-screen-timer {
        font-size: 44px;
    }
}

/* Low-time urgency — fires at ≤ 10 s to give the user a peripheral warning to
   prepare for the next exercise. Amber-orange is the cross-app convention (Peloton,
   Apple Fitness+) for countdown urgency; gentle pulse keeps it noticeable but calm. */
.workout-screen-timer-urgent {
    color: #c9540a;
    animation: timer-urgent-pulse 0.9s ease-in-out infinite;
}

@keyframes timer-urgent-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* TooHardChip — Surface + border toggle, 3rd grid column (right). */
.workout-too-hard-chip {
    grid-column: 3;
    justify-self: end;
    border-radius: 9999px;
    border: 1px solid rgba(46, 44, 40, 0.28);
    background: transparent;
    color: rgba(46, 44, 40, 0.55);
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.workout-too-hard-chip:hover {
    background: rgba(46, 44, 40, 0.06);
}

.workout-too-hard-chip-active {
    background: rgba(0, 106, 142, 0.1);
    border-color: transparent;
    color: #006a8e;
}

.workout-too-hard-chip-active:hover {
    background: rgba(0, 106, 142, 0.16);
}

/* Controls — Previous | Pause/Play | Skip centred row. */
.workout-screen-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 4px 0 6px;
    gap: 0;
}

/* Previous / Skip: icon + text label, 100px wide. Previous is right-aligned, Skip left-aligned,
   matching Compose's ClickableIconButton(horizontalArrangement=End/Start). */
.workout-control-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(46, 44, 40, 0.6);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    border-radius: 8px;
    transition: background-color 0.15s ease;
    box-sizing: border-box;
}

.workout-control-btn:first-child {
    justify-content: flex-end;
}

.workout-control-btn:last-child {
    justify-content: flex-start;
}

.workout-control-btn:hover:not(:disabled) {
    background: rgba(46, 44, 40, 0.06);
}

.workout-control-btn-disabled {
    color: rgba(46, 44, 40, 0.22);
    cursor: default;
}

/* Play/Pause: large circle icon, 54×54px tap area on desktop, 72×72px on mobile.
   72px matches the MD3 FAB size — the recommended spec for the single highest-priority
   action on a screen. Larger target is important during exercise with sweaty hands. */
.workout-play-pause-btn {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(46, 44, 40, 0.8);
    border-radius: 50%;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
    margin: 0 8px;
    padding: 0;
}

.workout-play-pause-btn:hover {
    background: rgba(46, 44, 40, 0.06);
}

@media (max-width: 599px) {
    .workout-screen-controls {
        margin: 8px 0 10px;
    }
    .workout-play-pause-btn {
        width: 72px;
        height: 72px;
        margin: 0 12px;
    }
    /* CSS overrides the SVG width/height attributes so the icon scales with the button. */
    .workout-play-pause-btn svg {
        width: 64px;
        height: 64px;
    }
    /* Bump secondary icons slightly so they don't feel tiny next to a 72px play button. */
    .workout-control-btn svg {
        width: 32px;
        height: 32px;
    }
}

/* ── Section progress ───────────────────────────────────────────────────────

   Two variants rendered simultaneously; CSS shows exactly one per breakpoint,
   matching WorkoutSectionProgress.kt's isPortrait branch. */

/* Compact dots — small screens (< 600px) */
.workout-section-progress-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 4px 16px 0;
    box-sizing: border-box;
}

@media (min-width: 600px) {
    .workout-section-progress-compact { display: none; }
}

.workout-section-dots-row {
    display: flex;
    align-items: center;
}

.workout-section-dot {
    border-radius: 50%;
    flex-shrink: 0;
}

.workout-section-dot-completed {
    width: 13px;
    height: 13px;
    background: rgba(0, 106, 142, 0.4);
}

.workout-section-dot-current {
    width: 18px;
    height: 18px;
    background: #006a8e;
}

.workout-section-dot-upcoming {
    width: 13px;
    height: 13px;
    background: rgba(0, 106, 142, 0.25);
}

.workout-section-connector {
    width: 32px;
    height: 2px;
    background: rgba(0, 106, 142, 0.25);
    flex-shrink: 0;
}

.workout-section-connector-filled {
    background: #006a8e;
}

.workout-section-label {
    font-size: 12px;
    font-weight: 600;
    color: #006a8e;
    margin: 5px 0 0;
    text-align: center;
}

/* Wide pills — large screens (≥ 600px) */
.workout-section-progress-wide {
    display: none;
    width: 100%;
    padding: 4px 24px 0;
    box-sizing: border-box;
}

@media (min-width: 600px) {
    .workout-section-progress-wide { display: flex; justify-content: center; }
}

.workout-section-pills-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    max-width: 100%;
}

.workout-section-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 400;
    max-width: 160px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workout-section-pill-completed {
    background: rgba(0, 106, 142, 0.12);
    color: #006a8e;
    font-weight: 600;
}

.workout-section-pill-current {
    background: #006a8e;
    color: #ffffff;
    font-weight: 700;
}

.workout-section-pill-upcoming {
    background: rgba(46, 44, 40, 0.07);
    color: rgba(46, 44, 40, 0.4);
}

.workout-section-pill-connector {
    width: 20px;
    height: 2px;
    background: rgba(0, 106, 142, 0.25);
    flex-shrink: 0;
    margin: 0 4px;
}

/* Quit section — thin separator creates a visual break before a destructive action,
   reducing the chance of accidental tap right after interacting with section dots. */
.workout-quit-section {
    width: 100%;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(46, 44, 40, 0.07);
    display: flex;
    justify-content: center;
}

.workout-quit-btn {
    color: rgba(46, 44, 40, 0.45);
    font-size: 13px;
}

.workout-quit-btn:hover {
    color: rgba(46, 44, 40, 0.7);
}

/* Heavy feedback toast — fixed bottom-center, matches Compose inverseSurface snackbar style. */
.workout-heavy-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: #2e2c28;
    color: #f5f5f0;
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 200;
    white-space: nowrap;
    animation: workout-toast-in 0.2s ease;
}

@keyframes workout-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
