/*
 * DCIT brand overrides (Dipolog City Institute of Technology).
 * Applied after adminlte.min.css in resources/views/vendor/adminlte/master.blade.php.
 * Primary: #125D95 (DCIT seal blue). Deep: #16426D. Accent: #1A72AF.
 */

:root {
    --dcit-blue: #125D95;
    --dcit-blue-2: #16426D;
    --dcit-blue-hover: #1A72AF;
    --dcit-blue-dark: #0E3F6A;
    --dcit-gold: #F2C230;
}

/* -------------------------------------------------------------------------
 * Sidebar body background
 * AdminLTE paints the sidebar body via [class*='sidebar-dark-'].
 * ------------------------------------------------------------------------- */
[class*='sidebar-dark-'],
.main-sidebar.sidebar-dark-primary,
.sidebar-dark-primary {
    background-color: var(--dcit-blue) !important;
}

/* Brand (logo) block at top of sidebar */
.main-sidebar .brand-link,
.layout-navbar-fixed .wrapper .sidebar-dark-primary .brand-link:not([class*=navbar]),
.layout-sm-navbar-fixed .wrapper .sidebar-dark-primary .brand-link:not([class*=navbar]),
.layout-md-navbar-fixed .wrapper .sidebar-dark-primary .brand-link:not([class*=navbar]),
.layout-lg-navbar-fixed .wrapper .sidebar-dark-primary .brand-link:not([class*=navbar]),
.layout-xl-navbar-fixed .wrapper .sidebar-dark-primary .brand-link:not([class*=navbar]) {
    background-color: var(--dcit-blue-2) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

.main-sidebar .brand-link .brand-text {
    color: #ffffff !important;
}

/* Sidebar user panel divider */
.main-sidebar .user-panel {
    border-bottom-color: rgba(255, 255, 255, 0.15) !important;
}

/* Active menu items (override AdminLTE's #007bff) */
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
.sidebar-dark-primary .nav-sidebar .nav-treeview > .nav-item > .nav-link.active,
.sidebar-light-primary .nav-sidebar > .nav-item > .nav-link.active {
    background-color: var(--dcit-blue-hover) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.sidebar-dark-primary .nav-sidebar.nav-legacy > .nav-item > .nav-link.active,
.sidebar-light-primary .nav-sidebar.nav-legacy > .nav-item > .nav-link.active {
    border-color: var(--dcit-blue-hover) !important;
}

/* Hover state */
[class*='sidebar-dark-'] .nav-sidebar > .nav-item > .nav-link:hover,
[class*='sidebar-dark-'] .nav-sidebar > .nav-item.menu-open > .nav-link,
[class*='sidebar-dark-'] .nav-sidebar > .nav-item:hover > .nav-link,
[class*='sidebar-dark-'] .nav-sidebar > .nav-item > .nav-link:focus {
    background-color: rgba(0, 0, 0, 0.15) !important;
    color: #ffffff !important;
}

[class*='sidebar-dark-'] .nav-treeview > .nav-item > .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.10) !important;
    color: #ffffff !important;
}

/* Sidebar search box */
.main-sidebar .form-control-sidebar {
    background-color: rgba(255, 255, 255, 0.10) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}
.main-sidebar .form-control-sidebar::placeholder {
    color: rgba(255, 255, 255, 0.65) !important;
}

/* -------------------------------------------------------------------------
 * App-wide primary → SMC green
 * ------------------------------------------------------------------------- */

/* Buttons */
.btn-primary,
.btn-flat.btn-primary {
    background-color: var(--dcit-blue) !important;
    border-color: var(--dcit-blue) !important;
    color: #ffffff !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary.focus,
.btn-flat.btn-primary:hover,
.btn-flat.btn-primary:focus {
    background-color: var(--dcit-blue-hover) !important;
    border-color: var(--dcit-blue-hover) !important;
    color: #ffffff !important;
}
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active,
.show > .btn-primary.dropdown-toggle {
    background-color: var(--dcit-blue-dark) !important;
    border-color: var(--dcit-blue-dark) !important;
    color: #ffffff !important;
}
.btn-outline-primary {
    color: var(--dcit-blue) !important;
    border-color: var(--dcit-blue) !important;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--dcit-blue) !important;
    border-color: var(--dcit-blue) !important;
    color: #ffffff !important;
}

