/* Add your custom CSS here */
body {
    background-color: var(--bs-body-bg);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom CSS variables or overrides for dark theme compatibility */
[data-bs-theme="light"] body {
    background-color: #f8f9fa;
}

[data-bs-theme="dark"] body {
    background-color: #121212;
}

/* Make Bootstrap utility classes responsive to themes */
[data-bs-theme="dark"] .bg-light {
    background-color: #1e1e1e !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #1e1e1e !important;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .card {
    background-color: #1e1e1e;
    border-color: #2d2d2d;
}

[data-bs-theme="dark"] .card-header {
    background-color: #252525 !important;
    border-bottom-color: #2d2d2d !important;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .offcanvas-header {
    background-color: #1e1e1e !important;
    border-bottom-color: #2d2d2d !important;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .offcanvas-md {
    background-color: #1e1e1e !important;
    border-right-color: #2d2d2d !important;
}

[data-bs-theme="dark"] .link-dark {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .link-dark:hover {
    color: #0d6efd !important;
    background-color: #2d2d2d !important;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e1e1e;
    border-color: #2d2d2d;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #2d2d2d;
    color: #ffffff;
}

[data-bs-theme="dark"] .table {
    --bs-table-color: #e0e0e0;
    --bs-table-bg: #1e1e1e;
    --bs-table-border-color: #2d2d2d;
    --bs-table-striped-bg: #252525;
    --bs-table-hover-bg: #2d2d2d;
}

[data-bs-theme="dark"] .modal-content {
    background-color: #1e1e1e;
    border-color: #2d2d2d;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: #2d2d2d;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #252525;
    border-color: #333333;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #2a2a2a;
    color: #ffffff;
}

[data-bs-theme="dark"] .input-group-text {
    background-color: #2d2d2d;
    border-color: #333333;
    color: #e0e0e0;
}

/* Hover style for theme toggle button */
.hover-white:hover {
    color: #ffffff !important;
    transform: scale(1.1);
    transition: transform 0.2s ease, color 0.2s ease;
}


/* Fix Select2 Bootstrap 5 Width & Search Box */
.select2-container {
    width: 100% !important;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    display: block;
}

/* Penyesuaian Mobile */
@media (max-width: 767.98px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .card-header {
        padding: 0.5rem 1rem;
    }

    /* Tombol besar jadi full width di HP */
    .btn-lg {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Pastikan tabel tidak merusak layout */
    .table-responsive {
        border: none;
    }

    /* Mempercantik tampilan detail (child row) DataTables di mobile */
    table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control:before,
    table.dataTable.dtr-inline.collapsed>tbody>tr>th.dtr-control:before {
        background-color: #0d6efd;
        /* Warna biru Bootstrap */
        border: none;
    }
}

.qr-code {
    width: 24mm;
    height: 24mm;
    margin: 2px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code img,
.qr-code canvas {
    max-width: 100%;
    max-height: 100%;
}

/* ==========================================
   DARK MODE ADVANCED SUPPORT
   ========================================== */
[data-bs-theme="dark"] {
    --bs-body-color: #e0e0e0;
    --bs-body-bg: #121212;
    color: #e0e0e0;
}

/* General typography outside DataTables */
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] label,
[data-bs-theme="dark"] .form-label,
[data-bs-theme="dark"] .col-form-label,
[data-bs-theme="dark"] .modal-title,
[data-bs-theme="dark"] legend {
    color: #ffffff !important;
}

[data-bs-theme="dark"] p,
[data-bs-theme="dark"] span,
[data-bs-theme="dark"] div:not(.dataTables_wrapper),
[data-bs-theme="dark"] td,
[data-bs-theme="dark"] th {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .text-secondary {
    color: #a0a0a0 !important;
}

[data-bs-theme="dark"] .text-dark {
    color: #f8f9fa !important;
}

/* Select2 Dark Mode Override */
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection {
    background-color: #252525 !important;
    border-color: #444444 !important;
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown {
    background-color: #1e1e1e !important;
    border-color: #444444 !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    background-color: #252525 !important;
    border-color: #444444 !important;
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option {
    color: #e0e0e0 !important;
    background-color: #1e1e1e !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected],
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option[aria-selected="true"] {
    background-color: #0d6efd !important;
    color: #ffffff !important;
}

/* FullCalendar Dark Mode Override */
[data-bs-theme="dark"] .fc {
    --fc-page-bg-color: #1e1e1e !important;
    --fc-neutral-bg-color: #1e1e1e !important;
    --fc-neutral-text-color: #e0e0e0 !important;
    --fc-border-color: #2d2d2d !important;
    --fc-button-text-color: #ffffff;
    --fc-button-bg-color: #252525;
    --fc-button-border-color: #333333;
    --fc-button-hover-bg-color: #2d2d2d;
    --fc-button-hover-border-color: #3f3f3f;
    --fc-button-active-bg-color: #0d6efd;
    --fc-button-active-border-color: #0d6efd;
    --fc-event-bg-color: #0d6efd;
    --fc-event-border-color: #0d6efd;
    --fc-event-text-color: #ffffff;
    --fc-more-link-text-color: #0d6efd;
    --fc-more-link-bg-color: #1e1e1e;
}

[data-bs-theme="dark"] .fc-view-harness,
[data-bs-theme="dark"] .fc-scrollgrid,
[data-bs-theme="dark"] .fc-scrollgrid table,
[data-bs-theme="dark"] .fc-scrollgrid td,
[data-bs-theme="dark"] .fc-scrollgrid th,
[data-bs-theme="dark"] .fc-col-header-cell,
[data-bs-theme="dark"] .fc-daygrid-day,
[data-bs-theme="dark"] .fc-daygrid-day-frame,
[data-bs-theme="dark"] .fc-daygrid-day-bg,
[data-bs-theme="dark"] .fc-daygrid-day-events,
[data-bs-theme="dark"] .fc-daygrid-body,
[data-bs-theme="dark"] .fc-scrollgrid-section,
[data-bs-theme="dark"] .fc-scrollgrid-section table,
[data-bs-theme="dark"] .fc-scrollgrid-section td,
[data-bs-theme="dark"] .fc-scrollgrid-section th,
[data-bs-theme="dark"] .fc-theme-standard td,
[data-bs-theme="dark"] .fc-theme-standard th {
    background-color: #1e1e1e !important;
    border-color: #333333 !important;
}

[data-bs-theme="dark"] .fc-col-header-cell,
[data-bs-theme="dark"] .fc-col-header-cell-cushion {
    background-color: #252525 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .fc-daygrid-day-number,
[data-bs-theme="dark"] .fc-list-day-text,
[data-bs-theme="dark"] .fc-list-day-side-text {
    color: #e0e0e0 !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .fc-day-today,
[data-bs-theme="dark"] .fc-day-today .fc-daygrid-day-frame,
[data-bs-theme="dark"] .fc-day-today .fc-scrollgrid-sync-inner {
    background-color: rgba(13, 110, 253, 0.15) !important;
}

[data-bs-theme="dark"] .fc-list-event:hover td {
    background-color: #2d2d2d !important;
}

/* DataTables pagination and info elements styling outside table */
[data-bs-theme="dark"] .dataTables_info,
[data-bs-theme="dark"] .dataTables_paginate,
[data-bs-theme="dark"] .dataTables_length,
[data-bs-theme="dark"] .dataTables_filter {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: #252525 !important;
    border-color: #333333 !important;
    color: #e0e0e0 !important;
}

/* Checklist Item styling for project_view.php in Dark Mode */
[data-bs-theme="dark"] .checklist-item {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
}

[data-bs-theme="dark"] .checklist-item .bg-light {
    background-color: #252525 !important;
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .checklist-item .border-end {
    border-color: #333333 !important;
}

[data-bs-theme="dark"] .checklist-item hr {
    border-color: #333333 !important;
    opacity: 0.5;
}

/* Custom styling for .table-light in Dark Mode */
[data-bs-theme="dark"] .table-light {
    --bs-table-color: #ffffff !important;
    --bs-table-bg: #252525 !important;
    --bs-table-border-color: #333333 !important;
}