/**
 * CHLAS PRO - SOVEREIGN GLOBAL CORE STYLESHEET (V21.12 - STABLE)
 * Location: assets/css/sovereign_core.css
 * Logic: Rule 1 (Layout), Rule 112 (Sovereign Print), Rule 151 (Identity Bar)
 * Policy: ZERO LOSS (ZLP) | COMPLETE FILE CREATION
 */

/* ====================================================================
   1. MAIN HEADER & LOGO ALIGNMENTS (includes/header.php)
   ==================================================================== */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1060;
    height: var(--header-height);
    background: var(--uchs-green);
    border-bottom: 4px solid var(--uchs-gold);
    color: #fff;
    display: flex;
    align-items: center;
}
.header-title h2 {
    color: #fff;
    font-family: 'Times New Roman', serif;
    font-weight: bold;
    margin: 0;
    font-size: 1.6rem;
}
.header-title h6 {
    color: rgba(255,255,255,0.9);
    margin: 0;
    font-size: 0.9rem;
}
.header-logo {
    max-height: 65px;
    width: auto;
}
.toolbar {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #ddd;
}
.error-mismatch {
    color: #dc3545;
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* ====================================================================
   2. DESKTOP SIDEBAR WITH ZERO-JERK ISOLATION (includes/header.php)
   ==================================================================== */
#sidebar-wrapper {
    background: var(--sidebar-bg);
    border-right: 5px solid var(--sidebar-border);
    position: fixed;
    top: 100px;
    left: 0;
    height: calc(100vh - 100px);
    z-index: 9999 !important;
    width: 16.66667%;
    box-sizing: border-box;
}
.col-md-10, [class*="col-md-10"] {
    width: 83.33333%;
    margin-left: 16.66667% !important;
    float: left;
    box-sizing: border-box;
}
.sidebar-sticky-container {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}
.row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-right: -15px !important;
    margin-left: -15px !important;
}
.sidebar-sticky-container::-webkit-scrollbar {
    width: 5px;
}
.sidebar-sticky-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}
.sidebar-heading-manual {
    text-transform: uppercase;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.85);
    padding: 12px 15px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
    user-select: none;
}
.sidebar-heading-manual:hover {
    background: rgba(0,0,0,0.1);
    color: #fff;
}
.sidebar-heading-manual.head-active {
    background: rgba(0,0,0,0.2);
    border-left: 4px solid var(--sidebar-border);
}
.silo-content {
    display: none;
    background: rgba(0,0,0,0.1);
    padding: 5px 0;
}
.silo-show {
    display: block !important;
}
.nav-link {
    font-size: 0.9rem;
    margin: 0 8px;
    transition: 0.2s;
    color: white !important;
}
.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: var(--sidebar-hover) !important;
    transform: translateX(5px);
}
.active-gold {
    background: var(--uchs-gold) !important;
    color: var(--uchs-green) !important;
    font-weight: 900 !important;
}
.sub-link {
    font-size: 0.85rem;
    padding-left: 35px !important;
    margin-bottom: 2px;
    opacity: 0.9;
}
.active-sub {
    color: var(--uchs-gold) !important;
    font-weight: 800 !important;
    border-left: 3px solid var(--uchs-gold);
    background: rgba(255,255,255,0.05);
}
.arrow-icon {
    transition: 0.3s;
    font-size: 0.6rem;
}
.silo-show + .arrow-icon {
    transform: rotate(90deg);
}

/* ====================================================================
   3. HAMBURGER & OFF-CANVAS DRAWER MENU (includes/menu.php)
   ==================================================================== */
#mobile-sidebar-toggle {
    display: none;
    position: fixed !important;
    top: 25px !important;
    right: 25px !important;
    font-size: 1.7rem !important;
    color: #fff !important;
    cursor: pointer !important;
    z-index: 10100 !important;
    border: 2px solid var(--uchs-gold);
    border-radius: 6px;
    padding: 4px 10px;
    background: var(--uchs-green) !important;
    pointer-events: auto !important;
}
#mobile-menu-drawer {
    position: fixed !important;
    top: 0 !important;
    right: -300px !important;
    width: 280px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    background: var(--sidebar-bg) !important;
    border-left: 5px solid var(--sidebar-border) !important;
    z-index: 10090 !important;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: -4px 0 15px rgba(0,0,0,0.3) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    color: #fff !important;
    display: none;
}
@media (max-width: 767.98px) {
    #mobile-menu-drawer {
        display: block !important;
    }
    #mobile-menu-drawer.mobile-show {
        right: 0 !important;
    }
}
#mobile-menu-drawer::-webkit-scrollbar { width: 4px; }
#mobile-menu-drawer::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