/* Cards with card-primary outline (used on login form) */
.card-primary.card-outline {
    border-top: 3px solid var(--dcit-blue) !important;
}
.card-primary:not(.card-outline) > .card-header {
    background-color: var(--dcit-blue) !important;
    border-bottom-color: var(--dcit-blue-2) !important;
    color: #ffffff !important;
}

/* Links, badges, text-primary */
a { color: var(--dcit-blue); }
a:hover, a:focus { color: var(--dcit-blue-hover); }
.text-primary { color: var(--dcit-blue) !important; }
.bg-primary, .badge-primary { background-color: var(--dcit-blue) !important; }

/* Nav-pills (used inside cards / tabs) */
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--dcit-blue) !important;
    color: #ffffff !important;
}

/* Form focus ring */
.form-control:focus {
    border-color: var(--dcit-blue-hover) !important;
    box-shadow: 0 0 0 0.2rem rgba(14, 107, 44, 0.25) !important;
}

/* Icheck-primary (remember-me checkbox on login) */
.icheck-primary > input:first-child:checked + label::before,
.icheck-primary > input:first-child:checked + input[type=hidden] + label::before {
    background-color: var(--dcit-blue) !important;
    border-color: var(--dcit-blue) !important;
}

/* =========================================================================
 * DARK MODE
 * Activated by <html data-theme="dark">. Sidebar stays SMC green (brand),
 * but the rest of the chrome switches to a neutral dark surface set.
 * ========================================================================= */

