/* Zenith Command Center - Futuristic Navigation System */

:root {
    --zenith-glass: rgba(255, 255, 255, 0.7);
    --zenith-border: rgba(255, 255, 255, 0.4);
    --zenith-accent: #0ea5e9; /* Sky 500 */
    --zenith-glow: rgba(14, 165, 233, 0.3);
}

/* Base Layout Stabilizers */
html, body {
    max-width: 100vw;
    position: relative;
}

/* `touch-action: manipulation` DIBUANG dari html/body.
   ====================================================
   Ia ditambah untuk membuang kelewatan ketukan 300ms. Kelewatan itu sudah
   TIADA sejak bertahun: setiap pelayar moden membuangnya sendiri apabila
   halaman mengisytiharkan `width=device-width` dlm meta viewport, yang
   base.html memang buat.

   Yang tinggal hanyalah kesan sampingannya: ia mengehadkan gerak isyarat
   yang enjin dibenarkan kendalikan pada AKAR dokumen, dan pada peranti
   dengan pad sentuh persisian atau skrin sentuh ia mengganggu tatalan dua
   jari. Zum cubit juga dihalang di sini — itu masalah kebolehcapaian dlm
   pelayar. Dalam APK, pengawal zum yang dikehendaki hidup dlm
   native_shell.js dan hanya aktif dlm mod aplikasi. */

/* `overflow-x: hidden` HANYA pada <html>, bukan pada <body>.
   ==========================================================
   Ini penting pada iPhone dan ia gagal secara senyap.

   Menurut spesifikasi, apabila `overflow-x` bukan `visible`, nilai
   `overflow-y` yang `visible` DITUKAR menjadi `auto`. Jadi menulis
   `overflow-x: hidden` pada `body` turut menjadikan `body` satu bekas
   tatal — walaupun tiada siapa memintanya. Disahkan dlm pelayar:
   getComputedStyle(body).overflowY memberi "auto".

   Pada <html> sahaja, nilai itu disebarkan ke viewport dan viewport yang
   menatal — betul. Pada KEDUA-DUANYA, `body` menjadi bekas tatal bersarang
   pd ketinggian kandungannya sendiri di dalam <html>. Chrome desktop
   memaafkan ini; Safari iOS dlm mod berdiri sendiri (PWA ditambah ke skrin
   utama) TIDAK — halaman berhenti menatal sepenuhnya. Tiada ralat, tiada
   apa dlm konsol; halaman hanya kelihatan beku.

   Halaman log masuk ialah 1585px tinggi pd telefon 812px, jadi separuh
   halaman berada di bawah fold dan tidak dapat dicapai.

   Lebihan mendatar masih ditahan: nilai <html> disebarkan ke viewport. */
html {
    overflow-x: hidden;
}

/* The Main Dock */
.zenith-dock {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: var(--zenith-glass);
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border: 1.5px solid var(--zenith-border);
    border-radius: 4rem;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 20px 40px -10px rgba(0, 0, 0, 0.2),
        inset 0 1px 1px rgba(255, 255, 255, 0.8);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    width: fit-content;
    max-width: 95vw;
}

.zenith-dock:hover {
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 30px 60px -20px rgba(0, 0, 0, 0.3);
    transform: translateX(-50%) translateY(-5px);
}

/* Nav Buttons */
.zenith-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 3.8rem;
    height: 3.8rem;
    border-radius: 2rem;
    color: #64748b; /* Slate 500 */
    transition: all 0.3s ease;
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.zenith-btn i {
    width: 1.4rem;
    height: 1.4rem;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.zenith-btn span {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.3rem;
    opacity: 0.7;
}

.zenith-btn.active {
    color: var(--zenith-accent);
    background: rgba(14, 165, 233, 0.08);
}

.zenith-btn.active i {
    transform: scale(1.2);
}

.zenith-btn:active {
    transform: scale(0.9);
}

/* The Nexus Center Button */
.zenith-nexus {
    width: 4.5rem;
    height: 4.5rem;
    background: linear-gradient(135deg, #0ea5e9, #2dd4bf);
    border-radius: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 25px var(--zenith-glow);
    animation: nexus-pulse 3s infinite;
    z-index: 10;
    margin: 0 0.2rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.zenith-nexus:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 35px var(--zenith-glow);
}

.zenith-nexus.open,
.zenith-nexus.active {
    transform: rotate(45deg) scale(0.9);
    background: #1e293b; /* Slate 800 */
    box-shadow: none;
}

@keyframes nexus-pulse {
    0% { box-shadow: 0 0 0 0 var(--zenith-glow); }
    70% { box-shadow: 0 0 0 20px rgba(14, 165, 233, 0); }
    100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

/* The Full Hub Overlay */
.zenith-hub-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4); /* Slate 900/40 */
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 3rem;
    padding-bottom: 8rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    transform: translateY(20px);
}

.zenith-hub-overlay.visible,
.zenith-hub-overlay.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    z-index: 1100;
}

