/* ============================================
   V2 Main CSS — Biratsports DataTable Design
   ============================================ */

/* Dark mode variable overrides (subtler borders, lighter text) */
.dark {
    --border: oklch(17% 0 0);
    --sidebar-border: oklch(17% 0 0);
    --muted-foreground: oklch(75% 0 0);
}

/* ----- DataTables Integration (Native Layout Hidden) ----- */
div.dt-container .dt-layout-row:first-child { display: none; }
div.dt-container .dt-layout-row:last-child { display: none; }

.dataTables_wrapper { font-size: 14px; color: var(--foreground); }
table.dataTable { border-collapse: collapse !important; }
/* Match Bootstrap DataTable specificity (> thead > tr >) to override #dee2e6 */
table.dataTable > thead > tr > th,
table.dataTable > thead > tr > td {
    padding: 10px 16px !important;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border) !important;
    text-align: left;
    white-space: nowrap;
}
table.dataTable > tbody > tr > td {
    padding: 12px 16px !important;
    border-bottom: 1px solid var(--border) !important;
    vertical-align: middle !important;
    color: var(--foreground);
}
table.dataTable > tbody > tr:last-child > td { border-bottom: 0 !important; }
table.dataTable > tbody > tr:hover > td { background-color: var(--accent) !important; }
table.dataTable.no-footer { border-bottom: 1px solid var(--border) !important; }

/* Ordering arrows */
table.dataTable thead > tr > th.dt-orderable-asc:hover {
    outline: 2px solid var(--muted);
    outline-offset: -2px;
}
table.dataTable thead > tr > th.dt-ordering-asc span.dt-column-order:before { opacity: 0.7; }

/* Processing */
div.dt-container .dt-processing {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
}
div.dt-container .dt-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--muted-foreground);
    font-size: 14px;
}

/* Pagination (DataTables default) */
.dt-paging-button {
    height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 13px;
    background: transparent;
    color: var(--muted-foreground);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.12s ease;
    min-width: 32px;
}
.dt-paging-button:hover {
    background: var(--accent);
    color: var(--foreground);
}
.dt-paging-button.current {
    background: var(--accent);
    color: var(--foreground);
    border-color: var(--border);
    font-weight: 600;
}
.dt-paging-button.disabled,
.dt-paging-button.disabled:hover {
    opacity: 0.4;
    cursor: default;
    background: transparent;
    border-color: var(--border);
    color: var(--muted-foreground);
    pointer-events: none;
}

/* Custom pagination container */
#custom-pagination {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 2px;
}
.pagination-container .page-item { display: inline-flex !important; }
.pagination-container .page-link {
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    border: 1px solid var(--border) !important;
    background: var(--card) !important;
    color: var(--muted-foreground) !important;
    border-radius: 6px !important;
    margin: 0 !important;
    line-height: 1 !important;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
}
.pagination-container .page-link:hover {
    background: var(--accent) !important;
    color: var(--foreground) !important;
}
.pagination-container .page-link.active {
    background: var(--accent) !important;
    color: var(--foreground) !important;
    font-weight: 600 !important;
}
.pagination-container .page-link:disabled {
    opacity: 0.4;
    cursor: default !important;
    pointer-events: none !important;
}

/* ----- Toastr z-index ----- */
#toast-container { z-index: 9999 !important; }

/* ----- Missing variants from dashboard.css ----- */
.bg-muted\/40 { background-color: color-mix(in oklab, var(--muted) 40%, transparent); }
.divide-border > :not([hidden]) ~ :not([hidden]) { border-color: var(--border); }
.text-sidebar-foreground\/60 { color: var(--sidebar-foreground); opacity: 0.6; }

/* ----- Opacity variants missing from dashboard.css ----- */
.bg-background\/50 { background-color: color-mix(in oklab, var(--background) 50%, transparent); }
.bg-background\/30 { background-color: color-mix(in oklab, var(--background) 30%, transparent); }
.bg-card\/50 { background-color: color-mix(in oklab, var(--card) 50%, transparent); }
.bg-card\/30 { background-color: color-mix(in oklab, var(--card) 30%, transparent); }
/* ----- Sidebar foreground opacity variants (from dashboard.css vars) ----- */
.text-sidebar-foreground\/50 { color: var(--sidebar-foreground); opacity: 0.5; }
.text-sidebar-foreground\/70 { color: var(--sidebar-foreground); opacity: 0.7; }

