/**
 * Add Video theme – same as theme-test with YouTube fullscreen background.
 * Only applied when body has .theme-test and this stylesheet is loaded.
 */

/* ---- YouTube fullscreen background ---- */
.yt-bg-wrap {
    display: none;
}
body.theme-test .yt-bg-wrap {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}
body.theme-test .yt-bg-wrap iframe {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    z-index: 1 !important;
    transform: translate(-50%, -50%) scale(1.12) !important;
    width: max(100vw, 177.78vh) !important;
    height: max(100vh, 56.25vw) !important;
    min-width: 100% !important;
    min-height: 100% !important;
    border: none !important;
    pointer-events: none !important;
}
body.theme-test .yt-bg-poster {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    background-position: center !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    transform: scale(1.04) !important;
    opacity: 1 !important;
    transition: opacity 0.9s ease !important;
    pointer-events: none !important;
}
body.theme-test .yt-bg-poster.is-hidden {
    opacity: 0 !important;
}
/* Mobile: use device-width so it matches even with viewport width=1200 + zoom */
@media screen and (max-device-width: 768px) {
    body.theme-test .yt-bg-wrap {
        min-height: 130vh !important;
        height: 130vh !important;
    }
    body.theme-test .yt-bg-wrap iframe {
        transform: translate(-50%, -50%) scale(1.5) !important;
    }
}
@media screen and (max-width: 768px) {
    /* Mobile: disable heavy YouTube background for smoother performance. */
    body.theme-test .yt-bg-wrap {
        display: none !important;
        min-height: 120vh !important;
        height: 120vh !important;
    }

    body.theme-test .yt-bg-wrap iframe {
        transform: translate(-50%, -50%) scale(1.35) !important;
    }
    body.theme-test .modern-order-card,
    body.theme-test .modern-order-card.order-card-accent-odd,
    body.theme-test .modern-order-card.order-card-accent-even {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    }
    body.theme-test .modern-order-card:hover,
    body.theme-test .modern-order-card.order-card-accent-odd:hover,
    body.theme-test .modern-order-card.order-card-accent-even:hover {
        transform: none !important;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1) !important;
    }
}

/* Force desktop-style layout on mobile for main orders page theme. */
@media screen and (max-width: 900px) {
    body.theme-test {
        overflow-x: auto !important;
    }

    body.theme-test .container {
        width: 1200px !important;
        min-width: 1200px !important;
        max-width: none !important;
        margin: 0 auto !important;
        padding: 0 12px !important;
    }

    body.theme-test .header-content {
        flex-direction: row !important;
        text-align: left !important;
        gap: 20px !important;
    }

    body.theme-test .filters {
        grid-template-columns: 2fr 1fr 1fr !important;
    }

    body.theme-test .order-card-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    body.theme-test .position-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }

    body.theme-test .workers-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
        gap: 8px !important;
    }

    body.theme-test .modern-worker-item {
        padding: 10px 12px !important;
        font-size: 1rem !important;
    }

    body.theme-test .worker-name {
        font-size: 1rem !important;
    }
}
body.theme-test .yt-bg-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(15, 23, 42, 0.25) !important;
    pointer-events: none !important;
    z-index: 3 !important;
}
body.theme-test .container {
    position: relative !important;
    z-index: 1 !important;
}

/* ---- Base & typography ---- */
body.theme-test {
    color: #0d0d0d;
    background: #0f172a !important;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
}

body.theme-test .container {
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

/* Header & title */
body.theme-test .header {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%) !important;
    border-bottom: 3px solid #1a252f;
}

body.theme-test .title {
    color: #fff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

body.theme-test .theme-test-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 10px;
    font-size: 0.5em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #e74c3c;
    color: #fff;
    border-radius: 6px;
    vertical-align: middle;
}

