﻿/* ============================= */
/* BASE / BOOTSTRAP OVERRIDES    */
/* ============================= */

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* Bootstrap focus ring override */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin: 0;
}


/* ============================= */
/* MODERN APP LAYOUT (DESKTOP)   */
/* ============================= */

/* Whole app shell: sidebar + main column */
.app-shell {
    min-height: 100vh;
    display: flex;
    background: #f6f7fb;
}

/* Sidebar (desktop baseline) */
.app-sidebar {
    width: 270px;
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    /* Needed for mobile overlay stacking (harmless on desktop) */
    z-index: 999;
}

/* Sidebar brand/header block */
.app-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px 8px 16px 8px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.12);
    margin-bottom: 16px;
}

.logo-box {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(226, 232, 240, 0.12);
    display: grid;
    place-items: center;
}

.logo-placeholder {
    font-weight: 800;
    letter-spacing: 0.5px;
}

.brand-title {
    font-weight: 800;
    font-size: 16px;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 12px;
    opacity: 0.75;
}


/* ============================= */
/* NAV (SIDEBAR)                 */
/* ============================= */

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

/* Section headers like Warehouse / Staff / Office / Admin */
.nav-section {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    padding: 0 8px;
    margin: 10px 0 6px 0;
}

/* Individual nav links */
.app-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #e2e8f0;
    text-decoration: none;
    background: transparent;
    position: relative;
    transition: background-color 0.15s ease;
}

    .app-nav .nav-item:hover {
        background: rgba(226, 232, 240, 0.10);
    }

    /* Bootstrap icons sizing/opacity */
    .app-nav .nav-item i {
        font-size: 1.05rem;
        opacity: 0.9;
    }

    /* Active link highlight */
    .app-nav .nav-item.active {
        background: rgba(59, 130, 246, 0.18);
        border: 1px solid rgba(59, 130, 246, 0.35);
    }

    /* Animated active indicator bar (left side) */
    .app-nav .nav-item::before {
        content: "";
        position: absolute;
        left: -6px;
        top: 8px;
        bottom: 8px;
        width: 4px;
        border-radius: 4px;
        background: #3b82f6;
        transform: scaleY(0);
        transition: transform 0.2s ease;
    }

    .app-nav .nav-item.active::before {
        transform: scaleY(1);
    }

/* Group wrapper for collapsible nav sections on mobile */
.nav-group {
    margin-top: 10px;
}


/* ============================= */
/* APP MAIN COLUMN               */
/* ============================= */

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Top header bar */
.app-header {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
}

/* Makes burger + title align nicely when burger is shown */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title {
    font-weight: 800;
    font-size: 16px;
    color: #0f172a;
}

.app-content {
    padding: 18px;
}

.app-footer {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}


/* ============================= */
/* MOBILE NAV GROUP COLLAPSE     */
/* (this is your existing JS/CSS */
/*  for nav sections on mobile)  */
/* ============================= */

@media (max-width: 768px) {

    .nav-section {
        cursor: pointer;
        user-select: none;
    }

    /* hide group items until opened */
    .nav-group-items {
        display: none;
        margin-left: 6px;
    }

    .nav-group.open .nav-group-items {
        display: block;
    }

    /* little chevron arrow */
    .nav-section::after {
        content: "▸";
        margin-left: auto;
        transition: transform 0.2s ease;
        opacity: 0.85;
    }

    .nav-group.open .nav-section::after {
        transform: rotate(90deg);
    }

    /* Slightly tighter padding on mobile content */
    .app-content {
        padding: 12px;
    }
}


/* ============================= */
/* OFF-CANVAS SIDEBAR (MOBILE)   */
/* ============================= */

/* Hamburger button: hidden on desktop by default */
.app-burger {
    display: none;
    font-size: 1.4rem;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 10px;
}

/* Full-screen overlay behind the sidebar (tap to close) */
.app-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 998;
    /* nicer fade */
    opacity: 0;
    transition: opacity 180ms ease;
}

/* Mobile behaviour: turn sidebar into sliding drawer */
@media (max-width: 768px) {

    /* Show hamburger only on mobile */
    .app-burger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /*
      Sidebar becomes a fixed off-canvas panel.
      IMPORTANT: we keep your existing background/padding/etc from .app-sidebar,
      and only override positioning + transform here.
    */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        /* drawer width on mobile */
        width: 280px;
        max-width: 85vw;
        /* start hidden off-screen */
        transform: translateX(-105%);
        transition: transform 220ms ease;
        will-change: transform;
    }

    /* When the body has this class, the drawer slides in */
    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    /* Show overlay when sidebar is open */
    body.sidebar-open .app-overlay {
        display: block;
        opacity: 1;
    }

    /* Prevent background scroll while drawer is open (optional but feels right) */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Desktop: overlay never shows */
