﻿/* ==========================================================================
   Global Overrides - site.css
   ========================================================================== */

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html,
body {
    height: 100%;
}

/* Focus styles */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem #258cfb;
}

/* ==========================================================================
   Page Header Component
   ========================================================================== */
.page-header h3 {
    color: #25396f;
    font-weight: 700;
}

.page-header p {
    font-size: 0.875rem;
}

/* ==========================================================================
   Card Enhancements
   ========================================================================== */
.card {
    border: none;
    box-shadow: -8px 12px 18px 0 rgba(25, 42, 70, 0.08);
}

/* ==========================================================================
   Table Enhancements
   ========================================================================== */
.table {
    margin-bottom: 0;
}

    .table thead th {
        font-weight: 600;
        font-size: 0.875rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #6c757d;
        border-bottom: 2px solid #dee2e6;
        padding: 0.75rem;
    }

        .table thead th.col-status,
        .table thead th.col-actions {
            width: 120px;
        }

    .table tbody td {
        padding: 0.75rem;
        vertical-align: middle;
    }

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* Sortable columns */
.sorting {
    cursor: pointer;
    user-select: none;
}

    .sorting:hover {
        background-color: #f8f9fa;
    }

    .sorting .sort-icon {
        font-size: 0.75rem;
        opacity: 0.4;
        transition: opacity 0.2s;
    }

    .sorting:hover .sort-icon {
        opacity: 1;
    }

    .sorting.asc .sort-icon::before {
        content: "\f145"; /* bi-arrow-up */
        color: #435ebe;
        opacity: 1;
    }

    .sorting.desc .sort-icon::before {
        content: "\f149"; /* bi-arrow-down */
        color: #435ebe;
        opacity: 1;
    }

/* Empty state */
.table-empty-state {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

    .table-empty-state i {
        font-size: 3rem;
        display: block;
        margin-bottom: 0.5rem;
    }

/* ==========================================================================
   Form Enhancements
   ========================================================================== */
.form-label {
    font-weight: 600;
    color: #25396f;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border: 1px solid #dce7f1;
    padding: 0.575rem 0.75rem;
}

    .form-control:focus,
    .form-select:focus {
        border-color: #435ebe;
        box-shadow: 0 0 0 0.2rem rgba(67, 94, 190, 0.1);
    }

    .form-control::placeholder {
        color: #adb5bd;
        font-size: 0.875rem;
    }

/* Input groups */
.input-group-text {
    background-color: transparent;
    border-right: 0;
}

.input-group .form-control {
    border-left: 0;
}

.input-group:focus-within .input-group-text {
    border-color: #435ebe;
}

/* Form switches */
.form-switch .form-check-input {
    width: 2.5rem;
    height: 1.25rem;
    cursor: pointer;
}

    .form-switch .form-check-input:checked {
        background-color: #435ebe;
        border-color: #435ebe;
    }

/* ==========================================================================
   Button Enhancements
   ========================================================================== */
.btn {
    padding: 0.575rem 1.25rem;
    font-weight: 500;
    border-radius: 0.375rem;
}

    .btn i {
        font-size: 1rem;
    }

.btn-sm {
    padding: 0.375rem 0.75rem;
}

    .btn-sm i {
        font-size: 0.875rem;
    }

.btn-primary {
    background-color: #435ebe;
    border-color: #435ebe;
}

    .btn-primary:hover {
        background-color: #364b98;
        border-color: #364b98;
    }

.btn-outline-primary {
    color: #435ebe;
    border-color: #435ebe;
}

    .btn-outline-primary:hover {
        background-color: #435ebe;
        border-color: #435ebe;
        color: #fff;
    }

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    position: relative;
    min-width: 250px;
    margin-bottom: 10px;
    padding: 15px 40px 15px 20px;
    border-radius: 4px;
    color: #fff;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

    .toast.show {
        opacity: 1;
        transform: translateX(0);
    }

    .toast.success {
        background-color: #3ac47d;
    }

    .toast.info {
        background-color: #16aaff;
    }

    .toast.warning {
        background-color: #f7b924;
    }

    .toast.error {
        background-color: #d92550;
    }

    .toast .close-btn {
        position: absolute;
        top: 8px;
        right: 10px;
        color: #fff;
        font-size: 18px;
        font-weight: bold;
        cursor: pointer;
        line-height: 1;
    }

/* ==========================================================================
   Notification Dropdown
   ========================================================================== */
.notification-menu_content {
    min-width: 500px;
    top: 50px;
    right: 0;
    transform-origin: left top;
    z-index: 1000;
}

.notification-list-container {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item.unread {
    background-color: #f8f9fa;
}

.notification-item:hover {
    background-color: #e9ecef;
}

.notification-status {
    padding: 0.5rem;
    cursor: pointer;
}

    .notification-status:hover i {
        color: #435ebe !important;
    }

#notificationCount {
    color: #435ebe !important;
    position: absolute;
    top: 0;
    left: 20px;
}

.text-info {
    color: #435ebe !important;
}

.parent-icon {
    position: relative;
}

.notification-header {
    white-space: normal;
    overflow-wrap: break-word;
}

.navbar .bi {
    color: inherit;
}

.navbar .dropdown-menu {
    z-index: 2000;
}

.notification-dropdown {
    min-width: 500px;
}

.navbar .nav-link {
    display: flex;
    align-items: center;
    line-height: 1;
}

.navbar .dropdown-toggle::after {
    margin-top: 0;
}

#notificationDropdown .nav-link i {
    margin-right: 0.25rem;
}