.mob-drawer-heading {
    text-transform: uppercase;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.9);
    padding: 14px 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
    user-select: none;
}
.mob-drawer-heading:hover { background: rgba(0,0,0,0.1); color: #fff; }
.mob-drawer-heading.head-active { background: rgba(0,0,0,0.2); border-left: 4px solid var(--sidebar-border); }

.mob-silo-content {
    display: none;
    background: rgba(0,0,0,0.1);
    padding: 5px 0;
}
.mob-silo-content.silo-show {
    display: block !important;
}
.arrow-icon-mob { transition: 0.3s; font-size: 0.65rem; }
.silo-show + .arrow-icon-mob { transform: rotate(90deg); }

#mobile-menu-drawer .nav-link { font-size: 0.95rem; margin: 0 8px; padding: 10px 15px; transition: 0.2s; color: white !important; }
#mobile-menu-drawer .active-gold { background: var(--uchs-gold) !important; color: var(--uchs-green) !important; font-weight: 900 !important; }
#mobile-menu-drawer .mob-sub-link { font-size: 0.88rem; padding-left: 35px !important; margin-bottom: 2px; opacity: 0.95; }
#mobile-menu-drawer .active-sub { color: var(--uchs-gold) !important; font-weight: 800 !important; border-left: 3px solid var(--uchs-gold); background: rgba(255,255,255,0.05); }

/* --- 2. RESPONSIVE HORIZONTAL SCROLLABLE TOOLBAR (Issue 16) --- */
.custom-scroll-row {
    scrollbar-width: thin;
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: flex-end !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-bottom: 4px !important;
}
.custom-scroll-row > div {
    flex: 1 1 0 !important;
    min-width: 96px !important;
    max-width: 200px;
}

/* ====================================================================
   4. STACKING AND INTERACTION CONTROLS (includes/ui_protocol_helper.php)
   ==================================================================== */
.inst-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: #1d3a8a;
    text-transform: uppercase;
    margin-bottom: 2px;
    display: block;
}
.print-only {
    display: none;
}
.modal {
    z-index: 100000 !important;
}
.modal-backdrop {
    z-index: 99999 !important;
}
input#main_desig_filter.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40\' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
}
#desig_dropdown_list {
    min-width: 320px !important;
    max-height: 250px;
    overflow-y: auto;
}
#desig_dropdown_list .dropdown-item {
    padding: 6px 12px;
    font-weight: 600;
}

/* ====================================================================
   5. MOBILE VIEWPORT ADAPTATIONS (ZLP COMPLIANT)
   ==================================================================== */
@media (max-width: 767.98px) {
    .main-header {
        height: auto !important;
        padding: 10px 5px !important;
        position: sticky;
        top: 0;
        z-index: 1060;
    }
    .header-logo {
        max-height: 40px !important;
    }
    .header-title h2 {
        font-size: 1.05rem !important;
    }
    .header-title h6 {
        font-size: 0.65rem !important;
    }
    .main-header img[alt="UCHS"] {
        display: none !important;
    }
    .main-header .col-2.text-end {
        display: flex !important;
        justify-content: flex-end;
        align-items: center;
    }
    #mobile-sidebar-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    #sidebar-wrapper {
        display: none !important;
    }
    body {
        padding-bottom: 75px !important;
    }
/* Main Content Scaling & Top Padding Reduction to Close the Top Gap (ZLP Left-Gap Reconciled) */
    .col-md-10, .col-12 {
        width: 100% !important;
        margin-left: 0 !important; /* Locks left margin back to 0 on mobile viewports */
        padding: 10px 15px !important;
    }
    .row.g-2 > [class*="col-"] {
        width: 100% !important;
    }
