html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.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;
    padding: 0;
    overflow-x: hidden;
    --test-mode-banner-height: 48px;
    --top-header-height: 23px;
    --sticky-header-offset: calc(var(--test-mode-banner-height) + var(--top-header-height));
}

/* ===== App Layout ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar Styles ===== */
.sidebar {
    width: 250px;
    background-color: #1A445A;
    height: calc(100vh - var(--sticky-header-offset));
    position: fixed;
    left: 0;
    top: var(--sticky-header-offset);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 20px 24px 20px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

    .sidebar-brand i {
        font-size: 1.75rem;
    }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 24px 14px 20px 14px;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
}

    .sidebar-nav .nav-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 18px;
        color: #fff;
        text-decoration: none;
        border-radius: 8px;
        transition: background-color 0.2s ease;
        position: relative;
        font-size: 0.95rem;
        line-height: 1.4;
    }

        .sidebar-nav .nav-item:hover {
            background-color: rgba(255, 255, 255, 0.1);
        }

        .sidebar-nav .nav-item.active {
            background-color: rgba(255, 255, 255, 0.15);
        }

        .sidebar-nav .nav-item i {
            font-size: 1.1rem;
            width: 24px;
            text-align: center;
        }

        .sidebar-nav .nav-item span {
            font-size: 0.95rem;
        }

.nav-badge {
    background-color: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* ===== Main Area ===== */
.main-area {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--sticky-header-offset));
    background-color: #f8f9fa;
    transition: margin-left 0.3s ease-in-out;
    width: calc(100% - 250px);
    max-width: calc(100% - 250px);
    overflow-x: hidden;
    margin-top: var(--sticky-header-offset);
}

    .main-area.sidebar-collapsed {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }

/* ===== Header Styles ===== */
.top-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 24px;
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
    min-height: var(--top-header-height);
    flex-wrap: nowrap;
    position: relative;
    box-sizing: border-box;
}

.sticky-header .top-header {
    position: relative;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #374151;
    cursor: pointer;
    padding: 8px;
    margin-right: auto;
    display: block;
}

    .sidebar-toggle:hover {
        color: #111827;
    }

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ===== Notification Component ===== */
.notification-wrapper {
    position: relative;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
}

    .notification-bell i {
        font-size: 1.25rem;
        color: #6b7280;
    }

    .notification-bell:hover i {
        color: #374151;
    }

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: calc(110% + 8px);
    right: 0;
    width: 380px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1102; /* Above header (1100) and sidebar (1000) */
    overflow: hidden;
}

    .notification-dropdown.show {
        display: block;
    }

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.notification-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

    .notification-close:hover {
        color: #374151;
    }

.notification-body {
    max-height: 400px;
    overflow-y: auto;
}

.notification-section {
    padding: 12px 20px;
}

.notification-section-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 12px;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background-color: #fff;
    transition: background-color 0.2s ease;
}

    .notification-item:last-child {
        margin-bottom: 0;
    }

    .notification-item.unread {
        background-color: #f0f9ff;
    }

    .notification-item:hover {
        background-color: #f3f4f6;
    }

    .notification-item.unread:hover {
        background-color: #e0f2fe;
    }

.notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

    .notification-icon.threshold {
        background-color: #fff5d6eb;
        color: #0284c7;
    }

    .notification-icon.reminder {
        background-color: #fef3c7;
        color: #d97706;
    }

    .notification-icon.escalation {
        background-color: #f6b5bb45;
        color: #6b7280;
    }

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 12px);
}