@media (max-width: 576px) {
    .notification-dropdown {
        min-width: min(92vw, 500px);
    }
}

/* ==========================================================================
   Sidebar Toggle
   ========================================================================== */
.burger-btn {
    position: relative;
    z-index: 3000;
}

@media (min-width: 1200px) {
    #sidebar.sidebar-desktop .sidebar-wrapper {
        left: 0;
    }

    #sidebar.sidebar-desktop ~ #main {
        margin-left: 300px;
    }

    #sidebar.sidebar-desktop.lvp-sidebar-collapsed .sidebar-wrapper {
        width: 80px;
    }

    #sidebar.sidebar-desktop.lvp-sidebar-collapsed ~ #main {
        margin-left: 80px;
    }

    #sidebar.sidebar-desktop.lvp-sidebar-collapsed .sidebar-menu .menu .sidebar-link span {
        display: none;
    }

    #sidebar.sidebar-desktop.lvp-sidebar-collapsed .sidebar-menu .menu .sidebar-link img,
    #sidebar.sidebar-desktop.lvp-sidebar-collapsed .sidebar-menu .menu .sidebar-link i {
        margin-right: 0 !important;
    }

    #sidebar.sidebar-desktop.lvp-sidebar-collapsed .sidebar-wrapper {
        overflow-x: hidden;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-muted {
    color: #6c757d !important;
}

.fw-medium {
    font-weight: 500 !important;
}

.small {
    font-size: 0.875rem;
}

/* ==========================================================================
   Pagination Enhancements
   ========================================================================== */
.pagination-wrapper {
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
}

.pagination-page-size .form-select {
    width: 70px;
    padding: 0.25rem 0.5rem;
}

.pagination-info {
    white-space: nowrap;
}

.pagination .page-link {
    color: #435ebe;
    border-color: #dee2e6;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

    .pagination .page-link:hover {
        background-color: #f8f9fa;
        border-color: #dee2e6;
        color: #364b98;
    }

    .pagination .page-link:focus {
        box-shadow: 0 0 0 0.2rem rgba(67, 94, 190, 0.1);
    }

.pagination .page-item.active .page-link {
    background-color: #435ebe;
    border-color: #435ebe;
    color: #fff;
}

.pagination .page-item.disabled .page-link,
.pagination .page-item.disabled span {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

.pagination-sm .page-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

    .pagination-sm .page-link i {
        font-size: 0.75rem;
    }

@media (max-width: 767.98px) {
    .pagination-wrapper {
        flex-direction: column;
        gap: 1rem;
    }

    .pagination-page-size,
    .pagination-controls {
        width: 100%;
        justify-content: center;
    }

        .pagination-controls > div {
            flex-direction: column;
            gap: 1rem;
        }

    .pagination-info {
        text-align: center;
    }
}
/* ==========================================================================
   Select2 Enhancements
   ========================================================================== */
/*.select2-selection {
    height: 45px !important;
}*/

/* Match Select2 height to Bootstrap inputs */
/* Force exact height */
.select2-container .select2-selection--single {
    height: 45px; /* match your input */
    border: 1px solid #ced4da; /* same border */
    border-radius: 4px;
}

/* Fix text vertical alignment */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px; /* SAME as height */
    padding-left: 12px;
    padding-right: 30px;
}

/* Fix arrow alignment */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
}

