/*
 * Base Template Layout Fixes
 * General styles and fixes for the AdminLTE base template
 */

/*
 * Sidebar Search Fix for Light Sidebar
 * AdminLTE's search input defaults to white text (for dark sidebars)
 * but NavEd uses sidebar-light-primary, so we need dark text
 */
.sidebar-light-primary .form-control-sidebar {
    color: #495057;
    background-color: #f8f9fa;
    border-color: #ced4da;
}

.sidebar-light-primary .form-control-sidebar::placeholder {
    color: #6c757d;
}

.sidebar-light-primary .form-control-sidebar:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.sidebar-light-primary .btn-sidebar {
    color: #495057;
    background-color: #e9ecef;
    border-color: #ced4da;
}

.sidebar-light-primary .btn-sidebar:hover {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

/* Sidebar Search Results Dropdown Fix */
.sidebar-light-primary .sidebar-search-results {
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
}

.sidebar-light-primary .sidebar-search-results .search-title {
    color: #6c757d;
}

.sidebar-light-primary .sidebar-search-results .list-group-item {
    color: #495057;
    background-color: #fff;
    border-color: #e9ecef;
}

.sidebar-light-primary .sidebar-search-results .list-group-item:hover {
    color: #007bff;
    background-color: #f8f9fa;
}

.sidebar-light-primary .sidebar-search-results .search-path {
    color: #6c757d;
}

/* Fix search results text - make ALL text visible */
.sidebar-light-primary .sidebar-search-results,
.sidebar-light-primary .sidebar-search-results *,
.sidebar-light-primary .sidebar-search-results a,
.sidebar-light-primary .sidebar-search-results span,
.sidebar-light-primary .sidebar-search-results .text-light,
.sidebar-light-primary .sidebar-search-results .text-white,
.sidebar-light-primary .sidebar-search-results mark,
.sidebar-light-primary .sidebar-search-results strong,
.sidebar-light-primary .sidebar-search-results b {
    color: #495057 !important;
}

/* Highlight matched text with yellow background */
.sidebar-light-primary .sidebar-search-results .text-light,
.sidebar-light-primary .sidebar-search-results .text-white,
.sidebar-light-primary .sidebar-search-results mark,
.sidebar-light-primary .sidebar-search-results .search-highlight {
    background-color: #fff3cd !important;
    color: #856404 !important;
    padding: 0 2px;
    border-radius: 2px;
}

.sidebar-light-primary .sidebar-search-results a:hover,
.sidebar-light-primary .sidebar-search-results a:hover * {
    color: #007bff !important;
}

/*
 * NOTE: AdminLTE already handles footer spacing with layout-footer-fixed.
 * It adds padding-bottom: calc(3.5rem + 1px) to .content-wrapper.
 *
 * If specific pages need more clearance, add page-specific CSS rather than
 * global overrides that affect card spacing everywhere.
 *
 * Example page-specific fix (add to that page's template):
 *   <style>.content-wrapper { padding-bottom: 5rem !important; }</style>
 */

/*
 * DaisyUI Modal Backdrop Fix (NAV-234)
 * Bootstrap 4's CSS doesn't use CSS layers, so it has higher specificity
 * than DaisyUI's layered styles. This causes two issues:
 * 1. dialog::backdrop shows as solid black instead of semi-transparent
 * 2. .modal-backdrop class (used by DaisyUI's form element) gets Bootstrap's
 *    solid black background with z-index: 9998, covering the modal content
 * These fixes ensure all DaisyUI dialog modals display correctly.
 */
dialog.modal::backdrop {
    background-color: oklch(0% 0 0 / 0.4) !important;
}

dialog.modal form.modal-backdrop,
dialog.modal .modal-backdrop {
    background-color: transparent !important;
    z-index: -1 !important;
}

/*
 * DataTables Pagination Styling Fix
 * DataTables generates its own pagination HTML that doesn't use DaisyUI classes.
 * These styles make the pagination look consistent with DaisyUI's design system.
 */
.dataTables_wrapper .dataTables_paginate {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    cursor: pointer;
    background-color: oklch(var(--b2));
    color: oklch(var(--bc));
    border: 1px solid oklch(var(--b3));
    transition: all 0.2s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background-color: oklch(var(--b3));
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: oklch(var(--p));
    color: oklch(var(--pc));
    border-color: oklch(var(--p));
    font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dataTables_wrapper .dataTables_info {
    color: oklch(var(--bc) / 0.7);
    font-size: 0.875rem;
    padding: 0.5rem 0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid oklch(var(--b3));
    background-color: oklch(var(--b1));
    color: oklch(var(--bc));
    margin: 0 0.25rem;
}