.notification-item-desc {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
    margin-bottom: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notification-item-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

.notification-footer {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid #e5e7eb;
}

    .notification-footer a {
        font-size: 0.9rem;
        font-weight: 500;
        color: #1A445A;
        text-decoration: none;
    }

        .notification-footer a:hover {
            text-decoration: underline;
        }

/* Notification Expand/Collapse */
.notification-extra {
    display: none;
    padding-top: 0;
}

.notification-dropdown.expanded .notification-extra {
    display: block;
}

/* Notification Dropdown Responsive */
@media (max-width: 576px) {
    .notification-dropdown {
        position: fixed;
        top: 170px;
        right: 8px;
        left: 8px;
        width: auto;
    }
}

/* Mark All as Read Link */
.notification-mark-all {
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e6b93; 
    text-decoration: none;
    cursor: pointer;
}

.notification-mark-all:hover {
    text-decoration: underline;
    color: #6d28d9;
}

/* Unread Indicator Circle */
.notification-unread-indicator {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    background-color: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    align-self: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.notification-unread-indicator:hover {
    background-color: #2563eb;
    transform: scale(1.2);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #374151;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 32px 40px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.main-content > h1, .main-content > h2, .main-content > .content-header {
    margin-top: 8px;
}

.page-shell {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.page-title-group {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: clamp(1.75rem, 1.5rem + 0.8vw, 2.125rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #111827;
}

.page-subtitle {
    margin: 6px 0 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #6b7280;
}

/* ===== Sidebar Overlay for Mobile ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--sticky-header-offset);
    left: 0;
    width: 100%;
    height: calc(100% - var(--sticky-header-offset));
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999; /* Below header (1100) */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }



@media (max-width: 576px) {
    .main-area {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        margin-top: var(--sticky-header-offset);
    }

    .main-content {
        padding: 20px 16px;
        padding-top: 16px;
    }

    .top-header {
        padding: 10px;
        min-height: var(--top-header-height);
    }

    .sidebar-brand {
        padding: 18px 14px 16px 14px;
        font-size: 1.1rem;
        gap: 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-brand i {
        font-size: 1.4rem;
    }

    .sidebar-nav {
        padding: 18px 10px 16px 10px;
        gap: 10px;
        min-height: 0;
    }

    .sidebar-nav .nav-item {
        padding: 12px 12px;
        font-size: 0.85rem;
    }

    .sidebar-nav .nav-item span {
        font-size: 0.85rem;
    }

    .test-mode-banner {
        padding: 8px 12px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 8px;
        min-height: var(--test-mode-banner-height);
    }

    .test-mode-warning {
        font-size: 0.8rem;
        gap: 6px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1 1 auto;
        min-width: 0;
    }

    .test-mode-warning i {
        font-size: 0.95rem;
    }

    .test-mode-selector {
        width: auto;
        justify-content: flex-end;
        gap: 8px;
        flex: 0 0 auto;
    }

    .test-supervisor-dropdown {
        min-width: 120px;
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .header-right {
        gap: 10px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-bottom: 24px;
        padding-bottom: 12px;
    }

    .page-header-actions {
        justify-content: flex-start;
        width: 100%;
        gap: 12px;
    }

    .sidebar {
        top: var(--sticky-header-offset);
        height: calc(100vh - var(--sticky-header-offset));
        position: fixed;
        z-index: 1000;
        display: flex;
        flex-direction: column;
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay {
        top: var(--sticky-header-offset);
        height: calc(100vh - var(--sticky-header-offset));
    }
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 400px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

    .toast.show {
        opacity: 1;
        transform: translateX(0);
    }

    .toast.hide {
        opacity: 0;
        transform: translateX(100%);
    }

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    background-color: #111827;
    color: #fff;
}

.toast-error .toast-icon {
    background-color: #ef4444;
    color: #fff;
}

.toast-info .toast-icon {
    background-color: #3b82f6;
    color: #fff;
}

.toast-icon i {
    font-size: 14px;
}

.toast-message {
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
    line-height: 1.4;
}

@media (max-width: 576px) {
    .toast-container {
        /*top: 16px;*/
        right: 16px;
        left: auto;
    }

    .toast {
        min-width: 240px;
        max-width: calc(100vw - 32px);
    }
}

.review-no-data {
    min-height: 200px;
    font-size: 1rem;
}

.datefilerstyle {
    cursor: pointer;
    min-width: 170px;
}

/* Date range needs more width for "MMM DD, YYYY - MMM DD, YYYY" format */
.date-filter[data-filter-type="DateRange"] .datefilerstyle {
    min-width: 260px;
}

.datefilerstyle-validation {
    display: none;
    max-width: 280px;
}

/* Test Mode Banner Styles */
.test-mode-banner {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: #fff;
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    width: 100%;
    min-height: var(--test-mode-banner-height);
    box-sizing: border-box;
    flex-shrink: 0;
    overflow: hidden;
}

.test-mode-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.test-mode-warning i {
    font-size: 1.2rem;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.sticky-header {
    position: fixed;
    top: 0;
    left: 0; /* Span full width */
    right: 0;
    z-index: 1100; /* Above sidebar (1000) and overlay (999) */
    display: flex;
    flex-direction: column;
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: none;
}

.main-area.sidebar-collapsed .sticky-header {
    left: 0;
    right: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.test-mode-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
}

.test-mode-selector label {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.test-supervisor-dropdown {
    padding: 6px 12px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.95);
    color: #333;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 200px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.test-supervisor-dropdown:hover {
    border-color: rgba(255, 255, 255, 0.8);
    background-color: #fff;
}
.notification-icon .bi-exclamation-triangle {
    color: rgb(233 175 0);
}
.notification-icon .bi-exclamation-circle {
    color: rgb(220 53 69);
}
.notification-dropdown .notification-empty {
    align-items: center;
    text-align: center;
    margin: 10px;
}

.test-supervisor-dropdown:focus {
    outline: none;
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* Large Mobile (576px - 767.98px) */
@media (max-width: 767.98px) {
    .sidebar-brand {
        padding: 20px 14px 18px 14px;
        font-size: 1.2rem;
        gap: 8px;
        min-height: auto;
    }

    .sidebar-brand i {
        font-size: 1.45rem;
        flex-shrink: 0;
    }

    .sidebar-nav {
        padding: 18px 10px 16px 10px;
        gap: 8px;
        min-height: 0;
    }

    .test-mode-banner {
        padding: 8px 12px;
        gap: 6px;
        min-height: var(--test-mode-banner-height);
    }

    .test-mode-warning {
        font-size: 0.85rem;
        gap: 6px;
    }

    .test-mode-warning i {
        font-size: 1rem;
    }

    .test-supervisor-dropdown {
        min-width: 100px;
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    }

/* ===== Bootstrap Modal Overrides for Fixed Header ===== */
.modal {
    z-index: 1200;
    padding: 16px !important; /* Prevent scrollbar jump and keep edge spacing */
    overflow-y: hidden !important;
}

.modal-backdrop {
    z-index: 1190; /* Keep backdrop above the sticky header */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.modal-dialog {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    margin: 1.75rem auto;
    width: calc(100% - 32px);
    max-width: min(600px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    transform: none;
}

.modal-dialog-centered {
    min-height: auto;
    align-items: center;
}

.modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    border-radius: 8px;
}

.modal-body {
    overflow-y: auto;
}

/* Mobile-specific modal adjustments */
@media (max-width: 991.98px) {
    .modal-dialog {
        width: calc(100% - 24px);
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
    }

    .modal-content {
        border-radius: 0;
        max-height: calc(100vh - 24px);
    }

    .modal-dialog-centered {
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .test-mode-banner {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 8px;
        padding: 8px 12px;
    }

    .test-mode-warning {
        order: 1;
        flex: 0 1 auto;
    }

    .test-mode-selector {
        order: 2;
        flex: 0 1 auto;
        gap: 8px;
    }

    .test-mode-selector label {
        display: none; /* Hide label on mobile to save space */
    }

    .test-supervisor-dropdown {
        min-width: 140px;
        padding: 4px 8px;
        font-size: 0.85rem;
    }

    /* Ensure Litepicker dropdown appears above sidebar and other content */
    .litepicker {
        z-index: 1050 !important;
    }
}
    /* ===== Responsive Styles ===== */
    @media (max-width: 991.98px) {
    .sidebar.show {
        transform: translateX(0);
        animation: slideInSidebar 0.3s ease-out;
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    @keyframes slideInSidebar {
        from {
            transform: translateX(-100%);
        }
        to {
            transform: translateX(0);
        }
    }

    .main-area {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        margin-top: var(--sticky-header-offset);
    }

    .main-area.sidebar-collapsed {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }

    .sticky-header {
        left: 0;
        right: 0;
        top: 0;
    }

    .top-header {
        justify-content: space-between;
        position: relative;
        min-height: var(--top-header-height);
    }

    .main-content {
        padding-top: 24px;
        margin-top: 0;
    }

    .main-content > h1, .main-content > h2 {
        margin-top: 8px;
    }

    .sidebar {
        position: fixed;
        top: var(--sticky-header-offset);
        left: 0;
        width: 250px;
        height: calc(100vh - var(--sticky-header-offset));
        overflow-y: auto;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .sidebar-brand {
        padding: 20px 16px 18px 16px;
        font-size: 1.25rem;
        gap: 8px;
    }

    .sidebar-brand i {
        font-size: 1.5rem;
    }

    .sidebar-nav {
        padding: 18px 10px 16px 10px;
        gap: 8px;
    }

    .sidebar-overlay {
        position: fixed;
        top: var(--sticky-header-offset);
        left: 0;
        right: 0;
        height: calc(100vh - var(--sticky-header-offset));
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }

    [class*="drawer"], [class*="panel"] {
        top: var(--sticky-header-offset) !important;
    }
}