/* ----- Premium Toggle Switch ----- */
.premium-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.premium-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.premium-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .4s;
    border-radius: 34px;
}

.premium-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.premium-toggle input:checked + .premium-toggle-slider {
    background-color: #22c55e;
}

.premium-toggle input:focus + .premium-toggle-slider {
    box-shadow: 0 0 1px #22c55e;
}

.premium-toggle input:checked + .premium-toggle-slider:before {
    transform: translateX(24px);
}

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); }
aside nav::-webkit-scrollbar { width: 4px; }
aside nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
aside nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ----- Animation ----- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in-up { animation: fadeInUp 0.3s ease-out; }

/* ----- Utility ----- */
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ----- DataTable zero records ----- */
.dataTables_wrapper .dataTables_empty { padding: 40px 20px !important; }

/* Force left-align all DataTable columns */
table.dataTable thead th,
table.dataTable tbody td,
table.dataTable thead th.dt-type-numeric,
table.dataTable tbody td.dt-type-numeric {
    text-align: left !important;
}

/* ----- Select2 fix for modals ----- */
.select2-container { z-index: 9999; }

/* ----- Select2 theme colors ----- */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    background-color: var(--background) !important;
    border-color: var(--border) !important;
    color: var(--foreground) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--foreground) !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--muted) !important;
    border-color: var(--border) !important;
    color: var(--foreground) !important;
}
.select2-dropdown {
    background-color: var(--background) !important;
    border-color: var(--border) !important;
    color: var(--foreground) !important;
}
.select2-results__option {
    color: var(--foreground) !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--background) !important;
    border-color: var(--border) !important;
    color: var(--foreground) !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--muted) !important;
    color: var(--foreground) !important;
}
.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--muted) !important;
}

/* ----- Bootstrap 5 Modal CSS (standalone, no Bootstrap CSS dependency) ----- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1055;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    display: none;
}
.modal.show { display: block; }
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}
.modal.show .modal-dialog { transform: none; }
.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 500px;
    pointer-events: none;
}
.modal-dialog.modal-lg { max-width: 800px; }
.modal-dialog.modal-sm { max-width: 300px; }
.modal-dialog.modal-xl { max-width: 1140px; }
.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: var(--card, #fff);
    border-radius: var(--radius, 0.75rem);
    border: 1px solid var(--border, #e5e7eb);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    pointer-events: auto;
    outline: 0;
}
.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1.25rem;
}
.modal-footer {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border, #e5e7eb);
    gap: 0.5rem;
}
.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: 0;
    border-radius: 0.375rem;
    opacity: 0.5;
    cursor: pointer;
}
.btn-close:hover { opacity: 0.75; }
.modal-dialog.modal-dialog-start { margin-right: auto; }
.modal-dialog.modal-dialog-end { margin-left: auto; }
.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    width: 100vw;
    height: 100vh;
    background-color: #000;
}
.modal-backdrop.fade { opacity: 0; transition: opacity 0.15s linear; }
.modal-backdrop.show { opacity: 0.5; }
body.modal-open { overflow: hidden; }

/* ----- Bootstrap compatibility for remaining views ----- */
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.position-absolute { position: absolute !important; }
.text-decoration-none { text-decoration: none !important; }
.fw-semibold { font-weight: 600 !important; }
.text-dark { color: var(--foreground) !important; }
.text-muted { color: var(--muted-foreground) !important; }
.form-group { margin-bottom: 1rem; }
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    border-radius: 0.375rem;
}
.badge-primary { background-color: var(--primary, #585cde); color: var(--primary-foreground, #fff); }
.page-item { display: inline-flex; }
.page-link {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    color: var(--foreground);
    text-decoration: none;
    border: 1px solid var(--border);
}
.row { display: flex; flex-wrap: wrap; }
.col-6 { width: 50%; padding: 0.5rem; }
.col-md-3 { width: 25%; padding: 0.5rem; }
.col-md-4 { width: 33.3333%; padding: 0.5rem; }
.g-3 { gap: 1rem; }
.container-fluid { width: 100%; margin: 0 auto; }

/* ----- Dark mode overrides for modal ----- */
.dark .btn-close { filter: invert(1); }
.dark .premium-toggle-slider { background-color: var(--muted); }
.dark .premium-toggle input:checked + .premium-toggle-slider { background-color: #22c55e; }