:root {
    /* Light-mode surface tokens (defaults - AdminLTE stays visually the same) */
    --dcit-surface: #f4f6f9;
    --dcit-surface-card: #ffffff;
    --dcit-surface-navbar: #ffffff;
    --dcit-surface-alt: #f8f9fa;
    --dcit-border: #dee2e6;
    --dcit-border-strong: #ced4da;
    --dcit-text: #212529;
    --dcit-text-muted: #6c757d;
    --dcit-input-bg: #ffffff;
    --dcit-input-text: #495057;
    --dcit-shadow: rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] {
    --dcit-surface: #1a1d21;
    --dcit-surface-card: #24272b;
    --dcit-surface-navbar: #24272b;
    --dcit-surface-alt: #2b2f34;
    --dcit-border: #3a3f45;
    --dcit-border-strong: #4a4f55;
    --dcit-text: #e6e8ea;
    --dcit-text-muted: #a4aab0;
    --dcit-input-bg: #2b2f34;
    --dcit-input-text: #e6e8ea;
    --dcit-shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

/* -----------------------------------------------------------------
 * Dark: page shell
 * ----------------------------------------------------------------- */
html[data-theme="dark"] body,
html[data-theme="dark"] .wrapper,
html[data-theme="dark"] .content-wrapper,
html[data-theme="dark"] .main-footer {
    background-color: var(--dcit-surface) !important;
    color: var(--dcit-text) !important;
}

html[data-theme="dark"] .main-footer {
    border-top-color: var(--dcit-border) !important;
}

/* -----------------------------------------------------------------
 * Dark: navbar
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .main-header.navbar.navbar-white,
html[data-theme="dark"] .main-header.navbar {
    background-color: var(--dcit-surface-navbar) !important;
    border-bottom-color: var(--dcit-border) !important;
}
html[data-theme="dark"] .main-header.navbar .nav-link,
html[data-theme="dark"] .main-header.navbar .navbar-nav .nav-link {
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .main-header.navbar .nav-link:hover {
    color: var(--dcit-blue-hover) !important;
}

/* -----------------------------------------------------------------
 * Dark: content headers / breadcrumbs
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .content-header h1,
html[data-theme="dark"] .content-header h2,
html[data-theme="dark"] .content-header h3,
html[data-theme="dark"] .breadcrumb {
    color: var(--dcit-text) !important;
    background: transparent !important;
}
html[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before,
html[data-theme="dark"] .breadcrumb-item.active {
    color: var(--dcit-text-muted) !important;
}

/* -----------------------------------------------------------------
 * Dark: cards
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .card {
    background-color: var(--dcit-surface-card) !important;
    color: var(--dcit-text) !important;
    border-color: var(--dcit-border) !important;
    box-shadow: 0 1px 3px var(--dcit-shadow) !important;
}
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
    background-color: var(--dcit-surface-card) !important;
    border-color: var(--dcit-border) !important;
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .card-subtitle {
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .card.card-outline {
    border-top-width: 3px !important;
}

/* -----------------------------------------------------------------
 * Dark: tables
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .table {
    color: var(--dcit-text) !important;
    background-color: transparent !important;
}
html[data-theme="dark"] .table thead th {
    background-color: var(--dcit-surface-alt) !important;
    color: var(--dcit-text) !important;
    border-color: var(--dcit-border) !important;
}
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th {
    border-color: var(--dcit-border) !important;
}
html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.03) !important;
}
html[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .table-bordered,
html[data-theme="dark"] .table-bordered td,
html[data-theme="dark"] .table-bordered th {
    border-color: var(--dcit-border) !important;
}

/* DataTables shell */
html[data-theme="dark"] .dataTables_wrapper .dataTables_length,
html[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
html[data-theme="dark"] .dataTables_wrapper .dataTables_info,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate,
html[data-theme="dark"] .dataTables_wrapper .dataTables_processing {
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .paginate_button {
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .page-link {
    background-color: var(--dcit-surface-card) !important;
    border-color: var(--dcit-border) !important;
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .page-item.active .page-link {
    background-color: var(--dcit-blue) !important;
    border-color: var(--dcit-blue) !important;
    color: #fff !important;
}
html[data-theme="dark"] .page-item.disabled .page-link {
    background-color: var(--dcit-surface-alt) !important;
    color: var(--dcit-text-muted) !important;
}

/* -----------------------------------------------------------------
 * Dark: forms
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .custom-select {
    background-color: var(--dcit-input-bg) !important;
    color: var(--dcit-input-text) !important;
    border-color: var(--dcit-border-strong) !important;
}
html[data-theme="dark"] .form-control::placeholder {
    color: var(--dcit-text-muted) !important;
}
html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-control[readonly] {
    background-color: var(--dcit-surface-alt) !important;
    color: var(--dcit-text-muted) !important;
}
html[data-theme="dark"] .input-group-text {
    background-color: var(--dcit-surface-alt) !important;
    color: var(--dcit-text) !important;
    border-color: var(--dcit-border-strong) !important;
}
html[data-theme="dark"] label,
html[data-theme="dark"] .col-form-label {
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] small,
html[data-theme="dark"] .form-text {
    color: var(--dcit-text-muted) !important;
}
html[data-theme="dark"] .custom-control-label,
html[data-theme="dark"] .form-check-label {
    color: var(--dcit-text) !important;
}

/* -----------------------------------------------------------------
 * Dark: modals, dropdowns, popovers, tooltips
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .modal-content {
    background-color: var(--dcit-surface-card) !important;
    color: var(--dcit-text) !important;
    border-color: var(--dcit-border) !important;
}
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
    border-color: var(--dcit-border) !important;
}
html[data-theme="dark"] .modal-header .close {
    color: var(--dcit-text) !important;
    text-shadow: none !important;
}
html[data-theme="dark"] .modal-backdrop.show { opacity: .7; }

html[data-theme="dark"] .dropdown-menu {
    background-color: var(--dcit-surface-card) !important;
    border-color: var(--dcit-border) !important;
    color: var(--dcit-text) !important;
    box-shadow: 0 6px 18px var(--dcit-shadow) !important;
}
html[data-theme="dark"] .dropdown-item {
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .dropdown-divider {
    border-top-color: var(--dcit-border) !important;
}

html[data-theme="dark"] .popover,
html[data-theme="dark"] .tooltip-inner {
    background-color: var(--dcit-surface-card) !important;
    color: var(--dcit-text) !important;
    border-color: var(--dcit-border) !important;
}

/* -----------------------------------------------------------------
 * Dark: alerts / callouts / list groups / badges
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .list-group-item {
    background-color: var(--dcit-surface-card) !important;
    color: var(--dcit-text) !important;
    border-color: var(--dcit-border) !important;
}
html[data-theme="dark"] .alert {
    border-color: var(--dcit-border) !important;
}
html[data-theme="dark"] .callout {
    background-color: var(--dcit-surface-card) !important;
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] hr {
    border-top-color: var(--dcit-border) !important;
}

/* -----------------------------------------------------------------
 * Dark: nav-tabs
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .nav-tabs {
    border-bottom-color: var(--dcit-border) !important;
}
html[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--dcit-text-muted) !important;
    background: transparent !important;
    border-color: transparent !important;
}
html[data-theme="dark"] .nav-tabs .nav-link:hover {
    border-color: var(--dcit-border) !important;
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: var(--dcit-surface-card) !important;
    border-color: var(--dcit-border) var(--dcit-border) var(--dcit-surface-card) !important;
    color: var(--dcit-text) !important;
}

/* -----------------------------------------------------------------
 * Dark: sidebar (keep green brand, but a touch deeper for contrast)
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .main-sidebar {
    background: linear-gradient(180deg, #052110 0%, #0E3F6A 40%, #16426D 100%) !important;
}

/* -----------------------------------------------------------------
 * Dark: info-box (AdminLTE filter cards)
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .info-box {
    background-color: var(--dcit-surface-card) !important;
    color: var(--dcit-text) !important;
    box-shadow: 0 1px 3px var(--dcit-shadow) !important;
}
html[data-theme="dark"] .info-box .info-box-text,
html[data-theme="dark"] .info-box .info-box-number,
html[data-theme="dark"] .info-box .progress-description {
    color: var(--dcit-text) !important;
}
/* info-box-icon.bg-* variants keep their saturated colors — they're semantic badges */

/* Small-box variants (dashboard tiles) */
html[data-theme="dark"] .small-box > .inner {
    color: #ffffff;
}
html[data-theme="dark"] .small-box > .small-box-footer {
    color: rgba(255, 255, 255, 0.85) !important;
    background: rgba(0, 0, 0, 0.25) !important;
}

/* -----------------------------------------------------------------
 * Dark: vue-tables-2 (.VueTables)
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .VueTables,
html[data-theme="dark"] .VueTables__table {
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .VueTables__table {
    background-color: var(--dcit-surface-card) !important;
}
html[data-theme="dark"] .VueTables__table thead th {
    background-color: var(--dcit-surface-alt) !important;
    color: var(--dcit-text) !important;
    border-color: var(--dcit-border) !important;
}
html[data-theme="dark"] .VueTables__table tbody tr {
    background-color: var(--dcit-surface-card) !important;
}
html[data-theme="dark"] .VueTables__table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
}
html[data-theme="dark"] .VueTables__table td {
    border-color: var(--dcit-border) !important;
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .VueTables__search-field label,
html[data-theme="dark"] .VueTables__limit-field label,
html[data-theme="dark"] .VueTables__wrapper label {
    color: var(--dcit-text) !important;
}
html[data-theme="dark"] .VueTables__search input,
html[data-theme="dark"] .VueTables__limit select {
    background-color: var(--dcit-input-bg) !important;
    color: var(--dcit-input-text) !important;
    border-color: var(--dcit-border-strong) !important;
}
html[data-theme="dark"] .VuePagination__count {
    color: var(--dcit-text-muted) !important;
}

/* -----------------------------------------------------------------
 * Filter-active outline (Vue components use #007bff — recolor to brand)
 * ----------------------------------------------------------------- */
.admission-filter-card.filter-active {
    outline-color: var(--dcit-blue) !important;
}
html[data-theme="dark"] .admission-filter-card.filter-active {
    outline-color: var(--dcit-blue-hover) !important;
}

/* -----------------------------------------------------------------
 * Theme toggle icon spacing
 * ----------------------------------------------------------------- */
#dcit-theme-toggle { cursor: pointer; }
#dcit-theme-toggle i { font-size: 1.05rem; }

/* -----------------------------------------------------------------
 * Dark-mode fixes for Bootstrap's tinted table rows.
 *
 * .table-success / .table-warning / .table-info / .table-danger set
 * a PALE row background (e.g. pale green for payment rows on the
 * Cashier View Ledger). In dark mode the body text was overridden
 * to white/near-white for the rest of the page, giving "white on
 * pale green" = unreadable. Re-tint the row backgrounds to dark
 * variants that read cleanly with light text.
 *
 * Also applies to text-success / text-warning / text-info / text-
 * danger inside those rows (the numeric amount columns use those
 * classes) so colored numbers don't drown into the dark bg.
 * ----------------------------------------------------------------- */
html[data-theme="dark"] .table-success,
html[data-theme="dark"] .table-success > th,
html[data-theme="dark"] .table-success > td {
    background-color: #14432a !important;   /* deep green */
    color: #e6f4ea !important;
}
html[data-theme="dark"] .table-warning,
html[data-theme="dark"] .table-warning > th,
html[data-theme="dark"] .table-warning > td {
    background-color: #4a3b14 !important;   /* deep amber */
    color: #fdf0d1 !important;
}
html[data-theme="dark"] .table-info,
html[data-theme="dark"] .table-info > th,
html[data-theme="dark"] .table-info > td {
    background-color: #163e52 !important;   /* deep teal */
    color: #d4ecfa !important;
}
html[data-theme="dark"] .table-danger,
html[data-theme="dark"] .table-danger > th,
html[data-theme="dark"] .table-danger > td {
    background-color: #4a1a1f !important;   /* deep rose */
    color: #fde0e4 !important;
}

/* Numeric amount cells inside the tinted rows use text-success /
 * text-warning / text-info / text-danger. The default shades read
 * poorly against the deep tinted backgrounds above, so brighten. */
html[data-theme="dark"] .table-success .text-success,
html[data-theme="dark"] .table-warning .text-success,
html[data-theme="dark"] .table-info .text-success {
    color: #7bd1a1 !important;
}
html[data-theme="dark"] .table-success .text-warning,
html[data-theme="dark"] .table-warning .text-warning,
html[data-theme="dark"] .table-info .text-warning {
    color: #ffd480 !important;
}
html[data-theme="dark"] .table-success .text-info,
html[data-theme="dark"] .table-warning .text-info,
html[data-theme="dark"] .table-info .text-info {
    color: #80d4ff !important;
}
html[data-theme="dark"] .table-success .text-danger,
html[data-theme="dark"] .table-warning .text-danger,
html[data-theme="dark"] .table-info .text-danger,
html[data-theme="dark"] .table-danger .text-danger {
    color: #ff8a95 !important;
}

/* -----------------------------------------------------------------
 * Picker list rows (.list-group-item-action) in the active/selected
 * state. Bootstrap sets the background to #007bff (blue) with white
 * foreground, but nested <code>, <small>, and .text-muted keep their
 * default dark/gray — unreadable on blue. Force them to white so a
 * selected picker row reads cleanly in both themes. Scoped to
 * list-group-item-action so we don't touch other .active elements
 * (nav tabs, pagination, etc.).
 * ----------------------------------------------------------------- */
.list-group-item-action.active,
.list-group-item-action.active code,
.list-group-item-action.active small,
.list-group-item-action.active .text-muted,
.list-group-item-action.active .badge {
    color: #fff !important;
}
.list-group-item-action.active code {
    background: rgba(255, 255, 255, 0.15);
}
