/* =====================================================
   Cardiothoracic Theatre Viewer
   features.css
   -----------------------------------------------------
   Styles for the newer features, kept separate from the
   original styles.css so that file stays untouched:
     - ON CALL NOW hero card
     - My Week overlay
     - dark mode
     - TV / wall-board mode

   This file is loaded on its own by tv.html (no styles.css),
   so it declares its own copy of the shared palette tokens -
   same values as styles.css, kept in sync by hand.
   ===================================================== */

:root{
    --nhs-blue:#2563EB;
    --nhs-dark:#1E3A8A;
    --ink:#212B32;
    --ink-soft:#4C6272;
    --line:#E1E6EA;
    --oncall:#1D4ED8;
    --radius:12px;
}

@media (prefers-reduced-motion: reduce) {
    .now-pulse { animation: none !important; }
}

/* ------------------------------------------------------
   ON CALL NOW hero card
   ------------------------------------------------------ */

.oncall-now {
    margin: 14px auto 4px;
    max-width: 720px;
    border-radius: var(--radius);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    border: 1px solid transparent;
}

.now-active {
    background: var(--oncall);
    color: #fff;
    box-shadow: 0 4px 14px rgba(218,41,28,.25);
}

.now-upcoming {
    background: #fff;
    border-color: var(--line);
    color: var(--ink);
}

.now-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .07em;
    white-space: nowrap;
}

.now-pulse {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #fff;
    animation: nowpulse 1.2s ease-out infinite;
}

@keyframes nowpulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.7); }
    100% { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
}