/* ---- Buttons: larger tap targets, higher contrast ---- */
body.theme-test .btn,
body.theme-test button.btn,
body.theme-test .port-lookup-btn,
body.theme-test a.btn {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 12px 20px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    border-width: 2px !important;
    border-style: solid !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

body.theme-test .btn-primary {
    background: #2980b9 !important;
    border-color: #1a5276 !important;
    color: #fff !important;
}

body.theme-test .btn-primary:hover {
    background: #3498db !important;
    border-color: #2980b9 !important;
}

/* ---- Inputs & selects ---- */
body.theme-test input[type="text"],
body.theme-test input[type="number"],
body.theme-test select {
    min-height: 44px !important;
    padding: 10px 14px !important;
    font-size: 17px !important;
    border: 2px solid #bdc3c7 !important;
    border-radius: 6px !important;
    background-color: #fff !important;
    color: #0d0d0d !important;
}

body.theme-test input:focus,
body.theme-test select:focus {
    outline: 2px solid #3498db !important;
    outline-offset: 2px !important;
    border-color: #3498db !important;
}

body.theme-test .search-box input,
body.theme-test .port-lookup-box input {
    min-height: 44px !important;
}

/* ---- Focus visibility (accessibility) ---- */
body.theme-test *:focus-visible {
    outline: 2px solid #3498db !important;
    outline-offset: 2px !important;
}

body.theme-test .clickable:focus-visible,
body.theme-test a:focus-visible,
body.theme-test button:focus-visible {
    outline: 2px solid #3498db !important;
    outline-offset: 2px !important;
}

/* ---- Stats cards ---- */
body.theme-test .stat-card {
    border: 2px solid #dfe6e9 !important;
    background: #fff !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

body.theme-test .stat-card.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
    border-color: #5b6fd8 !important;
}

body.theme-test .stat-card .stat-value {
    color: #0d0d0d !important;
}

body.theme-test .stat-card.primary .stat-value,
body.theme-test .stat-card.primary .stat-label,
body.theme-test .stat-card.primary .stat-icon {
    color: #ffffff !important;
}

body.theme-test .stat-number {
    color: #0d0d0d !important;
    font-weight: 800 !important;
    font-size: 1.75rem !important;
}

body.theme-test .stat-label {
    color: #1a1a1a !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
}

/* ---- Order cards: clean distinction (which order is which) ---- */
body.theme-test .orders-cards-grid {
    gap: 32px !important;
    padding: 28px !important;
    background: #f1f5f9 !important;
}

body.theme-test .modern-order-card {
    padding: 24px !important;
    border-radius: 16px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 10px 28px rgba(0, 0, 0, 0.08) !important;
    margin-bottom: 0 !important;
}

body.theme-test .modern-order-card::after {
    display: none !important;
}

body.theme-test .modern-order-card.order-card-accent-odd {
    border-left: 6px solid #dc2626 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(220, 38, 38, 0.12) !important;
}

body.theme-test .modern-order-card.order-card-accent-even {
    border-left: 6px solid #2563eb !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(37, 99, 235, 0.12) !important;
}

body.theme-test .modern-order-card::before {
    left: 24px !important;
    top: 24px !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    border: none !important;
    background: #64748b !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

body.theme-test .modern-order-card.order-card-accent-odd::before {
    background: #dc2626 !important;
    box-shadow: 0 2px 10px rgba(220, 38, 38, 0.35) !important;
}

body.theme-test .modern-order-card.order-card-accent-even::before {
    background: #2563eb !important;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35) !important;
}

body.theme-test .modern-order-card:hover {
    transform: translateY(-2px) !important;
}

body.theme-test .modern-order-card.order-card-accent-odd:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08), 0 20px 44px rgba(220, 38, 38, 0.15) !important;
}

body.theme-test .modern-order-card.order-card-accent-even:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08), 0 20px 44px rgba(37, 99, 235, 0.15) !important;
}

body.theme-test .order-card-header {
    margin: -24px -24px 20px -24px !important;
    padding: 12px 20px 16px 78px !important;
    border-bottom: 2px solid #e2e8f0 !important;
    border-radius: 12px 12px 0 0 !important;
    min-height: 56px !important;
}

body.theme-test .modern-order-card.order-card-accent-odd .order-card-header {
    background: rgba(220, 38, 38, 0.06) !important;
    border-bottom-color: rgba(220, 38, 38, 0.25) !important;
}

body.theme-test .modern-order-card.order-card-accent-even .order-card-header {
    background: rgba(37, 99, 235, 0.06) !important;
    border-bottom-color: rgba(37, 99, 235, 0.25) !important;
}

body.theme-test .order-number-badge {
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    color: #fff !important;
    padding: 10px 18px !important;
    border-radius: 10px !important;
    border: none !important;
}

body.theme-test .modern-order-card.order-card-accent-odd .order-number-badge {
    background: #dc2626 !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3) !important;
}

body.theme-test .modern-order-card.order-card-accent-even .order-number-badge {
    background: #2563eb !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3) !important;
}

body.theme-test .company-name {
    color: #0d0d0d !important;
    font-weight: 800 !important;
    font-size: 1.25rem !important;
}

body.theme-test .modern-order-card.order-card-accent-odd .company-name {
    border-left-color: #dc2626 !important;
    background: rgba(220, 38, 38, 0.06) !important;
}