.zenith-hub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.zenith-hub-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2rem;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    color: white;
    transition: all 0.3s ease;
    text-decoration: none;
}

.zenith-hub-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.zenith-hub-item i {
    width: 1.8rem;
    height: 1.8rem;
    color: var(--zenith-accent);
}

.zenith-hub-item span {
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

/* Advanced Hub Content */
.zenith-hub-content {
    width: 90%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3rem;
    padding: 2rem 1.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-shrink: 0;
    margin: auto 0;
}

@media (min-width: 640px) {
    .zenith-hub-content {
        padding: 2.5rem;
    }
}

.zenith-hub-header {
    margin-bottom: 2.5rem;
    text-align: left;
}

.zenith-hub-item.group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 2.2rem;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.zenith-hub-item.group:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-8px) scale(1.02);
}

.zenith-hub-icon-wrapper {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.zenith-hub-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

/* Nexus Morphing Button */
.zenith-nexus-btn {
    width: 4.5rem;
    height: 4.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
}

.nexus-ring {
    position: absolute;
    inset: -4px;
    border: 2px solid rgba(14, 165, 233, 0.3);
    border-radius: 50%;
    animation: nexus-spin 10s linear infinite;
}

.nexus-core {
    width: 3.8rem;
    height: 3.8rem;
    background: linear-gradient(135deg, #0ea5e9, #2dd4bf);
    border-radius: 1.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.zenith-nexus-btn.open .nexus-ring {
    opacity: 0;
}

.zenith-nexus-btn.open .nexus-core {
    transform: scale(0.9) rotate(90deg);
    background: #1e293b;
    box-shadow: none;
}

/* Admin Dock Nav Items (zenith-nav-item variant) */
.zenith-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 3.8rem;
    height: 3.8rem;
    border-radius: 2rem;
    color: #64748b;
    transition: all 0.3s ease;
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.zenith-nav-item i {
    width: 1.4rem;
    height: 1.4rem;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.zenith-nav-item.active {
    color: var(--zenith-accent);
    background: rgba(14, 165, 233, 0.08);
}

.zenith-nav-item.active i {
    transform: scale(1.2);
}

.zenith-nav-item:active {
    transform: scale(0.9);
}

.zenith-nav-label {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.3rem;
    opacity: 0.7;
}

/* Admin Nexus Icon Toggle */
.nexus-icon-container {
    position: relative;
    width: 1.5rem;
    height: 1.5rem;
}

.nexus-icon-grid,
.nexus-icon-close {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: white;
    transition: all 0.3s ease;
}

.nexus-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.zenith-nexus.active .nexus-icon-grid {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.zenith-nexus.active .nexus-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

@keyframes nexus-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Global Safe Area to prevent dock obstruction */
.zenith-safe-area {
    padding-bottom: 12rem !important;
}

@media (min-width: 1024px) {
    .zenith-safe-area {
        padding-bottom: 2rem !important;
    }
}

/* Responsive Safe Areas (Modern Devices) */
@supports (padding: env(safe-area-inset-bottom)) {
    .zenith-dock-wrapper {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ==========================================
   ROSTER MODAL STAFF CHECKLIST STYLES
   ========================================== */

/* Shift Type Button States */
.shift-type-btn {
    position: relative;
    transition: all 0.2s ease;
}

.shift-type-btn.border-blue-500 {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

/* Staff Checklist Container */
#roster-staff-container,
#roster-off-staff-container {
    scroll-behavior: smooth;
}

/* Custom Scrollbar for Staff List */
#roster-staff-container::-webkit-scrollbar,
#roster-off-staff-container::-webkit-scrollbar {
    width: 6px;
}

#roster-staff-container::-webkit-scrollbar-track,
#roster-off-staff-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#roster-staff-container::-webkit-scrollbar-thumb,
#roster-off-staff-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#roster-staff-container::-webkit-scrollbar-thumb:hover,
#roster-off-staff-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Staff Checkbox Item */
#roster-staff-container .flex,
#roster-off-staff-container .flex {
    transition: background-color 0.15s ease;
}

#roster-staff-container input[type="checkbox"]:disabled + label {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Selected Staff Tags */
#selected-staff-tags span {
    animation: tag-pop-in 0.2s ease;
}

@keyframes tag-pop-in {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Staff Checkbox Animation */
#roster-staff-container input[type="checkbox"] {
    transition: all 0.15s ease;
}

#roster-staff-container input[type="checkbox"]:checked {
    transform: scale(1.1);
}

/* Status Badge Styles */
.status-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

/* Section Headers in Staff List */
#roster-staff-container > div:first-child,
#roster-off-staff-container > div:first-child {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ==========================================
   CUSTOM SHIFT MODE STYLES
   ========================================== */

/* Mode Toggle Button */
#btn-mode-preset,
#btn-mode-custom {
    position: relative;
    overflow: hidden;
}

#btn-mode-preset.bg-white,
#btn-mode-custom.bg-white {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Custom Shift Section */
#custom-shift-section {
    animation: slide-down 0.2s ease;
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Time Preset Buttons */
#custom-shift-section button[onclick^="setCustomTime"] {
    transition: all 0.15s ease;
}

#custom-shift-section button[onclick^="setCustomTime"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.15);
}