.report-sticky-header,
    .roster-sticky-header,
    .manager-sticky-header,
    .employee-sticky-header,
    .credits-sticky-header,
    div[class*="-sticky-header"],
    .fragment-header,
    div.sticky-top,
    div.sticky-top[style],
    div[style*="top: 100px"],
    div[style*="top:100px"],
    div.sticky-top[style*="top: 100px"] {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 10px 15px 4px 15px !important; /* Tightens bottom padding on mobile views */
        z-index: 10075 !important;
        background: #f8f9fa !important;
        border-top: 3px solid var(--uchs-gold) !important;
        border-bottom: none !important;
        box-shadow: 0 -4px 10px rgba(0,0,0,0.15) !important;
        transform: translateY(110%) !important; /* Default hidden state on mobile */
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
        visibility: hidden !important;
        will-change: transform;
    }
    .report-sticky-header.mobile-show-bar,
    .roster-sticky-header.mobile-show-bar,
    .manager-sticky-header.mobile-show-bar,
    .employee-sticky-header.mobile-show-bar,
    .credits-sticky-header.mobile-show-bar,
    div[class*="-sticky-header"].mobile-show-bar,
    .fragment-header.mobile-show-bar,
    div.sticky-top.mobile-show-bar,
    div.sticky-top[style].mobile-show-bar,
    div[style*="top: 100px"].mobile-show-bar,
    div[style*="top:100px"].mobile-show-bar,
    div.sticky-top[style*="top: 100px"].mobile-show-bar {
        transform: translateY(0) !important;
        visibility: visible !important;
    }
    .header-nav-row,
    .sticky-top > div:first-child:nth-last-child(2),
    .fragment-header > div:first-child:nth-last-child(2),
    div[class*="-sticky-header"] > div:first-child:nth-last-child(2),
    .report-sticky-header > div:first-child:nth-last-child(2),
    .roster-sticky-header > div:first-child:nth-last-child(2),
    .manager-sticky-header > div:first-child:nth-last-child(2) {
        display: none !important;
    }
    .header-action-row > div:last-child,
    .sticky-top > div.bg-white > div:last-child,
    .report-sticky-header > div.bg-white > div:last-child,
    .roster-sticky-header > div.bg-white > div:last-child,
    .manager-sticky-header > div.bg-white > div:last-child,
    .fragment-header > div.bg-white > div:last-child,
    div[class*="-sticky-header"] > div.bg-white > div:last-child {
        display: none !important;
    }
    .header-action-row > div:first-child,
    .sticky-top > div.bg-white > div:first-child,
    .report-sticky-header > div.bg-white > div:first-child,
    .roster-sticky-header > div.bg-white > div:first-child,
    .manager-sticky-header > div.bg-white > div:first-child,
    .fragment-header > div.bg-white > div:first-child,
    div[class*="-sticky-header"] > div.bg-white > div:first-child {
        width: 100% !important;
        justify-content: center !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .header-action-row .btn,
    .sticky-top > div.bg-white .btn,
    .report-sticky-header > div.bg-white .btn,
    div[class*="-sticky-header"] > div.bg-white .btn {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
        height: auto !important;
        min-height: unset !important;
    }
    .header-action-row .btn i,
    .sticky-top > div.bg-white .btn i,
    .report-sticky-header > div.bg-white .btn i,
    div[class*="-sticky-header"] > div.bg-white .btn i {
        font-size: 0.85rem !important;
        margin-right: 3px !important;
        margin-bottom: 0px !important;
        display: inline-block !important;
    }
    .btn {
        padding: 10px 15px !important;
        font-size: 0.85rem !important;
    }
    .institutional-toolbar-container form > .row:first-of-type,
    #filterForm > .row:first-of-type {
        display: none !important;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch !important;
        overflow-x: auto !important;
        display: block !important;
        width: 100% !important;
        border: none !important;
        margin: 0 !important;
    }
    .table {
        width: 100% !important;
        table-layout: auto !important;
        margin-bottom: 0 !important;
    }
    .table td, .table th {
        padding: 8px 6px !important;
        font-size: 0.72rem !important;
        white-space: nowrap !important;
    }
