/* =====================================================================
   Digital signage display board styles
   Designed for a TV / large monitor on the shop floor
   ===================================================================== */
html, body {
    margin: 0;
    padding: 0;
    background: #000;
    color: #fff;
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
}

.board {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: #111;
    border-bottom: 2px solid #333;
}
.board-header .title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 1px;
}
.board-header .time {
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    color: #ccc;
}

.columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    background: #222;
    overflow: hidden;
}

.col-wrap {
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
}

.col-header {
    padding: 14px 20px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
}
.col-pending  .col-header { background: #1e40af; }
.col-approved .col-header { background: #166534; }
.col-rejected .col-header { background: #991b1b; }

.col-body {
    overflow-y: auto;
    padding: 0;
}
.col-body::-webkit-scrollbar { width: 6px; }
.col-body::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }

.card-item {
    padding: 14px 20px;
    border-bottom: 1px solid #333;
    font-size: 18px;
}
.col-pending  .card-item { background: rgba(30,64,175,.12); }
.col-approved .card-item { background: rgba(22,101,52,.15); }
.col-rejected .card-item { background: rgba(153,27,27,.15); }

/* Overdue pending parts - pulsing red border + OVERDUE banner on top */
.card-item.overdue {
    background: rgba(220, 38, 38, 0.22) !important;
    border-left: 6px solid #ef4444;
    animation: overdue-pulse 2s ease-in-out infinite;
    padding-top: 0;
}
.card-item.overdue::before {
    content: 'OVERDUE';
    display: block;
    background: #dc2626;
    color: #fff;
    padding: 4px 12px;
    margin: 0 -20px 10px -20px;
    text-align: center;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 2px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.6);
}
@keyframes overdue-pulse {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0);    }
    50%      { box-shadow: inset 0 0 40px 0 rgba(239, 68, 68, 0.25); }
}

/* Admin "bumped to top" parts - amber banner. Takes precedence visually over overdue. */
.card-item.bumped {
    background: rgba(245, 158, 11, 0.22) !important;
    border-left: 6px solid #f59e0b;
    padding-top: 0;
    animation: none;
}
.card-item.bumped::before {
    content: '🚨 BUMPED TO TOP';
    display: block;
    background: #f59e0b;
    color: #0b0b0b;
    padding: 4px 12px;
    margin: 0 -20px 10px -20px;
    text-align: center;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 2px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.6);
}
/* If a submission is both overdue AND bumped, bumped wins (it's the more recent admin action) */
.card-item.bumped.overdue { background: rgba(245, 158, 11, 0.22) !important; border-left-color: #f59e0b; }
.card-item.bumped.overdue::before { content: '🚨 BUMPED TO TOP'; background: #f59e0b; color: #0b0b0b; }

.card-item .line1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 22px;
    margin-bottom: 6px;
}
.card-item .line1 .pn { color: #fff; }
.card-item .pri {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: 1px;
}
.card-item .pri.p1 { background: #7f1d1d; color: #fecaca; }
.card-item .pri.p2 { background: #78350f; color: #fed7aa; }
.card-item .pri.p3 { background: #1e3a8a; color: #dbeafe; }

.card-item .line2,
.card-item .line3 {
    font-size: 15px;
    color: #ccc;
    display: flex;
    justify-content: space-between;
}
.card-item .line2 strong,
.card-item .line3 strong { color: #fff; font-weight: 600; }
.card-item .reinspect {
    background: #d97706;
    color: #fff;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    margin-left: 6px;
}
.card-item .notes-badge {
    background: #0891b2;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

/* Live-ticking timer on each card. Default = neutral. */
.card-item .timer {
    font-variant-numeric: tabular-nums;
}
.card-item .timer .timer-value {
    color: #fff;
    font-weight: 700;
}
/* Attention threshold (30m+) - soft yellow */
.card-item .timer.timer-attention .timer-label,
.card-item .timer.timer-attention .timer-value {
    color: #fde047;
}
/* Approaching threshold (75%) - amber */
.card-item .timer.timer-warn .timer-label,
.card-item .timer.timer-warn .timer-value {
    color: #fbbf24;
}
/* Past threshold - red, pulsing */
.card-item .timer.timer-bad .timer-label,
.card-item .timer.timer-bad .timer-value {
    color: #f87171;
    animation: timer-pulse 1.5s ease-in-out infinite;
}
@keyframes timer-pulse {
    0%, 100% { opacity: 1;   }
    50%      { opacity: 0.6; }
}

/* Card-level flashing - aggressive enough to be seen across a shop floor.
   Pending only; rejected/approved are not time-critical in the same way.
   Selector uses .col-pending for higher specificity than the base tint. */

.col-pending .card-item.flash-attention {
    animation: card-flash-soft 1s steps(2, end) infinite;
    border-left: 6px solid #eab308;
}
.col-pending .card-item.flash-warn {
    animation: card-flash-hard 0.6s steps(2, end) infinite;
    border-left: 6px solid #f59e0b;
}

/* "steps(2)" makes the animation snap rather than fade, which is much
   more attention-grabbing than a smooth color transition on a big TV. */
@keyframes card-flash-soft {
    0%   { background: rgba(30, 64, 175, 0.12); }
    50%  { background: rgba(234, 179,   8, 0.65); }
    100% { background: rgba(30, 64, 175, 0.12); }
}
@keyframes card-flash-hard {
    0%   { background: rgba(30, 64, 175, 0.12); }
    50%  { background: rgba(245, 158,  11, 0.85); box-shadow: inset 0 0 40px rgba(245,158,11,0.5); }
    100% { background: rgba(30, 64, 175, 0.12); }
}

/* When flashing, also flash the timer text - and do it stronger */
.card-item.flash-attention .timer .timer-value,
.card-item.flash-attention .timer .timer-label {
    color: #fef08a;
    font-size: 18px;
}
.card-item.flash-warn .timer .timer-value,
.card-item.flash-warn .timer .timer-label {
    color: #fff;
    font-size: 18px;
    text-shadow: 0 0 8px rgba(0,0,0,0.6);
}

/* Once a card is bumped or overdue, those banners/animations take over -
   suppress the 30m/75% flash so we don't get competing animations. */
.card-item.overdue.flash-attention,
.card-item.overdue.flash-warn,
.card-item.bumped.flash-attention,
.card-item.bumped.flash-warn {
    animation: none;
    border-left-width: 6px;
}

.empty {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 18px;
}

.count {
    background: rgba(0,0,0,.4);
    padding: 2px 10px;
    border-radius: 999px;
    margin-left: 10px;
    font-size: 18px;
    vertical-align: middle;
}
