/* ==============================================
   ANTI-FLICKER - APPLY THEME IMMEDIATELY
   ============================================== */
/* This section applies critical dark mode styles instantly to prevent flashes on page load. */

/* Body background and text */
html[data-theme='dark'] body {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
}

/* Navbar */
html[data-theme='dark'] .navbar {
    background-color: #2a2a2a !important;
    border-bottom: 1px solid rgba(13, 110, 253, 0.9);
    box-shadow: 0 1px 3px rgba(13, 110, 253, 0.09);
}

/* Page Titles and Menu Text */
html[data-theme='dark'] .menutitle,
html[data-theme='dark'] .menu-text {
    color: white !important;
}

/* --- Login Page Fixes --- */
html[data-theme='dark'] .theme-bg {
    background-color: #2d2d2d !important;
}

html[data-theme='dark'] .theme-card {
    background-color: #3a3a3a !important;
    border-color: #555 !important;
}

html[data-theme='dark'] .theme-text {
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .theme-input,
html[data-theme='dark'] .form-control {
    background-color: #4a4a4a !important;
    border-color: #666 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .input-group-text {
    background-color: #4a4a4a !important;
    border-color: #666 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .theme-divider {
    border-color: #666 !important;
}

html[data-theme='dark'] .theme-link {
    color: #87ceeb !important;
}

/* Buttons */
html[data-theme='dark'] .btn-secondary {
    background-color: #555 !important;
    border-color: #666 !important;
    color: #e0e0e0 !important;
}
html[data-theme='dark'] .btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: white !important;
}


/* --- DataTable Fixes --- */
html[data-theme='dark'] .dataTables_wrapper,
html[data-theme='dark'] .dataTables_length,
html[data-theme='dark'] .dataTables_filter,
html[data-theme='dark'] .dataTables_info,
html[data-theme='dark'] .dataTables_paginate {
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .table td,
html[data-theme='dark'] .table th {
    background-color: #2a2a2a !important;
    border-color: #444 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .table th {
    background-color: #333 !important;
    color: #fff !important;
}

html[data-theme='dark'] .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #333 !important;
}

html[data-theme='dark'] .dataTables_filter input[type="search"] {
    background-color: #3a3a3a !important;
    border: 2px solid #555 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .dataTables_length select {
    background-color: #3a3a3a !important;
    border: 2px solid #555 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .page-link {
    background-color: #3a3a3a !important;
    border-color: #555 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .page-item.disabled .page-link {
    background-color: #2a2a2a !important;
    border-color: #444 !important;
    color: #666 !important;
}


/* ==============================================
   Base theme transitions
   ============================================== */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}


/* ==============================================
   DARK MODE THEME SYSTEM - CONSOLIDATED CSS
   ============================================== */

/* Dark theme body styles */
body[data-theme="dark"] {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
}

/* ==============================================
   THEME BACKGROUNDS
   ============================================== */
.theme-bg {
    transition: background-color 0.3s ease;
}

body[data-theme="dark"] .theme-bg {
    background-color: #2d2d2d !important;
}

/* ==============================================
   THEME CARDS
   ============================================== */