/* Allow personal identity strings (Names/Designations) to wrap cleanly if needed */
            .table td.text-start, .table th.text-start {
                white-space: normal !important;
                min-width: 130px !important;
                word-break: break-word !important;
            }

            /* Symmetrical Nesting Override: Prevents double-nesting fixed bottom overlaps [Rule 158] */
            div[class*="-sticky-header"] .fragment-header,
            .report-sticky-header .fragment-header,
            .roster-sticky-header .fragment-header,
            .credits-sticky-header .fragment-header,
            .employee-sticky-header .fragment-header {
                position: static !important;
                box-shadow: none !important;
                border: none !important;
                padding: 0 !important;
                margin: 0 !important;
                background: transparent !important;
            }
        }

/* ====================================================================
   6. VERIFIED HIGH-SPECIFICITY PRINT DRIVER (Rule 112)
   ==================================================================== */
@media print {
    @page {
        size: auto;
        margin: 1.2cm 1.5cm 1.2cm 1.5cm;
    }
    body {
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        color: #000 !important;
        font-family: "Times New Roman", Times, serif !important;
        font-size: 10.5pt !important;
    }
    html, body, * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        opacity: 1 !important;
        filter: none !important;
        text-shadow: none !important;
    }
    body, .row, .container-fluid, .card, .p-4, .p-md-5, .col-md-10, [class*="col-md-10"] {
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        box-shadow: none !important;
    }
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    .no-print, #sidebar-wrapper, .main-header, .institutional-toolbar-container, .institutional-pagination, .btn, .modal, .employee-sticky-header, .report-sticky-header, .manager-sticky-header, #mobile-sidebar-toggle, #mobile-menu-drawer, .sidebar-overlay {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }
    .btn, .staff-row {
        box-shadow: none !important;
    }
    .text-muted {
        color: #000 !important;
        font-weight: bold !important;
    }
    .table {
        border-collapse: collapse !important;
        border: 1.2pt solid #000 !important;
        width: 100% !important;
        table-layout: auto !important;
        margin-top: 5px !important;
    }
    .table th {
        border: 1.2pt solid #000 !important;
        font-size: 8.5pt !important;
        font-weight: bold !important;
        padding: 3px 4px !important;
    }
    .table td {
        border: 1pt solid #000 !important;
        font-size: 8pt !important;
        font-weight: bold !important;
        padding: 3px 4px !important;
    }
    th, td {
        white-space: nowrap !important;
    }
    th.text-start, td.text-start, td.text-muted {
        white-space: normal !important;
        break-word: break-word !important;
    }
    p, span, div, small {
        font-size: 8pt !important;
    }
}
/* --- TIER 15 EXTRACTED LOGIN PORTAL STYLES --- */
body.login-body {
    background-color: #f1f5f9 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 100vh !important;
    margin: 0 !important;
}
.login-card {
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    border-top: 5px solid var(--uchs-green) !important;
    padding: 40px !important;
    width: 100% !important;
    max-width: 420px !important;
    box-sizing: border-box !important;
}
/* ====================================================================
   7. SOVEREIGN TRAINING GUIDE PERMANENT TOP STRIP (ZLP Compliant)
   ==================================================================== */
.guide-static-header {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    visibility: visible !important;
    display: block !important;
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important;
    border: 1px solid #ddd !important;
    border-top: 4px solid var(--uchs-green) !important;
    border-radius: 12px !important;
    padding: 15px 20px !important;
    margin-bottom: 20px !important;
    z-index: 10 !important;
    opacity: 1 !important;
}

@media (max-width: 767.98px) {
    .guide-static-header {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 15px !important;
        margin: 10px 0 20px 0 !important;
    }
    .guide-static-header .header-nav-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        width: 100% !important;
    }
    .guide-static-header .header-nav-row > div:first-child {
        text-align: left !important;
        width: 100% !important;
    }
    .guide-static-header .header-nav-row h4 {
        font-size: 1.1rem !important;
        color: #1d3a8a !important;
    }
    .guide-static-header .header-nav-row small {
        font-size: 0.75rem !important;
        display: block !important;
        color: #6c757d !important;
    }
    .guide-static-header .btn-group {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100% !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    .guide-static-header .btn-group .btn {
        flex: 1 1 45% !important;
        font-size: 0.75rem !important;
        padding: 8px 10px !important;
        text-align: center !important;
        border-radius: 6px !important;
    }
}