/* ========================================================
   Calendar View Global Layout
======================================================== */
.calendar-layout { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
}

.cursor-pointer { 
    cursor: pointer; 
}

/* Sidebar dividers span the full width, canceling the aside's horizontal padding */
.calendar-sidebar .sidebar-divider {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

/* ========================================================
   Key Summary Toggle (sidebar Scheduled / Missing)
======================================================== */
.key-summary-toggle {
    display: flex;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
}

.key-summary-toggle-btn {
    flex: 1 1 0;
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: #fff;
    color: #212529;
    padding: 0.4rem 0.25rem;
    font-size: 0.8rem;
    text-align: center;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .key-summary-toggle-btn.active {
        background: #d6e9fb;
        color: #212529;
        border-color: #0d6efd;
    }


/* ========================================================
   Create Schedule Modal Custom Overlays
======================================================== */
.custom-backdrop {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    z-index: 1040;
    pointer-events: auto;
}

.custom-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    pointer-events: none;
}


/* ========================================================
   Calendar Grid & Scheduling Layout styling
======================================================== */
.grid-row {
    display: flex;
    width: 100%;
    /* ✅ Removed hard min-width: 800px — was forcing horizontal scroll on zoom */
}

.row-wrapper {
    flex-shrink: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/* When ≤6 crews selected, rows stretch equally to fill full screen height */
.row-wrapper.flex-grow-1 {
    flex-shrink: 1;
    min-height: 80px;
    max-height: none;
}

/* When >6 crews selected, fixed row height with scrolling */
.row-wrapper:not(.flex-grow-1) {
    min-height: 96px;
    max-height: 170px;
}

.first-col {
    flex: 0 0 140px;
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    box-sizing: border-box;
}

.cal-col {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;       /* ✅ Prevent individual columns from bleeding out */
}

/* All day columns equal width (weekend columns no longer narrowed) */

.header-col { 
    background-color: #fff; 
}

.day-cell:not(.h-auto) {
    min-height: 80px;
    overflow: hidden;
}

/* Fixed height day cells when scrolling is active (>6 crews) */
.row-wrapper:not(.flex-grow-1) .day-cell:not(.h-auto) {
    min-height: 96px;
    max-height: 170px;
}

/* Stretch day cells when rows fill the screen (≤6 crews) */
.row-wrapper.flex-grow-1 .day-cell:not(.h-auto) {
    max-height: none;
    flex: 1;
}

/* Hide scrollbars for the main grid body */
.grid-body::-webkit-scrollbar {
    display: none;
}

.grid-body {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    border-top: 1px solid #dee2e6; /* separator between header and content */
}

:root {
    --brand-blue: #1a4f8c;
    /* Shared colors for count-related buttons (New Count / Add Count) */
    --count-btn-bg: #2F68A8;
    --count-btn-hover-bg: #265687;
    --count-btn-focus-shadow: rgba(47, 104, 168, 0.4);
}

.header-nav {
    background-color: var(--brand-blue);
}

/* Active nav tab highlight */
.nav-tab.active {
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

/* Override Bootstrap btn-primary to use brand blue */
.btn-primary {
    color: #fff;
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
}

    .btn-primary:hover {
        background-color: #163e6e;
        border-color: #163e6e;
    }

    .btn-primary:focus,
    .btn-primary:active {
        background-color: #163e6e;
        border-color: #163e6e;
        box-shadow: 0 0 0 0.2rem rgba(26, 79, 140, 0.4);
    }

/* "New Count" button — header bar color.
   Selector uses .btn.btn-primary.new-count-btn to out-rank the global
   `.btn-primary { ... !important }` override in rules.css (loaded later). */
.btn.btn-primary.new-count-btn {
    background-color: var(--count-btn-bg) !important;
    border-color: var(--count-btn-bg) !important;
    color: #ffffff !important;
}

    .btn.btn-primary.new-count-btn:hover {
        background-color: var(--count-btn-hover-bg) !important;
        border-color: var(--count-btn-hover-bg) !important;
    }

    .btn.btn-primary.new-count-btn:focus,
    .btn.btn-primary.new-count-btn:active {
        background-color: var(--count-btn-hover-bg) !important;
        border-color: var(--count-btn-hover-bg) !important;
        box-shadow: 0 0 0 0.2rem var(--count-btn-focus-shadow) !important;
    }

/* Segmented view-mode button group — each button is its own white segment */
.view-mode-group {
    overflow: visible;
}

.view-mode-group .view-mode-btn {
    color: #495057;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

    .view-mode-group .view-mode-btn:first-child {
        border-top-left-radius: 0.5rem;
        border-bottom-left-radius: 0.5rem;
    }

    .view-mode-group .view-mode-btn:last-child {
        border-top-right-radius: 0.5rem;
        border-bottom-right-radius: 0.5rem;
    }

/* Active view-mode button — light blue fill, brand blue outline with shadow.
   Uses a 1px border + inset ring so the button stays the exact same size as
   its siblings and never gets clipped at different browser zoom levels. */
.view-mode-group .view-mode-active {
    color: #212529 !important;
    background-color: #d9e8f8 !important;
    border: 1px solid #2e6da4 !important;
    border-radius: 0.5rem;
    box-shadow: inset 0 0 0 1px #2e6da4, 0 1px 4px rgba(46, 109, 164, 0.28) !important;
}

/* Never clip the nav header contents (button borders/shadows) */
.calendar-nav-header {
    overflow: visible;
}


/* allow the schedule card to size to its content */
.schedule-card {
    height: auto;
    min-height: 48px;
    overflow: visible;
    flex: 0 0 auto;     
}

.calendar-day-cell .day-content {
    min-height: 0;      
    overflow: hidden;    
}

.calendar-day-cell .day-content {
    min-height: 0;   
    overflow: hidden; 
}

/* Make direct children (cards) not shrink and allow them to grow to their content height */
.calendar-day-cell .day-content > .schedule-card {
    display: block;           
    width: 100%;
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0;
    max-height: none !important;
    overflow: visible !important;
}

/* Make the card body a vertical flow so rows stack and increase height */
.calendar-day-cell .day-content > .schedule-card > .p-1 {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-day-cell .day-content > .schedule-card .d-flex.justify-content-between {
    align-items: flex-start;
}

.schedule-card .crew-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 4px;
}

.schedule-card .top-crew-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    white-space: nowrap;
}

.schedule-card .top-crew-row .main-crew {
    font-size: 0.75rem;
}

.schedule-card .top-crew-row .top-first-assist {
    font-size: 0.75rem;
    color: #333;
}

.schedule-card .assist-list {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.schedule-card .assist-item {
    font-size: 0.75rem;
    white-space: nowrap;
    color: #333;
}

.schedule-card .main-crew {
    overflow: hidden;
    text-overflow: ellipsis;
}

.crew-right {
    margin-left: auto;
    flex: 0 1 auto !important;
    min-width: 0;         
    max-width: 140px;     
}

/* limit width of the crew stack so it won't push card wider */
.schedule-card .crew-stack {
    max-width: 140px; 
    min-width: 0;
}

.schedule-card .assist-list { max-width: 60%; }

/* ✅ L3/UPC badge — truncate long text instead of overflowing the card */
.schedule-card .pmm-badge {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;        /* ellipsis only works with nowrap */
    font-size: 0.7rem;
}

.crew-row-label {
    width: 140px;
    min-width: 140px;
}

/* Manager Period View Week Date Separator */
.week-date-separator {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6 !important;
}

.week-date-separator .first-col {
    background-color: #f8f9fa !important;
}
/* ===========================================================
   Scheduled Count Status Styles
   =========================================================== */

.scheduled-card {
    background-color: #d4edda;
    border-left: 4px solid #28a745 !important;
}

.assists-card {
    background-color: #d6f3f7;
    border-left: 4px solid #17a2b8 !important;
}

.review-card {
    background-color: #ffebd6;
    border-left: 4px solid #fd7e14 !important;
}

.revision-card {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545 !important;
}

.default-card {
    background-color: #dff2dc;
    border-left: 4px solid #6cc26f !important;
}

.scheduled-accent {
    background-color: #28a745;
}

.assists-accent {
    background-color: #17a2b8;
}

.review-accent {
    background-color: #fd7e14;
}

.revision-accent {
    background-color: #dc3545;
}

.default-accent {
    background-color: #6cc26f;
}

.scheduled-text {
    color: #28a745;
}

.assists-text {
    color: #17a2b8;
}

.review-text {
    color: #fd7e14;
}

.revision-text {
    color: #dc3545;
}

.default-text {
    color: #6cc26f;
}
 

/* ========================================================
   Key Matrix View Flyout
======================================================== */
.key-matrix-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
}

.key-matrix-flyout {
    background: #fff;
    border-radius: 12px 0 0 12px;
    border: 3px solid #6c3fc7;
    border-right: none;
    padding: 24px;
    width: 700px;
    max-width: 90vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.25s ease-out;
}

/* Crew multiselect dropdown for matrix view - PORTAL APPROACH */

/* The filter row */
.matrix-filters-row {
    position: relative;
}

/* Demote the sticky table header */
.key-matrix-flyout thead.sticky-top {
    z-index: 5 !important;
}

/* Invisible backdrop to catch clicks outside dropdown */
.crew-dropdown-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99998;
    background: transparent;
}

/* The actual dropdown menu - fixed position, escapes all containers */
.crew-dropdown-portal {
    position: fixed;
    /* top and left are set dynamically via inline style */
    width: 150px;
    max-height: 150px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    padding: 4px 0;
}

/* Checkbox items inside the dropdown */
.crew-dropdown-portal .form-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin: 0;
    cursor: pointer;
}

.crew-dropdown-portal .form-check:hover {
    background-color: #f8f9fa;
}

.crew-dropdown-portal .form-check-input {
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

.crew-dropdown-portal .form-check-label {
    margin: 0;
    cursor: pointer;
    white-space: nowrap;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