body.theme-test .modern-order-card.order-card-accent-even .company-name {
    border-left-color: #2563eb !important;
    background: rgba(37, 99, 235, 0.06) !important;
}

body.theme-test .modern-order-card.order-card-accent-odd .positions-section {
    background: rgba(220, 38, 38, 0.02) !important;
    border-top-color: rgba(220, 38, 38, 0.2) !important;
}

body.theme-test .modern-order-card.order-card-accent-even .positions-section {
    background: rgba(37, 99, 235, 0.02) !important;
    border-top-color: rgba(37, 99, 235, 0.2) !important;
}

body.theme-test .location-info,
body.theme-test .time-info,
body.theme-test .updated-info {
    color: #1a1a1a !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
}

/* ---- Worker items & badges ---- */
body.theme-test .modern-worker-item {
    border: 2px solid #d5dbdb !important;
    border-radius: 8px !important;
    padding: 12px 14px !important;
}

body.theme-test .worker-name {
    font-weight: 700 !important;
    color: #0d0d0d !important;
    font-size: 1rem !important;
}

body.theme-test .seniority-badge {
    font-weight: 800 !important;
    font-size: 0.95rem !important;
    padding: 5px 12px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
}

body.theme-test .port-number {
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    color: #1a1a1a !important;
}

/* Keep seniority badge + port on one line (no wrap/cut off) */
body.theme-test .seniority-and-port {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

body.theme-test .replaced-worker-seniority .seniority-and-port,
body.theme-test .replacement-worker-seniority .seniority-and-port {
    flex-shrink: 0 !important;
}

/* ---- Status badges ---- */
body.theme-test .worker-status {
    font-weight: 600 !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* ---- Last updated ---- */
body.theme-test .last-updated {
    color: #2c3e50 !important;
    background: #f8f9fa !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
}

/* ---- Filters row ---- */
body.theme-test .filters-row select {
    min-height: 44px !important;
    font-weight: 500 !important;
}

/* ---- Mobile: ensure tap targets ---- */
@media screen and (max-width: 768px) {
    body.theme-test .workers-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
        gap: 8px !important;
    }

    body.theme-test .btn,
    body.theme-test button,
    body.theme-test .port-lookup-btn,
    body.theme-test a.btn {
        min-height: 48px !important;
        padding: 14px 18px !important;
        font-size: 16px !important;
    }

    body.theme-test .search-box,
    body.theme-test .port-lookup-box {
        margin-bottom: 12px !important;
    }

    body.theme-test input,
    body.theme-test select {
        min-height: 48px !important;
        font-size: 16px !important;
    }

    body.theme-test .modern-order-card::before {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
        left: 14px !important;
        top: 14px !important;
    }
}

/* ---- Error & loading ---- */
body.theme-test .error-message {
    border: 2px solid #e74c3c !important;
    background: #fadbd8 !important;
    color: #1a1a1a !important;
    font-weight: 600 !important;
}

body.theme-test .loading p {
    font-weight: 600 !important;
    color: #2c3e50 !important;
}

/* ---- Extra readability improvements ---- */

/* Base line-height for all text */
body.theme-test,
body.theme-test .container,
body.theme-test .main {
    line-height: 1.5 !important;
}

body.theme-test .modern-order-card,
body.theme-test .order-main-info,
body.theme-test .positions-section {
    line-height: 1.55 !important;
}

/* Section headers: "Positions (N)", "Labor Orders (N total)" */
body.theme-test .positions-title,
body.theme-test .orders-header h2 {
    font-size: 1.2rem !important;
    font-weight: 800 !important;
    color: #0d0d0d !important;
    letter-spacing: 0.02em !important;
}

body.theme-test .position-time {
    font-weight: 700 !important;
    color: #1a1a1a !important;
}

/* Gang group headers */
body.theme-test .gang-group-header {
    font-size: 1rem !important;
    font-weight: 600 !important;
}

/* Placeholder text: darker so hints are readable */
body.theme-test input::placeholder {
    color: #444 !important;
    opacity: 1;
}

/* Small labels: "Replaced:", "Replacement:", timestamps */
body.theme-test small,
body.theme-test .replacement-time,
body.theme-test .port-number {
    color: #2c3e50 !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
}

/* Order notes and ship info */
body.theme-test .order-note,
body.theme-test .company-note,
body.theme-test .updated-info {
    color: #2c3e50 !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
}

/* Port-wide note / alert: high contrast */
body.theme-test .order-note.portwide-note {
    background: #fee !important;
    border: 2px solid #c0392b !important;
    color: #1a1a1a !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    padding: 14px 16px !important;
    line-height: 1.5 !important;
}

/* Called out status: very visible */
body.theme-test .worker-status.status-called-out {
    background: #c0392b !important;
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    padding: 6px 12px !important;
    border: 2px solid #922b21 !important;
}

/* Position cards: clearer border */
body.theme-test .modern-position-card {
    border: 2px solid #d5dbdb !important;
    background: transparent !important;
}

/* Position names (GROUNDMAN SHIP, COMBO SHIP, TOPMAN, etc.): stand out from background */
body.theme-test .position-header {
    background: rgba(255, 255, 255, 0.22) !important;
    margin: -12px -12px 10px -12px !important;
    padding: 10px 12px !important;
    border-radius: 6px 6px 0 0 !important;
    border-left: 4px solid #2980b9 !important;
}
body.theme-test .position-name {
    font-weight: 800 !important;
    font-size: 1.05rem !important;
    color: #0d0d0d !important;
    letter-spacing: 0.03em !important;
    text-transform: uppercase !important;
}

body.theme-test .ship-info,
body.theme-test .ship-info strong {
    color: #1a1a1a !important;
    font-weight: 600 !important;
}


/* Modals: high-contrast text */
body.theme-test .worker-orders-modal .modal-content,
body.theme-test .port-lookup-modal .modal-content,
body.theme-test .worker-orders-modal h3,
body.theme-test .port-lookup-modal h3 {
    color: #1a1a1a !important;
}

body.theme-test .worker-orders-modal .work-order-content,
body.theme-test .port-lookup-content {
    color: #2c3e50 !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

/* Pending / no results messages */
body.theme-test .no-positions,
body.theme-test .no-workers {
    color: #2c3e50 !important;
    font-size: 1.05rem !important;
    font-weight: 500 !important;
}

/* Position count badge in header */
body.theme-test .position-count {
    font-weight: 700 !important;
    font-size: 1rem !important;
    color: #1a1a1a !important;
}

/* Replaced/replacement blocks: clearer labels */
body.theme-test .replaced-worker-seniority small,
body.theme-test .replacement-worker-seniority small {
    color: #2c3e50 !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
}

body.theme-test .replacement-name {
    color: #1a5276 !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
}

/* ----------------------------------------------------------------
   Mobile worker-card wrapping fix (masonry / narrow columns)
   Theme-test's rules at L440 force `.seniority-and-port` to nowrap
   and `.worker-name` to font-size 1rem, which in 120px masonry
   columns clips names and port numbers. On mobile, let everything
   inside `.modern-worker-item` wrap and stop the card's own
   overflow:hidden from clipping the content.
   Specificity uses body.theme-test.theme-test (repeated) + 3 classes
   so nothing inside this file or in styles.css can outrank it.
---------------------------------------------------------------- */
@media (max-width: 900px) {
    body.theme-test.theme-test .workers-grid .modern-worker-item,
    body.theme-test.theme-test .modern-worker-item {
        overflow: visible !important;
    }
    body.theme-test.theme-test .workers-grid .modern-worker-item .worker-name,
    body.theme-test.theme-test .workers-grid .modern-worker-item .position-name,
    body.theme-test.theme-test .workers-grid .modern-worker-item .company-name,
    body.theme-test.theme-test .workers-grid .modern-worker-item .replacement-name,
    body.theme-test.theme-test .workers-grid .modern-worker-item .pending-worker-name {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
        line-height: 1.25 !important;
        max-width: 100% !important;
        font-size: 0.85rem !important;
    }
    body.theme-test.theme-test .workers-grid .modern-worker-item .seniority-and-port {
        display: inline-flex !important;
        flex-wrap: wrap !important;
        white-space: normal !important;
        flex-shrink: 1 !important;
        row-gap: 2px !important;
        max-width: 100% !important;
    }
    body.theme-test.theme-test .workers-grid .modern-worker-item .port-number {
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
        font-size: 0.78rem !important;
    }
    body.theme-test.theme-test .workers-grid .modern-worker-item .seniority-badge {
        font-size: 0.78rem !important;
        padding: 2px 6px !important;
    }
    body.theme-test.theme-test .workers-grid .modern-worker-item .worker-status {
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        max-width: 100% !important;
    }
    body.theme-test.theme-test .workers-grid .modern-worker-item .worker-info {
        min-width: 0 !important;
        max-width: 100% !important;
    }
    body.theme-test.theme-test .workers-grid .modern-worker-item {
        padding: 8px 10px !important;
    }
}