.select2-container--default .select2-selection--multiple {
    height: 45px;
    border: 1px solid #ced4da; /* same border */
    border-radius: 4px;
}


/* ==========================================================================
   Accordion/Nested Table Enhancements
   ========================================================================== */

/* Sorting cursor for nested tables */
.partialSorting {
    cursor: pointer;
    user-select: none;
}

    .partialSorting:hover {
        background-color: #f8f9fa;
    }

    .partialSorting .sort-icon {
        font-size: 0.75rem;
        opacity: 0.4;
        transition: opacity 0.2s;
    }

    .partialSorting:hover .sort-icon {
        opacity: 1;
    }

    .partialSorting.asc .sort-icon::before {
        content: "\f145"; /* bi-arrow-up */
        color: #435ebe;
        opacity: 1;
    }

    .partialSorting.desc .sort-icon::before {
        content: "\f149"; /* bi-arrow-down */
        color: #435ebe;
        opacity: 1;
    }

/* Nested table container styling */
.hiddenRow .bg-light {
    background-color: #f8f9fa !important;
    border-radius: 0.375rem;
}

/* ==========================================================================
   List Loader
   ========================================================================== */

.partialListContainer,
.partialListContainerTab,
.multiplePartialListContainer {
    position: relative;
}

.list-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    z-index: 5;
    font-size: 0.95rem;
}

.is-loading {
    min-height: 120px;
}

/* ==========================================================================
   RESPONSIVE HARDENING (SAFE ADDITIONS ONLY)
   Paste at the bottom of site.css
   ========================================================================== */

/* ================================
   Global Responsive Safety Net
   ================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal overflow issues */
body {
    overflow-x: hidden;
}

/* ================================
   Typography Scaling (Small Devices Only)
   ================================ */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .page-header h3 {
        font-size: 1.1rem;
    }

    .page-header p {
        font-size: 0.8rem;
    }
}

/* ================================
   Tables (Preserve Layout, Enable Scroll)
   ================================ */
@media (max-width: 767.98px) {
    .table {
        min-width: 600px;
    }

        .table thead th,
        .table tbody td {
            white-space: nowrap;
        }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-empty-state {
        padding: 2rem 1rem;
        text-align: center;
    }
}

/* ================================
   Forms & Inputs (Touch Friendly)
   ================================ */
@media (max-width: 576px) {
    .form-control,
    .form-select,
    .select2-container .select2-selection--single,
    .select2-container--default .select2-selection--multiple {
        min-height: 45px;
    }

    .btn {
        padding: 0.65rem 1.25rem;
    }
}

/* ================================
   Pagination Safety
   ================================ */
@media (max-width: 576px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
    }
}

/* ================================
   Notification Dropdown Safety
   ================================ */
@media (max-width: 576px) {
    .notification-menu_content,
    .notification-dropdown {
        max-height: 80vh;
        overflow-y: auto;
    }
}

/* ================================
   Toast Notifications (Mobile Fix)
   ================================ */
@media (max-width: 576px) {
    #toast-container {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .toast {
        width: 100%;
        min-width: unset;
    }
}

/* ================================
   Sidebar / Main Content Safety
   ================================ */
@media (max-width: 1199.98px) {
    #sidebar ~ #main {
        margin-left: 0 !important;
    }
}