.theme-card {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body[data-theme="dark"] .theme-card {
    background-color: #3a3a3a !important;
    border-color: #555 !important;
}

/* ==============================================
   THEME TEXT
   ============================================== */

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

/* Menu text (hamburger menu) */
.menu-text {
    color: black;
}

body[data-theme="dark"] .menu-text {
    color: white !important;
}

/* Menu titles */


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

/* Container and general text */
body[data-theme="dark"] .container {
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .text-center {
    color: #e0e0e0 !important;
}

body[data-theme="dark"] div,
body[data-theme="dark"] span,
body[data-theme="dark"] p {
    color: inherit;
}

body[data-theme="dark"] center {
    color: inherit;
}

/* ==============================================
   THEME INPUTS AND FORMS
   ============================================== */
.theme-input {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body[data-theme="dark"] .theme-input {
    background-color: #4a4a4a !important;
    border-color: #666 !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .theme-input:focus {
    background-color: #5a5a5a !important;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* Form controls (select dropdowns, inputs) */
body[data-theme="dark"] .form-control {
    background-color: #4a4a4a !important;
    border-color: #666 !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .form-control:focus {
    background-color: #5a5a5a !important;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .form-control option {
    background-color: #4a4a4a !important;
    color: #e0e0e0 !important;
}

/* Theme input groups */
.theme-input-group {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body[data-theme="dark"] .theme-input-group {
    background-color: #4a4a4a !important;
    border-color: #666 !important;
    color: #e0e0e0 !important;
}

/* Input group text (labels like "Phone Number", "Email", etc.) */
body[data-theme="dark"] .input-group-text {
    background-color: #4a4a4a !important;
    border-color: #666 !important;
    color: #e0e0e0 !important;
    font-weight: 500;
}

body[data-theme="dark"] .input-group:hover .input-group-text {
    background-color: #5a5a5a !important;
    border-color: #777 !important;
}

body[data-theme="dark"] .input-group:focus-within .input-group-text {
    background-color: #5a5a5a !important;
    border-color: #0d6efd !important;
    color: #fff !important;
}

body[data-theme="dark"] .input-group > .input-group-text {
    border-right: 1px solid #666 !important;
}

body[data-theme="dark"] .input-group > .form-control:not(:first-child) {
    border-left: 1px solid #666 !important;
}

/* Light mode input group text */
body[data-theme="light"] .input-group-text {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    color: #495057 !important;
    font-weight: 500;
}

/* Icons inside input group text */
body[data-theme="dark"] .input-group-text svg,
body[data-theme="dark"] .input-group-text i {
    color: #e0e0e0 !important;
}

/* Hidden inputs */
body[data-theme="dark"] input[type="hidden"] {
    background-color: transparent !important;
}

/* Form validation text */
body[data-theme="dark"] .text-danger {
    color: #ff6b6b !important;
}

/* ==============================================
   PLACEHOLDER TEXT STYLES
   ============================================== */
body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder,
body[data-theme="dark"] select::placeholder {
    color: #aaa !important;
    opacity: 1 !important;
}

body[data-theme="dark"] .theme-input::placeholder {
    color: #bbb !important;
    opacity: 1 !important;
}

body[data-theme="dark"] .form-control::placeholder {
    color: #aaa !important;
    opacity: 1 !important;
}

body[data-theme="dark"] .form-control:focus::placeholder,
body[data-theme="dark"] .theme-input:focus::placeholder {
    color: #ccc !important;
    opacity: 0.8 !important;
}

/* Cross-browser placeholder support */
body[data-theme="dark"] input::-moz-placeholder,
body[data-theme="dark"] textarea::-moz-placeholder {
    color: #aaa !important;
    opacity: 1 !important;
}

body[data-theme="dark"] input::-webkit-input-placeholder,
body[data-theme="dark"] textarea::-webkit-input-placeholder {
    color: #aaa !important;
    opacity: 1 !important;
}

body[data-theme="dark"] input::-ms-input-placeholder,
body[data-theme="dark"] textarea::-ms-input-placeholder {
    color: #aaa !important;
    opacity: 1 !important;
}

/* Light mode placeholders */
body[data-theme="light"] input::placeholder,
body[data-theme="light"] textarea::placeholder,
body[data-theme="light"] select::placeholder {
    color: #6c757d !important;
    opacity: 1 !important;
}

/* ==============================================
   THEME LINKS
   ============================================== */
body[data-theme="dark"] .theme-link {
    color: #87ceeb !important;
}

body[data-theme="dark"] .theme-link:hover {
    color: #add8e6 !important;
}

/* ==============================================
   THEME DIVIDERS
   ============================================== */
.theme-divider {
    transition: border-color 0.3s ease;
}

body[data-theme="dark"] .theme-divider {
    border-color: #666 !important;
}

/* ==============================================
   THEME TOGGLE BUTTON (SUN/MOON)
   ============================================== */
#themeToggle {
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#themeToggle:hover {
    transform: scale(1.1);
}

/* Light theme button appearance */
#themeToggle {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
    color: #333 !important;
}

#themeToggle:hover {
    background-color: rgba(245, 245, 245, 0.95) !important;
    border-color: rgba(0, 0, 0, 0.3) !important;
}

/* Dark theme button appearance */
body[data-theme="dark"] #themeToggle {
    background-color: rgba(58, 58, 58, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] #themeToggle:hover {
    background-color: rgba(90, 90, 90, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

/* Sun/Moon icon visibility */
.theme-icon-light {
    display: block !important;
}

.theme-icon-dark {
    display: none !important;
}

body[data-theme="dark"] .theme-icon-light {
    display: none !important;
}

body[data-theme="dark"] .theme-icon-dark {
    display: block !important;
}

/* SVG icon sizing */
#themeToggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Bootstrap d-none class override */
#themeToggle .theme-icon-dark.d-none {
    display: none !important;
}

body[data-theme="dark"] #themeToggle .theme-icon-dark.d-none {
    display: block !important;
}

/* ==============================================
   NAVBAR STYLES
   ============================================== */
.navbar {
    background-color: #191970 !important;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Navigation links */
.navbar .nav-link {
    color: white !important;
    transition: color 0.3s ease, background-color 0.3s ease;
    padding: 0.5rem 1rem;
    margin: 0 2px;
    border-radius: 5px;
}

html[data-theme="dark"] .navbar .nav-link {
    color: white !important;
}

html[data-theme="dark"] .navbar .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    transform: translateY(-1px);
}

/* Navbar toggler styles */
.navbar-toggler {
    background-color: lightgray !important;
    border-color: #ccc !important;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

html[data-theme="dark"] .navbar-toggler {
    background-color: #555 !important;
    border-color: #666 !important;
}

.navbar-toggler-icon {
    color: white !important;
    transition: color 0.3s ease;
}

html[data-theme="dark"] .navbar-toggler-icon {
    color: white !important;
}

/* ==============================================
   SIDENAV STYLES
   ============================================== */
body[data-theme="dark"] .sidenav {
    background-color: #333 !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .sidenav a {
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .sidenav a:hover {
    background-color: #555 !important;
    color: #fff !important;
}

body[data-theme="dark"] .sidenav .closebtn {
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .sidenav .closebtn:hover {
    color: #fff !important;
}

/* ==============================================
   BUTTON STYLES
   ============================================== */
body[data-theme="dark"] .btn-secondary {
    background-color: #555 !important;
    border-color: #666 !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .btn-secondary:hover {
    background-color: #666 !important;
    border-color: #777 !important;
}

body[data-theme="dark"] .btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: white !important;
}

body[data-theme="dark"] .btn-primary:hover {
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
}

body[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
}

body[data-theme="dark"] .btn-close:hover {
    opacity: 1;
}

/* ==============================================
   DATATABLES STYLES
   ============================================== */
/* Base table styling */
body[data-theme="dark"] .table {
    color: #e0e0e0 !important;
    background-color: transparent !important;
}

/* Table borders and cells */
body[data-theme="dark"] .table td,
body[data-theme="dark"] .table th {
    border-color: #444 !important;
    background-color: #2a2a2a !important;
    color: #e0e0e0 !important;
}

/* Table headers */
body[data-theme="dark"] .table th {
    background-color: #333 !important;
    color: #fff !important;
    font-weight: 600 !important;
    border-bottom: 2px solid #555 !important;
}

/* Striped rows */
body[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #333 !important;
}

body[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > td {
    background-color: #2a2a2a !important;
}

/* Hover effects */
body[data-theme="dark"] .table-hover > tbody > tr:hover > td {
    background-color: #3a3a3a !important;
    color: #fff !important;
}

/* DataTables wrapper and controls */
body[data-theme="dark"] .dataTables_wrapper {
    color: #e0e0e0 !important;
    background-color: transparent !important;
    margin-top: 20px;
    padding: 0;
}

body[data-theme="dark"] .dataTables_wrapper .dataTables_length,
body[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
body[data-theme="dark"] .dataTables_wrapper .dataTables_info,
body[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: #e0e0e0 !important;
    margin-bottom: 10px !important;
}

body[data-theme="dark"] .dataTables_wrapper .dataTables_length label,
body[data-theme="dark"] .dataTables_wrapper .dataTables_filter label {
    color: #e0e0e0 !important;
    font-weight: normal !important;
}

/* Search input styling */
body[data-theme="dark"] .dataTables_wrapper .dataTables_filter input[type="search"] {
    background-color: #3a3a3a !important;
    border: 2px solid #555 !important;
    color: #e0e0e0 !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    margin-left: 8px !important;
}

body[data-theme="dark"] .dataTables_wrapper .dataTables_filter input[type="search"]:focus {
    background-color: #444 !important;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    outline: none !important;
}

body[data-theme="dark"] .dataTables_filter input[type="search"]::placeholder {
    color: #bbb !important;
    opacity: 1 !important;
}

/* Length selector */
body[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: #3a3a3a !important;
    border: 2px solid #555 !important;
    color: #e0e0e0 !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    margin: 0 8px !important;
}

body[data-theme="dark"] .dataTables_wrapper .dataTables_length select option {
    background-color: #3a3a3a !important;
    color: #e0e0e0 !important;
}

/* Pagination styling */
body[data-theme="dark"] .page-link {
    background-color: #3a3a3a !important;
    border-color: #555 !important;
    color: #e0e0e0 !important;
    padding: 8px 12px !important;
}

body[data-theme="dark"] .page-link:hover {
    background-color: #444 !important;
    border-color: #666 !important;
    color: #fff !important;
}

body[data-theme="dark"] .page-item.active .page-link {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: white !important;
}

body[data-theme="dark"] .page-item.disabled .page-link {
    background-color: #2a2a2a !important;
    border-color: #444 !important;
    color: #666 !important;
}

/* DataTables Buttons */
body[data-theme="dark"] .dt-buttons .btn {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: white !important;
}

body[data-theme="dark"] .dt-buttons .btn:hover {
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3) !important;
}

/* Sorting and other elements */
body[data-theme="dark"] .dataTables_wrapper .dataTables_sort,
body[data-theme="dark"] .dataTables_wrapper .dataTables_sort_asc,
body[data-theme="dark"] .dataTables_wrapper .dataTables_sort_desc {
    color: #e0e0e0 !important;
    cursor: pointer;
}

body[data-theme="dark"] .dataTables_wrapper .dataTables_sort:after,
body[data-theme="dark"] .dataTables_wrapper .dataTables_sort_asc:after,
body[data-theme="dark"] .dataTables_wrapper .dataTables_sort_desc:after {
    color: #999 !important;
}

body[data-theme="dark"] .dataTables_processing {
    background-color: #333 !important;
    color: #e0e0e0 !important;
    border: 1px solid #555 !important;
    border-radius: 6px !important;
    padding: 20px !important;
}

body[data-theme="dark"] .dataTables_empty {
    color: #e0e0e0 !important;
    font-style: italic;
    padding: 30px !important;
}

body[data-theme="dark"] .dataTables_info {
    color: #ccc !important;
    font-size: 14px !important;
}

/* ==============================================
   CHART STYLES
   ============================================== */
/* Chart containers */
canvas {
    border-radius: 8px;
    transition: all 0.3s ease;
}

body[data-theme="dark"] canvas {
    background-color: #3a3a3a !important;
    border: 1px solid #555 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body[data-theme="light"] canvas {
    background-color: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Chart wrapper divs */
div[style*="height: 250px"] {
    padding: 15px;
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

body[data-theme="dark"] div[style*="height: 250px"] {
    background-color: #2a2a2a;
    border: 1px solid #444;
}

body[data-theme="light"] div[style*="height: 250px"] {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* Chart container class */
.chart-container {
    position: relative;
    height: 250px;
    max-width: 1500px;
    margin: 0 auto 20px auto;
    padding: 15px;
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

body[data-theme="dark"] .chart-container {
    background-color: #2a2a2a;
    border: 1px solid #444;
}

body[data-theme="light"] .chart-container {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* Specific chart containers */
#chartDiv {
    padding: 15px;
    border-radius: 10px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    margin: 20px auto;
}

body[data-theme="dark"] #chartDiv {
    background-color: #2a2a2a;
    border: 1px solid #444;
}

body[data-theme="light"] #chartDiv {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

body[data-theme="dark"] #chartDiv canvas {
    background-color: #3a3a3a !important;
    border: 1px solid #555 !important;
}

body[data-theme="light"] #chartDiv canvas {
    background-color: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
}

/* Specific chart IDs */
body[data-theme="dark"] #myChart,
body[data-theme="dark"] #myDChart {
    background-color: #3a3a3a !important;
    border: 1px solid #555 !important;
    border-radius: 8px;
}

/* ==============================================
   ALERT STYLES
   ============================================== */
body[data-theme="dark"] .alert-success {
    background-color: rgba(25, 135, 84, 0.2) !important;
    border-color: rgba(25, 135, 84, 0.4) !important;
    color: #90ee90 !important;
}

body[data-theme="dark"] .alert-secondary {
    background-color: rgba(108, 117, 125, 0.2) !important;
    border-color: rgba(108, 117, 125, 0.4) !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .alert-primary {
    background-color: rgba(13, 110, 253, 0.2) !important;
    border-color: rgba(13, 110, 253, 0.4) !important;
    color: #87ceeb !important;
}

body[data-theme="dark"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.2) !important;
    border-color: rgba(255, 193, 7, 0.4) !important;
    color: #ffd700 !important;
}

body[data-theme="dark"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.2) !important;
    border-color: rgba(220, 53, 69, 0.4) !important;
    color: #ff6b6b !important;
}

body[data-theme="dark"] .alert-info {
    background-color: rgba(13, 202, 240, 0.2) !important;
    border-color: rgba(13, 202, 240, 0.4) !important;
    color: #7dd3fc !important;
}

body[data-theme="dark"] .alert-light {
    background-color: rgba(248, 249, 250, 0.1) !important;
    border-color: rgba(248, 249, 250, 0.2) !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .alert-dark {
    background-color: rgba(33, 37, 41, 0.3) !important;
    border-color: rgba(33, 37, 41, 0.5) !important;
    color: #e0e0e0 !important;
}

/* Alert links */
body[data-theme="dark"] .alert a {
    color: inherit !important;
    text-decoration: underline;
}

body[data-theme="dark"] .alert-success a {
    color: #b8f5b8 !important;
}

body[data-theme="dark"] .alert-primary a {
    color: #a8d8ff !important;
}

body[data-theme="dark"] .alert-warning a {
    color: #ffe066 !important;
}

body[data-theme="dark"] .alert-danger a {
    color: #ff9999 !important;
}

body[data-theme="dark"] .alert-info a {
    color: #99e6ff !important;
}

/* ==============================================
   MODAL STYLES
   ============================================== */
body[data-theme="dark"] .modal-content {
    background-color: #3a3a3a !important;
    border-color: #555 !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .modal-header {
    border-color: #555 !important;
}

body[data-theme="dark"] .modal-footer {
    border-color: #555 !important;
}

body[data-theme="dark"] .modal-title {
    color: #e0e0e0 !important;
}

/* ==============================================
   FOOTER STYLES
   ============================================== */
body[data-theme="dark"] .footer {
    background-color: #2a2a2a !important;
    border-color: #444 !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .footer.text-muted {
    color: #e0e0e0 !important;
}

/* ==============================================
   RESPONSIVE STYLES
   ============================================== */
@media (max-width: 576px) {
    .theme-toggle-nav {
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    html[data-theme="dark"] .navbar-nav {
        background-color: #2a2a2a !important;
        padding: 10px;
        border-radius: 5px;
        margin-top: 10px;
    }
    
    body[data-theme="dark"] .table td,
    body[data-theme="dark"] .table th {
        padding: 8px 4px !important;
        font-size: 14px;
    }
    
    body[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
    body[data-theme="dark"] .dataTables_wrapper .dataTables_length {
        text-align: center;
        margin-bottom: 15px;
    }
}



/* ==============================================
   TABLE HEADER FIXES FOR LIGHT MODE
   ============================================== */

/* Override dark headers in light mode */
body[data-theme="light"] .table th {
    background-color: #ffffff !important;
    color: #495057 !important;
    border-color: #dee2e6 !important;
    font-weight: 600 !important;
}

/* Ensure light mode striped tables have proper colors */
body[data-theme="light"] .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

body[data-theme="light"] .table-striped > tbody > tr:nth-of-type(even) > td {
    background-color: #ffffff !important;
}

/* Light mode table cells */
body[data-theme="light"] .table td {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #dee2e6 !important;
}

/* Light mode hover effects */
body[data-theme="light"] .table-hover > tbody > tr:hover > td {
    background-color: rgba(0, 0, 0, 0.075) !important;
    color: #212529 !important;
}


/* ==============================================
   LIGHT MODE DATATABLES STYLING TO MATCH DARK MODE
   ============================================== */

body[data-theme="light"] .dt-buttons .btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3) !important;
}

/* Light mode search input - match dark mode styling */
body[data-theme="light"] .dataTables_wrapper .dataTables_filter input[type="search"] {
    border: 2px solid #ced4da !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    margin-left: 8px !important;
}

body[data-theme="light"] .dataTables_wrapper .dataTables_filter input[type="search"]:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    outline: none !important;
}

/* Light mode length selector - match dark mode styling */
body[data-theme="light"] .dataTables_wrapper .dataTables_length select {
    border: 2px solid #ced4da !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    margin: 0 8px !important;
}

/* Light mode pagination - match dark mode padding */
body[data-theme="light"] .page-link {
    padding: 8px 12px !important;
}

/* Light mode DataTables wrapper spacing */
body[data-theme="light"] .dataTables_wrapper {
    margin-top: 20px;
    padding: 0;
}

body[data-theme="light"] .dataTables_wrapper .dataTables_length,
body[data-theme="light"] .dataTables_wrapper .dataTables_filter,
body[data-theme="light"] .dataTables_wrapper .dataTables_info,
body[data-theme="light"] .dataTables_wrapper .dataTables_paginate {
    margin-bottom: 10px !important;
}

body[data-theme="light"] .dataTables_wrapper .dataTables_length label,
body[data-theme="light"] .dataTables_wrapper .dataTables_filter label {
    font-weight: normal !important;
}


/* ==============================================
   LIGHT MODE NAVBAR HOVER EFFECT
   ============================================== */
/* Light mode navigation hover effect - MUST include the theme selector */
body[data-theme="light"] .navbar .nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.2) !important; /* Light white overlay on the blue background */
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 5px;
}

/* Ensure light mode nav links have proper transition */
body[data-theme="light"] .navbar .nav-link {
    transition: all 0.3s ease;
    color: white !important; /* Ensure text is white in light mode */
}

/* ==============================================
   STATS SECTION DARK MODE STYLES
   ============================================== */

/* Stats section container */
body[data-theme="dark"] .stats-section {
    color: #e0e0e0 !important;
}

/* Individual stat cards */
body[data-theme="dark"] .stat-card {
    background-color: #2c2c2e !important;
    border: 1px solid #48484a !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    color: #e0e0e0 !important;
}

/* Stat numbers */
body[data-theme="dark"] .stat-number {
    color: #4fc3f7 !important; /* Light blue for better contrast */
}

/* Stat labels */
body[data-theme="dark"] .stat-label {
    color: #b0b0b0 !important; /* Light grey for better readability */
}

/* Management container and related elements */
body[data-theme="dark"] .management-container {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .management-title {
    color: #ffffff !important;
}

body[data-theme="dark"] .header-section {
    background: linear-gradient(135deg, #3a3a3c, #48484a) !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .location-info {
    color: #b0b0b0 !important;
}

body[data-theme="dark"] .location-name {
    color: #4fc3f7 !important;
}

body[data-theme="dark"] .calendar-section {
    background-color: #2c2c2e !important;
    border: 1px solid #48484a !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

body[data-theme="dark"] .calendar-header {
    background: linear-gradient(135deg, #3a3a3c, #48484a) !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .calendar-title {
    color: #ffffff !important;
}

/* Legend items */
body[data-theme="dark"] .legend-item {
    color: #e0e0e0 !important;
}

/* ==============================================
   BUSINESS HOURS PAGE DARK MODE STYLES
   ============================================== */

/* Main container and card */
body[data-theme="dark"] .contact-container {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .contact-card {
    background-color: #2c2c2e !important;
    border-color: #48484a !important;
    color: #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}

body[data-theme="dark"] .contact-title {
    color: #ffffff !important;
}

/* Logo section */
body[data-theme="dark"] .logo-section {
    background-color: #2c2c2e !important;
}

/* Intro text and info cards */
body[data-theme="dark"] .intro-text {
    background: linear-gradient(135deg, #3a3a3c, #48484a) !important;
    color: #ffffff !important;
    border-left-color: #0282be !important;
}

body[data-theme="dark"] .info-card {
    background-color: #3a3a3c !important;
    border-left-color: #0282be !important;
}

/* Form elements */
body[data-theme="dark"] .form-label {
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .form-select {
    background-color: #3a3a3c !important;
    border-color: #48484a !important;
    color: #ffffff !important;
}

body[data-theme="dark"] .form-select:focus {
    background-color: #4a4a4c !important;
    border-color: #0282be !important;
    box-shadow: 0 0 0 3px rgba(2, 130, 190, 0.25) !important;
}

body[data-theme="dark"] .form-select option {
    background-color: #3a3a3c !important;
    color: #ffffff !important;
}

/* Hours container and header */
body[data-theme="dark"] .hours-container {
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .hours-header {
    background: linear-gradient(135deg, #3a3a3c, #48484a) !important;
    color: #ffffff !important;
    border-left-color: #0282be !important;
}

/* Day rows */
body[data-theme="dark"] .day-row {
    background-color: #2c2c2e !important;
    border-color: #48484a !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .day-row:hover {
    border-color: #0282be !important;
    box-shadow: 0 2px 8px rgba(2, 130, 190, 0.3) !important;
}

body[data-theme="dark"] .day-row.closed {
    background-color: #3a3a3c !important;
    opacity: 0.7;
}

body[data-theme="dark"] .day-name {
    color: #ffffff !important;
}

/* Input fields */
body[data-theme="dark"] .time-input,
body[data-theme="dark"] .notes-input {
    background-color: #3a3a3c !important;
    border-color: #48484a !important;
    color: #ffffff !important;
}

body[data-theme="dark"] .time-input:focus,
body[data-theme="dark"] .notes-input:focus {
    background-color: #4a4a4c !important;
    border-color: #0282be !important;
    box-shadow: 0 0 0 2px rgba(2, 130, 190, 0.25) !important;
}

body[data-theme="dark"] .time-input:disabled,
body[data-theme="dark"] .notes-input:disabled {
    background-color: #3a3a3c !important;
    color: #666 !important;
    opacity: 0.6;
}

body[data-theme="dark"] .time-input::placeholder,
body[data-theme="dark"] .notes-input::placeholder {
    color: #aaa !important;
}

/* Grid header */
body[data-theme="dark"] .hours-grid-header {
    background: linear-gradient(135deg, #0282be, #0167a3) !important;
    color: white !important;
}

/* Buttons */
body[data-theme="dark"] .btn-primary-custom {
    background: linear-gradient(135deg, #0282be, #0167a3) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(2, 130, 190, 0.4) !important;
}

body[data-theme="dark"] .btn-primary-custom:hover {
    background: linear-gradient(135deg, #0167a3, #014c7a) !important;
    box-shadow: 0 6px 20px rgba(2, 130, 190, 0.5) !important;
}

body[data-theme="dark"] .btn-secondary {
    background: linear-gradient(135deg, #5a6268, #484e53) !important;
    border-color: #666 !important;
    color: white !important;
}

body[data-theme="dark"] .btn-secondary:hover {
    background: linear-gradient(135deg, #484e53, #3a3f44) !important;
    color: white !important;
}

/* Quick action buttons */
body[data-theme="dark"] .quick-btn {
    background-color: #4a4a4c !important;
    border-color: #48484a !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .quick-btn:hover {
    background-color: #0282be !important;
    color: white !important;
}

/* Alert styles - extend existing ones if needed */
body[data-theme="dark"] .alert-success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.2), rgba(40, 167, 69, 0.1)) !important;
    color: #90ee90 !important;
    border-left-color: #28a745 !important;
}

body[data-theme="dark"] .alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.2), rgba(220, 53, 69, 0.1)) !important;
    color: #ff6b6b !important;
    border-left-color: #dc3545 !important;
}

body[data-theme="dark"] .alert-info {
    background: linear-gradient(135deg, rgba(2, 130, 190, 0.2), rgba(2, 130, 190, 0.1)) !important;
    color: #87ceeb !important;
    border-left-color: #0282be !important;
}

/* Checkbox styling */
body[data-theme="dark"] .day-checkbox {
    filter: brightness(1.2) contrast(1.1);
    accent-color: #0282be;
}

/* Location selection specific */
body[data-theme="dark"] .location-selection {
    background-color: #3a3a3c !important;
    border-left-color: #0282be !important;
}

/* Progress indicator if you add one later */
body[data-theme="dark"] .progress-steps {
    background: linear-gradient(135deg, #3a3a3c, #48484a) !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .step.completed {
    color: #90ee90 !important;
}

body[data-theme="dark"] .step.current {
    color: #87ceeb !important;
}

body[data-theme="dark"] .step.upcoming {
    color: #aaa !important;
}

body[data-theme="dark"] .step-arrow {
    color: #666 !important;
}

/* ==============================================
   BUSINESS HOURS PAGE ANTI-FLICKER
   ============================================== */
/* Add this at the very top of your <style> block */

html[data-theme='dark'] .contact-container {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .contact-card {
    background-color: #2c2c2e !important;
    border-color: #48484a !important;
    color: #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme='dark'] .contact-title {
    color: #ffffff !important;
}

html[data-theme='dark'] .intro-text {
    background: linear-gradient(135deg, #3a3a3c, #48484a) !important;
    color: #ffffff !important;
}

html[data-theme='dark'] .info-card {
    background-color: #3a3a3c !important;
}

html[data-theme='dark'] .form-select {
    background-color: #3a3a3c !important;
    border-color: #48484a !important;
    color: #ffffff !important;
}

html[data-theme='dark'] .form-select option {
    background-color: #3a3a3c !important;
    color: #ffffff !important;
}

html[data-theme='dark'] .form-label {
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .hours-header {
    background: linear-gradient(135deg, #3a3a3c, #48484a) !important;
    color: #ffffff !important;
}

html[data-theme='dark'] .day-row {
    background-color: #2c2c2e !important;
    border-color: #48484a !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .day-row.closed {
    background-color: #3a3a3c !important;
}

html[data-theme='dark'] .day-name {
    color: #ffffff !important;
}

html[data-theme='dark'] .time-input,
html[data-theme='dark'] .notes-input {
    background-color: #3a3a3c !important;
    border-color: #48484a !important;
    color: #ffffff !important;
}

html[data-theme='dark'] .hours-grid-header {
    background: linear-gradient(135deg, #0282be, #0167a3) !important;
    color: white !important;
}

html[data-theme='dark'] .quick-btn {
    background-color: #4a4a4c !important;
    color: #e0e0e0 !important;
}

.alert.alert-demo {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef); /* light grey gradient */
    color: #333;
    border-left: 4px solid #0282be; /* brand blue */
    border-top: none;
    border-right: none;
    border-bottom: none;
}

html[data-theme='dark'] .alert.alert-demo {
    background: linear-gradient(135deg, #2c2c2e, #3a3a3c);
    color: #e0e0e0;
    border-left: 4px solid #0282be;
    border-top: none;
    border-right: none;
    border-bottom: none;
}

/* ==============================================
   APPOINTMENT MANAGEMENT - MISSING DARK THEME STYLES
   ============================================== */

/* FullCalendar dark theme */
body[data-theme="dark"] .fc {
    background-color: #2c2c2e !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .fc-theme-standard .fc-button {
    background: linear-gradient(135deg, #0282be, #0167a3) !important;
    border-color: #0282be !important;
    color: white !important;
}

body[data-theme="dark"] .fc-theme-standard .fc-button:hover {
    background: linear-gradient(135deg, #0167a3, #014c7a) !important;
}

body[data-theme="dark"] .fc-theme-standard .fc-button:disabled {
    background-color: #555 !important;
    border-color: #666 !important;
    opacity: 0.6;
}

body[data-theme="dark"] .fc-theme-standard td,
body[data-theme="dark"] .fc-theme-standard th {
    border-color: #48484a !important;
}

body[data-theme="dark"] .fc-col-header-cell {
    background-color: #3a3a3c !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .fc-daygrid-day {
    background-color: #2c2c2e !important;
}

body[data-theme="dark"] .fc-daygrid-day-number {
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .fc-timegrid-slot {
    border-color: #48484a !important;
}

body[data-theme="dark"] .fc-timegrid-axis {
    background-color: #3a3a3c !important;
    color: #e0e0e0 !important;
}

body[data-theme="dark"] .fc-timegrid-slot-label {
    color: #e0e0e0 !important;
}

/* Modal overlay darker */
body[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* Event detail content in modals */
body[data-theme="dark"] #eventDetailsContent div {
    color: #e0e0e0 !important;
}

body[data-theme="dark"] #eventDetailsContent strong {
    color: #ffffff !important;
}

/* Date/time input color scheme fix */
body[data-theme="dark"] input[type="date"].form-control,
body[data-theme="dark"] input[type="time"].form-control {
    color-scheme: dark;
}

/* ===== BookAppointment.cshtml — Dark theme fixes ===== */
html[data-theme='dark'] .booking-container{
  background:#2c2c2e !important;
  border:1px solid #48484a !important;
  box-shadow:0 6px 22px rgba(0,0,0,.45) !important;
  color:#e0e0e0 !important;
}

html[data-theme='dark'] .booking-header{
  border-bottom:2px solid #3f3f41 !important;
}
html[data-theme='dark'] .booking-title{
  color:#4fc3f7 !important; /* brighter brand blue for contrast */
}
html[data-theme='dark'] .booking-subtitle{
  color:#c7cdd4 !important; /* replaces #6c757d */
}

/* “Appointment summary” banner */
html[data-theme='dark'] .appointment-info{
  background:linear-gradient(135deg,#2c2c2e,#3a3a3c) !important;
  border-left:4px solid #0282be !important;
  color:#e0e0e0 !important;
}
html[data-theme='dark'] .appointment-info-label{ color:#e6eaee !important; }
html[data-theme='dark'] .appointment-info-value{ color:#9bd1ff !important; }

/* Section headers & dividers */
html[data-theme='dark'] .section-title{
  color:#e0e0e0 !important;
  border-bottom:2px solid #3f3f41 !important;
}

/* Labels and inline greys used here */
html[data-theme='dark'] .form-label{ color:#e0e0e0 !important; }

/* Inputs (kept page-scoped even though you theme forms globally) */
html[data-theme='dark'] .booking-container .form-control{
  background:#3a3a3c !important;
  border:2px solid #5a5b5d !important;
  color:#e0e0e0 !important;
}
html[data-theme='dark'] .booking-container .form-control:focus{
  border-color:#0282be !important;
  box-shadow:0 0 0 3px rgba(2,130,190,.25) !important;
}
html[data-theme='dark'] .booking-container .form-control::placeholder{
  color:#aaaaaa !important;
  opacity:1 !important;
}

/* Validation text */
html[data-theme='dark'] .invalid-feedback{ color:#ff9aa2 !important; }

/* Action row divider */
html[data-theme='dark'] .form-actions{
  border-top:2px solid #3f3f41 !important;
}

/* Buttons on this page share .btn-primary/.btn-secondary; ensure text contrast */
html[data-theme='dark'] .btn-booking{ color:#fff !important; }

/* Danger alert shown from TempData */
html[data-theme='dark'] .alert.alert-danger{
  background:linear-gradient(135deg,rgba(220,53,69,.14),rgba(220,53,69,.10)) !important;
  color:#ffc2c7 !important;
  border-left-color:#dc3545 !important;
}

/* Ensure icons follow text color */
html[data-theme='dark'] .booking-container i{ color:currentColor !important; }

/* Native pickers */
html[data-theme='dark'] input[type="date"].form-control,
html[data-theme='dark'] input[type="time"].form-control{ color-scheme:dark; }

/* ==============================================
   TEXT UTILITY CLASSES - DARK MODE
   ============================================== */

/* Muted text */
body[data-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

html[data-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

/* Other Bootstrap text utilities */
body[data-theme="dark"] .text-secondary {
    color: #adb5bd !important;
}

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

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

body[data-theme="dark"] .text-white {
    color: #ffffff !important;
}

/* Small text */
body[data-theme="dark"] small,
body[data-theme="dark"] .small {
    color: inherit;
}

/* ==============================================
   FORGOT/RESET PASSWORD - ANTI-FLICKER
   ============================================== */

html[data-theme='dark'] .text-muted {
    color: #adb5bd !important;
}