#custom-shift-section button[onclick^="setCustomTime"]:active {
    transform: translateY(0);
}

/* Time Input Focus States for Custom Mode */
#custom-shift-start:focus,
#custom-shift-end:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Responsive Modal */
@media (max-width: 640px) {
    #modal-add-roster .sm\:max-w-2xl {
        max-width: 100%;
        margin: 0;
    }
    
    .shift-type-btn {
        padding: 0.75rem;
    }
    
    .shift-type-btn > div > div:last-child {
        font-size: 9px;
    }
    
    /* Stack mode toggle buttons on mobile */
    #btn-mode-preset span,
    #btn-mode-custom span {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    #btn-mode-preset,
    #btn-mode-custom {
        padding: 0.5rem 0.25rem;
    }
}

/* ==========================================
   ROSTER GRID MARGINS
   ========================================== */

/* Main Roster Grid Container Margins */
#slots-view-parent {
    margin-left: 4cm;
    margin-right: 4cm;
    margin-top: 0.5cm;
}

/* For print media - maintain margins when printing */
@media print {
    #slots-view-parent {
        margin-left: 4cm !important;
        margin-right: 4cm !important;
        margin-top: 0.5cm !important;
    }
    
    /* Force all colors to black and white - using very high specificity */
    #roster-grid-container * {
        background-color: white !important;
        background: white !important;
        color: black !important;
        -webkit-print-color-adjust: economy !important;
        print-color-adjust: economy !important;
    }
    
    /* Black and white styles for roster shift blocks */
    #roster-grid-container .absolute.inset-y-1\.5,
    #roster-grid-container [class*="rounded-xl"],
    #roster-grid-container .group\/slot,
    #roster-grid-container [style*="background-color"] {
        background-color: white !important;
        background: white !important;
        background-image: none !important;
        color: black !important;
        border: 1px solid black !important;
        box-shadow: none !important;
    }
    
    /* Ensure text is black */
    #roster-grid-container .text-\[9px\],
    #roster-grid-container .text-\[10px\],
    #roster-grid-container .text-\[8px\],
    #roster-grid-container .font-bold,
    #roster-grid-container .font-black,
    #roster-grid-container span,
    #roster-grid-container div {
        color: black !important;
    }
    
    /* Page break controls - prevent shift blocks from breaking */
    #roster-grid-container .absolute.inset-y-1\.5,
    #roster-grid-container .grid > div,
    #roster-grid-container [class*="rounded-xl"] {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    /* Prevent rows from breaking across pages */
    #roster-grid-container .grid {
        page-break-inside: auto !important;
    }
    
    #roster-grid-container .grid > * {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    /* Background elements in grayscale */
    #roster-grid-container .bg-slate-100,
    #roster-grid-container .bg-slate-200,
    #roster-grid-container .bg-slate-50,
    #roster-grid-container .bg-slate-800,
    #roster-grid-container .bg-slate-900,
    #roster-grid-container [class*="bg-"] {
        background-color: #f0f0f0 !important;
        background: #f0f0f0 !important;
        background-image: none !important;
    }
    
    /* Badges and labels */
    #roster-grid-container .rounded-full,
    #roster-grid-container .bg-black\/5,
    #roster-grid-container .bg-white\/30 {
        background-color: transparent !important;
        background: transparent !important;
        border: 1px solid #666 !important;
    }
    
    /* Remove color indicators */
    #roster-grid-container .w-1\.5,
    #roster-grid-container .h-1\.5,
    #roster-grid-container .rounded-full {
        background-color: #666 !important;
        background: #666 !important;
    }
    
    /* Multi-staff badge */
    #roster-grid-container .bg-red-500,
    #roster-grid-container [class*="bg-red"] {
        background-color: black !important;
        background: black !important;
        color: white !important;
    }
    
    /* Hide background colors on all elements with inline styles */
    [style*="background"] {
        background-color: white !important;
        background: white !important;
        background-image: none !important;
    }
    
    [style*="color"] {
        color: black !important;
    }
}