@media (min-width: 769px) {
    .app-overlay {
        display: none !important;
    }
}


/* ============================= */
/* WAREHOUSE BIG SCREEN (TV UI)  */
/* (unchanged from your file)    */
/* ============================= */

/* ---------- Warehouse Big Screen ---------- */
.wh-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #0f172a;
    color: #e2e8f0;
    margin-bottom: 16px;
}

.wh-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wh-logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: rgba(226, 232, 240, 0.12);
    display: grid;
    place-items: center;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.wh-title {
    font-size: 18px;
    font-weight: 900;
    line-height: 1.1;
}

.wh-subtitle {
    font-size: 12px;
    opacity: 0.8;
}

.wh-pill {
    background: rgba(226, 232, 240, 0.12);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
}

.wh-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(420px, 1fr));
    gap: 14px;
}

/* Card */
.wh-card {
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.wh-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f8fafc;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.wh-job-title {
    font-weight: 900;
    color: #0f172a;
}

.wh-job-subtitle {
    font-size: 12px;
    color: rgba(15, 23, 42, 0.7);
}

/* Status badges */
.wh-badge {
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
    border: 1px solid transparent;
}

.wh-badge-live {
    background: rgba(34, 197, 94, 0.15);
    color: #166534;
    border-color: rgba(34, 197, 94, 0.25);
}

.wh-badge-ready {
    background: rgba(245, 158, 11, 0.18);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.28);
}

/* Table */
.wh-table thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(15, 23, 42, 0.65);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.wh-table tbody td {
    padding-top: 10px;
    padding-bottom: 10px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

/* LIVE row highlight */
.wh-row-live {
    background: rgba(59, 130, 246, 0.10);
}

.wh-live-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.15);
    vertical-align: middle;
    margin-right: 8px;
}

.wh-live-text {
    font-weight: 900;
}

/* Time badges */
.wh-time {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 12px;
    border: 1px solid transparent;
}

.wh-time-ok {
    background: rgba(34, 197, 94, 0.15);
    color: #166534;
    border-color: rgba(34, 197, 94, 0.25);
}

.wh-time-warn {
    background: rgba(245, 158, 11, 0.18);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.28);
}

.wh-time-over {
    background: rgba(239, 68, 68, 0.15);
    color: #7f1d1d;
    border-color: rgba(239, 68, 68, 0.25);
}

.wh-time-none {
    background: rgba(100, 116, 139, 0.12);
    color: #334155;
    border-color: rgba(100, 116, 139, 0.22);
}

.wh-remaining {
    font-size: 12px;
    color: rgba(15, 23, 42, 0.65);
}

/* Big TV scaling */
@media (min-width: 1400px) {
    .wh-grid {
        grid-template-columns: repeat(3, minmax(420px, 1fr));
    }

    .wh-title {
        font-size: 20px;
    }

    .wh-table tbody td {
        font-size: 14px;
    }
}

/* Progress bars */
.wh-job-progress {
    padding: 10px 14px;
    background: #ffffff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.wh-job-progress-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.wh-job-progress-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(15, 23, 42, 0.65);
    font-weight: 800;
}

.wh-job-progress-val {
    font-weight: 900;
    color: #0f172a;
}

.wh-bar {
    height: 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.wh-bar-sm {
    height: 8px;
}

.wh-bar-fill {
    height: 100%;
    border-radius: 999px;
}

.wh-bar-ok {
    background: rgba(34, 197, 94, 0.85);
}

.wh-bar-warn {
    background: rgba(245, 158, 11, 0.9);
}

.wh-bar-over {
    background: rgba(239, 68, 68, 0.85);
}

.wh-bar-over {
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}



/* TV friendly typography vars */
:root {
    --tv-scale: 1rem;
    --tv-scale-lg: 1.25rem;
    --tv-scale-xl: 1.6rem;
}
body.tv-mode #tvToggleBtn {
    border-color: #22c55e;
    color: #22c55e;
}

/* ONLY enlarge text when TV mode is enabled */
body.warehouse-screen.tv-mode {
    font-size: var(--tv-scale);
    line-height: 1.35;
    --tv-scale: clamp(1.1rem, 1.4vw, 1.6rem);
    --tv-scale-lg: clamp(1.4rem, 2vw, 2.4rem);
    --tv-scale-xl: clamp(1.8rem, 2.8vw, 3.2rem);
}

.wh-title {
    font-size: var(--tv-scale-xl);
    font-weight: 700;
    letter-spacing: 0.3px;
}