.now-people { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.now-person { font-size: 16px; font-weight: 700; }
.now-anaes  { font-size: 14px; font-weight: 600; opacity: .9; }
.now-cicu   { font-size: 14px; font-weight: 600; opacity: .9; }
.now-surgeon { font-size: 14px; font-weight: 600; opacity: .9; }
.now-session, .now-extra { font-size: 12px; font-weight: 700; }
.now-fromhome {
    background: rgba(255,255,255,.22);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}
.now-upcoming .now-fromhome { background: #FBF0E4; color: #B45F00; }

/* ------------------------------------------------------
   My Week overlay
   ------------------------------------------------------ */

#myWeekOverlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 40, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.myweek-card {
    background: #fff;
    color: var(--ink);
    border-radius: var(--radius);
    padding: 20px 22px;
    width: min(440px, 100%);
    max-height: 84vh;
    overflow-y: auto;
    box-shadow: 0 12px 34px rgba(33,43,50,.22);
}

.myweek-card h2 { margin: 0 0 4px; font-size: 18px; }
.myweek-hint { margin: 0 0 14px; color: var(--ink-soft); font-size: 13px; }

.myweek-names { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.myweek-name {
    font: inherit;
    font-weight: 700;
    font-size: 13.5px;
    padding: 8px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}
.myweek-name:hover { border-color: var(--nhs-blue); color: var(--nhs-blue); }

.myweek-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.myweek-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #F4F6F8;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13.5px;
}

.myweek-oncall { background: #FBEAE8; }

.myweek-day  { font-weight: 700; width: 38px; color: var(--nhs-blue); flex: none; }
.myweek-what { font-weight: 600; }

.myweek-actions { display: flex; justify-content: space-between; gap: 10px; }

.myweek-close, .myweek-switch {
    font: inherit;
    font-weight: 700;
    font-size: 13.5px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}
.myweek-close { background: var(--nhs-blue); border-color: var(--nhs-blue); color: #fff; }

/* Toolbar buttons for My Week / TV / dark mode */
.feature-btn {
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
    transition: transform .1s ease, border-color .15s ease, color .15s ease;
}
.feature-btn:hover { border-color: var(--nhs-blue); color: var(--nhs-blue); }
.feature-btn:active { transform: scale(.96); }

.feature-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 2px;
}

/* ------------------------------------------------------
   Day-jump strip
   ------------------------------------------------------
   Deliberately small (compact pills, one slim row, no
   wrapping at phone width) and NOT pinned - it scrolls
   away with the hero, so it costs no permanent screen
   space the way a sticky strip would.
   ------------------------------------------------------ */

.day-jump {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 12px 0 2px;
    padding: 0 16px;
}

.day-jump-pill {
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--ink-soft);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 0;
    width: 46px;
    flex: none;
    cursor: pointer;
    transition: transform .1s ease, border-color .15s ease, color .15s ease, background .15s ease;
}

.day-jump-pill:hover {
    border-color: var(--nhs-blue);
    color: var(--nhs-blue);
}

.day-jump-pill:active {
    transform: scale(.94);
}

.day-jump-pill.is-today {
    background: var(--nhs-blue);
    border-color: var(--nhs-blue);
    color: #fff;
}

html[data-theme="dark"] .day-jump-pill {
    background: #1B2430;
    color: #93A1B1;
    border-color: #3A4656;
}
html[data-theme="dark"] .day-jump-pill.is-today {
    background: var(--nhs-blue);
    color: #fff;
}

@media (max-width: 400px) {
    .day-jump-pill {
        width: auto;
        flex: 1;
        padding: 6px 2px;
        font-size: 10px;
    }
}

/* ------------------------------------------------------
   Dark mode
   ------------------------------------------------------
   Toggled by setting data-theme="dark" on <html>. Uses
   broad overrides so the original styles.css stays as-is.
   ------------------------------------------------------ */

html[data-theme="dark"] body { background: #10161f; color: #E4E9EF; }

html[data-theme="dark"] .card,
html[data-theme="dark"] .theatre-card,
html[data-theme="dark"] .dashboard-panel,
html[data-theme="dark"] .weekend-card,
html[data-theme="dark"] .myweek-card {
    background: #1B2430;
    color: #E4E9EF;
    box-shadow: 0 2px 10px rgba(0,0,0,.5);
}

html[data-theme="dark"] .card-body { color: #E4E9EF; }
html[data-theme="dark"] .info,
html[data-theme="dark"] .day-date,
html[data-theme="dark"] .weekend-title,
html[data-theme="dark"] .oncall-anaesthetist,
html[data-theme="dark"] .oncall-cicu,
html[data-theme="dark"] .oncall-surgeon,
html[data-theme="dark"] .oncall-role-label,
html[data-theme="dark"] .oncall-role-extra,
html[data-theme="dark"] .rota-row-label,
html[data-theme="dark"] .rota-row-extra { color: #93A1B1; }

html[data-theme="dark"] .rota-card-body,
html[data-theme="dark"] .rota-row { color: #E4E9EF; }
html[data-theme="dark"] .rota-row { border-bottom-color: #2A3542; }

html[data-theme="dark"] .daySection { border-top-color: #2A3542; }

/* The full-week redesign's "today" highlight needs its own dark-mode
   wash (brighter, since a near-invisible 5% light-blue tint over a
   near-black page reads as nothing) - and, for the weekend cards
   specifically, has to out-specificity the "keep it invisible" dark-
   mode fix below or that rule's plain `background: transparent` wins. */
html[data-theme="dark"] .daySection.day-today {
    background: linear-gradient(180deg, rgba(37,99,235,.22), transparent 120px);
}
html[data-theme="dark"] .weekend-card.day-today {
    background: linear-gradient(180deg, rgba(37,99,235,.22), transparent 120px);
}

html[data-theme="dark"] .day-header { background: #10161f; }

html[data-theme="dark"] .day-tab,
html[data-theme="dark"] .feature-btn,
html[data-theme="dark"] .myweek-name,
html[data-theme="dark"] .myweek-switch,
html[data-theme="dark"] #weekSelect {
    background: #1B2430;
    color: #E4E9EF;
    border-color: #3A4656;
}

/* The week-picker arrows keep their filled accent look in dark mode too
   - without this they fell back to the same flat card tone as the
   dropdown next to them and stopped reading as buttons. */
html[data-theme="dark"] .week-picker-body .nav-arrow {
    background: var(--nhs-blue);
    color: #fff;
    border-color: transparent;
}
html[data-theme="dark"] .week-picker-body .nav-arrow:hover {
    background: var(--nhs-dark);
}

html[data-theme="dark"] .day-tab.active { background: var(--nhs-blue); color: #fff; }
html[data-theme="dark"] .myweek-row { background: #232E3C; }
html[data-theme="dark"] .myweek-oncall { background: #3A2022; }
html[data-theme="dark"] .myweek-hint { color: #93A1B1; }
html[data-theme="dark"] footer { background: #0B1017; color: #93A1B1; }
html[data-theme="dark"] .now-upcoming { background: #2A2115; border-color: #ED8B00; color: #FFD9A0; }

/* ------------------------------------------------------
   TV / wall-board mode
   ------------------------------------------------------ */

body.tv {
    margin: 0;
    min-height: 100vh;
    background: #0B1017;
    color: #E4E9EF;
    font-family: Arial, -apple-system, "Segoe UI", Helvetica, sans-serif;
    display: flex;
    flex-direction: column;
}

.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 34px;
    background: #003087;
    color: #fff;
}

.tv-header h1 { margin: 0; font-size: 34px; }
.tv-header p  { margin: 4px 0 0; font-size: 20px; color: #B8D4F0; }

.tv-clock {
    font-size: 58px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.tv-oncall {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 26px;
    flex-wrap: wrap;
    padding: 16px 30px;
    background: #3A2022;
    font-size: 26px;
}

/* Hardcoded rather than var(--oncall) - the wall board keeps its own
   colour coding regardless of the daily dashboard's neutral theme. */
.tv-oncall-active { background: #DA291C; }

.tv-oncall-label  { font-weight: 800; letter-spacing: .06em; }
.tv-oncall-people { font-weight: 700; }

#tvGrid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    padding: 26px 34px;
    align-content: start;
}

.tv-card { background: #1B2430; border-radius: 16px; overflow: hidden; }
.tv-wide { grid-column: 1 / -1; }

.tv-card-head {
    background: #005EB8;
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: .05em;
    padding: 12px 18px;
}

.tv-card-body { padding: 14px 18px; }

.tv-line { font-size: 26px; font-weight: 700; padding: 4px 0; }
.tv-list { color: #7FDBFF; font-size: 21px; }
.tv-dim  { color: #5B6B7D; }

.tv-empty {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 30px;
    color: #5B6B7D;
    padding: 60px 0;
}

.tv-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 34px;
    background: #003087;
    color: #B8D4F0;
    font-size: 16px;
}

@media (max-width: 1100px) { #tvGrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { #tvGrid { grid-template-columns: 1fr; } .tv-clock { font-size: 40px; } }

/* Dark-mode fix: the weekend day wrapper was picking up a card
   background, drawing a faint box around each day's cards. It's a
   layout container, not a card - keep it invisible. */
html[data-theme="dark"] .weekend-card {
    background: transparent;
    box-shadow: none;
    border: none;
}

/* Dark-mode fix: the Full Week View button kept its light styling */
html[data-theme="dark"] .full-week-view {
    background: #1B2430;
    border-color: #3A4656;
    color: #E4E9EF;
}
html[data-theme="dark"] .full-week-view h3 { color: #7FB8E8; }
html[data-theme="dark"] .full-week-view p  { color: #93A1B1; }
/* Discreet exit from the wall board - needed on phones/PWA where
   there's no browser back button */
.tv-back {
    color: #B8D4F0;
    text-decoration: none;
    font-weight: 700;
}
.tv-back:hover { color: #fff; }

/* ------------------------------------------------------
   TV wall-board fact ticker
   ------------------------------------------------------
   A "did you know" banner that slides in, holds, slides
   out, then cycles to the next fact - a screensaver-style
   loop through Theatre Intelligence's fact pool.
   ------------------------------------------------------ */

.tv-ticker {
    /* Hardcoded rather than var(--nhs-dark) - see .tv-oncall-active. */
    background: #003087;
    padding: 16px 40px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
}

.tv-ticker-text {
    display: inline-block;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .6s ease, transform .6s ease;
}

.tv-ticker-text.show {
    opacity: 1;
    transform: translateY(0);
}