/* Responsive: Remove large margins on smaller screens */
@media (max-width: 1024px) {
    #slots-view-parent {
        margin-left: 1rem;
        margin-right: 1rem;
        margin-top: 1rem;
    }
}

@media (max-width: 640px) {
    #slots-view-parent {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
        margin-top: 0.5rem;
    }
}

/* ===== Pita amaran SATU baris (pemilik 12 Nov 2026) =====
   "kotak notifikasi besar gedabak ... aku tak suka visual jadi tertolak ke bawah":
   amaran/notis di atas jadual = SATU baris padat (~40px): ikon + ringkasan + "+n lagi".
   Butiran penuh: title (tooltip) ATAU <details class="pita"> -> panel TERAPUNG (tidak menolak kandungan).
   Dikongsi Kewangan, HR & Admin (zenith.css dimuat oleh base.html). Kontras teks >= 4.5:1. */
.pita { position: relative; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 6px 4px 12px;
    border: 1px solid; border-radius: 10px; font-size: 13px; line-height: 1.35; font-weight: 500; text-align: left; }
.pita.kuning { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.pita.merah { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.pita.biru { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.pita.kelabu { background: #f8fafc; border-color: #e2e8f0; color: #334155; }
.pita.hidden { display: none; } /* .pita{display:flex} mengatasi .hidden Tailwind -- pita "Dokumen luput" sentiasa kelihatan. */
.pita.hijau { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.pita-ikon { width: 16px; height: 16px; flex: 0 0 auto; }
.pita-teks { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pita-teks b { font-weight: 700; }
/* "+n lagi" di LUAR teks yang dipotong -- sentiasa kelihatan walaupun ringkasan panjang di telefon. */
.pita-lagi { flex: 0 0 auto; font-weight: 700; white-space: nowrap; }
.pita-btn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 32px;
    padding: 0 10px; border: 1px solid currentColor; border-radius: 8px; background: #fff; color: inherit;
    font: inherit; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; text-decoration: none; }
.pita-btn:hover { background: rgba(255, 255, 255, .7); }
.pita-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
details.pita { display: block; padding: 0; }
details.pita > summary { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 3px 6px 3px 12px;
    list-style: none; cursor: pointer; border-radius: 9px; }
details.pita > summary::-webkit-details-marker { display: none; }
details.pita > summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
details.pita > summary .pita-btn::after { content: attr(data-label); }
details.pita > summary .pita-btn:not([data-label])::after { content: "Lihat"; }
details.pita[open] > summary .pita-btn::after { content: "Tutup"; }
.pita-panel { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 35; max-height: min(60vh, 420px);
    overflow: auto; padding: 10px 14px; background: #fff; color: #0f172a; border: 1px solid #e2e8f0; border-radius: 12px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .18); font-size: 13px; line-height: 1.5; font-weight: 500; white-space: normal; }
.pita-panel ul { margin: 0; padding-left: 18px; list-style: disc; }
.pita-panel li + li { margin-top: 4px; }
.pita-panel p + p, .pita-panel p + ul, .pita-panel ul + p { margin-top: 6px; }
@media (pointer: coarse), (max-width: 640px) {
    .pita { min-height: 44px; }
    details.pita > summary { min-height: 44px; }
    .pita-btn { min-height: 44px; padding: 0 12px; }
}