.wh-subtitle {
    font-size: calc(var(--tv-scale) * 0.95);
    opacity: 0.85;
}

.wh-pill {
    font-size: calc(var(--tv-scale) * 0.95);
    padding: 10px 18px;
}

.wh-job-title {
    font-size: var(--tv-scale-lg);
    font-weight: 700;
}

.wh-job-subtitle {
    font-size: calc(var(--tv-scale) * 0.95);
    opacity: 0.85;
}

.wh-job-progress-label {
    font-size: calc(var(--tv-scale) * 0.9);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.wh-job-progress-val {
    font-size: var(--tv-scale-lg);
    font-weight: 700;
}

.wh-table th {
    font-size: calc(var(--tv-scale) * 0.85);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.75;
}

.wh-table td {
    font-size: var(--tv-scale);
    vertical-align: middle;
}

.wh-time {
    font-size: calc(var(--tv-scale) * 0.95);
    font-weight: 600;
}

.wh-remaining {
    font-size: calc(var(--tv-scale) * 0.9);
    opacity: 0.85;
}

.wh-live-text {
    font-size: calc(var(--tv-scale) * 0.9);
    font-weight: 700;
    letter-spacing: 0.08em;
}

.wh-live-dot {
    width: 12px;
    height: 12px;
}

.wh-bar {
    height: 14px;
}

.wh-bar-sm {
    height: 10px;
}
/* Expanding job detail row */
.job-panel-row td {
    background: #fff;
}

.job-panel-inner {
    padding-left: 36px;
}
/* lines up under chevron button */

/* Ensure main content text uses normal (dark) colour */
.app-main,
.app-main .app-content {
    color: #0f172a;
}

/* Ensure tables in content are readable even if sidebar styles leak */
.app-content table,
.app-content .table {
    color: #0f172a;
}

/* ===== Job status pills (dashboards) ===== */
.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
    border: 1px solid transparent;
    line-height: 1.2;
}

/* Planned */
.status-planned {
    background: rgba(100, 116, 139, 0.12);
    color: #334155;
    border-color: rgba(100, 116, 139, 0.22);
}

/* Ready */
.status-ready {
    background: rgba(245, 158, 11, 0.18);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.28);
}

/* In progress */
.status-live {
    background: rgba(34, 197, 94, 0.15);
    color: #166534;
    border-color: rgba(34, 197, 94, 0.25);
}

/* Completed */
.status-done {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.22);
}

/* ===== Step row colouring (detail panel) ===== */
.step-row-ok {
    background: rgba(34, 197, 94, 0.10);
}

.step-row-warn {
    background: rgba(245, 158, 11, 0.12);
}

.step-row-over {
    background: rgba(239, 68, 68, 0.10);
}

    .step-row-ok td,
    .step-row-warn td,
    .step-row-over td {
        border-top-color: rgba(15, 23, 42, 0.06);
    }
/* ===== Step row colouring (detail panel) ===== */
.step-row-ok {
    background: rgba(34, 197, 94, 0.10);
}
/* on/under target */
.step-row-warn {
    background: rgba(245, 158, 11, 0.12);
}
/* slightly over */
.step-row-over {
    background: rgba(239, 68, 68, 0.10);
}
    /* well over */

    .step-row-ok td,
    .step-row-warn td,
    .step-row-over td {
        border-top-color: rgba(15, 23, 42, 0.06);
    }
.bg-purple {
    background-color: #6f42c1;
    color: #fff;
}
.wh-live-dot-big {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 10px;
    vertical-align: middle;
    background: #22c55e; /* green */
    box-shadow: 0 0 0 0 rgba(34,197,94,.6);
    opacity: .9;
}

    .wh-live-dot-big.wh-live-on {
        animation: whPulse 1.2s ease-in-out infinite;
    }

    .wh-live-dot-big.wh-live-warn {
        background: #f59e0b; /* amber */
        box-shadow: 0 0 0 0 rgba(245,158,11,.6);
        animation: whPulse .6s ease-in-out infinite;
    }

    .wh-live-dot-big.wh-live-offline {
        background: #94a3b8; /* grey */
        box-shadow: none;
        animation: none;
        opacity: .35;
    }

@keyframes whPulse {
    0% {
        transform: scale(.85);
        box-shadow: 0 0 0 0 rgba(34,197,94,.6);
    }

    70% {
        transform: scale(1.25);
        box-shadow: 0 0 0 10px rgba(34,197,94,0);
    }

    100% {
        transform: scale(.85);
        box-shadow: 0 0 0 0 rgba(34,197,94,0);
    }
}
