[data-bs-theme="light"] .table.table-bordered,
[data-bs-theme="light"] .table.table-bordered> :not(caption)>*,
[data-bs-theme="light"] .table.table-bordered> :not(caption)>*>* {
  border-color: #d1d5db !important;
}

/* Avoid double-thick edges: remove outer table border, keep cell borders */
[data-bs-theme="light"] .table.table-bordered {
  border: 0 !important;
}

[data-bs-theme="light"] .table.table-bordered thead th {
  border-bottom-color: #d1d5db !important;
}

/* Global Font Size and Content Area Adjustments */

/* Adjust page heading font sizes */
.page-heading.fs-3 {
  font-size: 1.4rem !important;
  /* Slightly reduced from ~1.5rem */
}

.page-heading.fs-2x {
  font-size: 1.7rem !important;
  /* Slightly reduced from ~2rem */
}

/* Adjust toolbar padding */
.app-toolbar.py-3.py-lg-6 {
  padding-top: 1rem !important;
  /* Slightly reduced from original */
  padding-bottom: 1rem !important;
  /* Slightly reduced from original */
}

.app-toolbar.py-4.py-lg-7 {
  padding-top: 1rem !important;
  /* Slightly reduced from original */
  padding-bottom: 1rem !important;
  /* Slightly reduced from original */
}

@media (min-width: 992px) {
  .app-toolbar.py-3.py-lg-6 {
    padding-top: 1.35rem !important;
    /* Slightly reduced from 1.5rem */
    padding-bottom: 1.35rem !important;
    /* Slightly reduced from 1.5rem */
  }

  .app-toolbar.py-4.py-lg-7 {
    padding-top: 1.35rem !important;
    /* Slightly reduced from 1.75rem */
    padding-bottom: 1.35rem !important;
    /* Slightly reduced from 1.75rem */
  }
}

/* Adjust content container padding */
#kt_app_content_container.app-container {
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

@media (min-width: 992px) {
  #kt_app_content_container.app-container {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
}

/* Adjust card body padding */
.card-body {
  padding: 1.35rem !important;
  /* Slightly reduced from default 1.5rem */
}

/* Adjust form control font size */
.form-control,
.form-select {
  font-size: 0.95rem !important;
  /* Slightly smaller */
}

.form-label {
  font-size: 0.925rem !important;
  /* Slightly smaller */
}

/* Adjust table font size */
.table {
  font-size: 0.925rem !important;
}

.table th {
  font-size: 0.925rem !important;
  padding: 0.75rem 1rem !important;
  /* Slightly reduced padding */
}

.table td {
  padding: 0.75rem 1rem !important;
  /* Slightly reduced padding */
}

/* Adjust button font size */
.btn {
  font-size: 0.925rem !important;
}

.btn-sm {
  font-size: 0.875rem !important;
}

/* Adjust breadcrumb font size */
.breadcrumb {
  font-size: 0.875rem !important;
  /* Slightly reduced from fs-7 */
}

/* Adjust spacing in form rows */
.row .mb-3 {
  margin-bottom: 0.95rem !important;
  /* Slightly reduced from 1rem */
}

.row .mb-4 {
  margin-bottom: 1.35rem !important;
  /* Slightly reduced from 1.5rem */
}

/* Adjust h5 font size */
h5 {
  font-size: 1.15rem !important;
}

/* Adjust general content spacing */
.app-content {
  padding-top: 0.875rem !important;
  padding-bottom: 0.875rem !important;
}

/* Light Mode Background Color Adjustments */
[data-bs-theme="light"] body {
  background-color: #e9ecef !important;
  /* Darker gray background */
}

[data-bs-theme="light"] #kt_app_root,
[data-bs-theme="light"] .app-root {
  background-color: #e9ecef !important;
}

[data-bs-theme="light"] #kt_app_page,
[data-bs-theme="light"] .app-page {
  background-color: #e9ecef !important;
}

[data-bs-theme="light"] #kt_app_wrapper,
[data-bs-theme="light"] .app-wrapper {
  background-color: #e9ecef !important;
}

[data-bs-theme="light"] #kt_app_main,
[data-bs-theme="light"] .app-main {
  background-color: #e9ecef !important;
}

[data-bs-theme="light"] .body-bg {
  background-color: #e9ecef !important;
}

[data-bs-theme="light"] #kt_app_content,
[data-bs-theme="light"] .app-content {
  background-color: #e9ecef !important;
}

/* Readonly Field Styling - Bootstrap Secondary Background */
.form-control[readonly],
.form-control[readonly]:focus,
input[readonly],
input[readonly]:focus,
textarea[readonly],
textarea[readonly]:focus {
  background-color: var(--bs-secondary-bg, #e9ecef) !important;
  color: var(--bs-secondary-color, #6c757d) !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* Disabled fields with readonly - ensure consistent styling */
.form-control[readonly][disabled],
input[readonly][disabled],
textarea[readonly][disabled] {
  background-color: var(--bs-secondary-bg, #e9ecef) !important;
  color: var(--bs-secondary-color, #6c757d) !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* Handle Select2 readonly styling */
.select2-container--default .select2-selection--single[readonly],
.select2-container--default .select2-selection--single[readonly] .select2-selection__rendered {
  background-color: var(--bs-secondary-bg, #e9ecef) !important;
  color: var(--bs-secondary-color, #6c757d) !important;
  cursor: not-allowed !important;
}

/* Handle Flatpickr readonly styling */
.flatpickr-input[readonly],
input.flatpickr-input[readonly] {
  background-color: var(--bs-secondary-bg, #e9ecef) !important;
  color: var(--bs-secondary-color, #6c757d) !important;
  cursor: not-allowed !important;
}

[data-bs-theme="dark"] .flatpickr-input[readonly],
[data-bs-theme="dark"] input.flatpickr-input[readonly] {
  background-color: #495057 !important;
  color: #ffffff !important;
  cursor: not-allowed !important;
}

/* Dark theme readonly fields */
[data-bs-theme="dark"] .form-control[readonly],
[data-bs-theme="dark"] .form-control[readonly]:focus,
[data-bs-theme="dark"] input[readonly],
[data-bs-theme="dark"] input[readonly]:focus,
[data-bs-theme="dark"] textarea[readonly],
[data-bs-theme="dark"] textarea[readonly]:focus {
  background-color: var(--bs-secondary-bg, #6c757d) !important;
  color: var(--bs-secondary-color, #ffffff) !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* Dark theme disabled readonly fields */
[data-bs-theme="dark"] .form-control[readonly][disabled],
[data-bs-theme="dark"] input[readonly][disabled],
[data-bs-theme="dark"] textarea[readonly][disabled] {
  background-color: var(--bs-secondary-bg, #6c757d) !important;
  color: var(--bs-secondary-color, #ffffff) !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* -------------------------------------------------------------------------
   Dark theme – app content and modals (whole project)
   When data-bs-theme="dark" is set, cards, headings, tables and modals
   use theme-aware colors so light/dark mode works everywhere.
   ------------------------------------------------------------------------- */

[data-bs-theme="dark"] .app-content .page-heading.text-dark,
[data-bs-theme="dark"] .modal .page-heading.text-dark {
  color: var(--bs-body-color, #fff) !important;
}

[data-bs-theme="dark"] .app-content .card-header.bg-light,
[data-bs-theme="dark"] .modal .card-header.bg-light {
  background-color: var(--bs-secondary-bg, #2b2b40) !important;
  color: var(--bs-body-color, #fff) !important;
  border-color: var(--bs-border-color, #323248) !important;
}

[data-bs-theme="dark"] .app-content .card .card-title.text-dark,
[data-bs-theme="dark"] .app-content .card .text-dark,
[data-bs-theme="dark"] .modal .card .card-title.text-dark,
[data-bs-theme="dark"] .modal .card .text-dark {
  color: var(--bs-body-color, #fff) !important;
}

[data-bs-theme="dark"] .app-content .text-gray-800,
[data-bs-theme="dark"] .modal .text-gray-800 {
  color: var(--bs-body-color, #fff) !important;
}

[data-bs-theme="dark"] .app-content .text-muted,
[data-bs-theme="dark"] .modal .text-muted,
[data-bs-theme="dark"] .app-toolbar .text-muted {
  color: var(--bs-secondary-color, rgba(255, 255, 255, 0.75)) !important;
}

[data-bs-theme="dark"] .app-content .card-header .text-muted,
[data-bs-theme="dark"] .modal .card-header .text-muted {
  color: var(--bs-secondary-color, rgba(255, 255, 255, 0.75)) !important;
}

[data-bs-theme="dark"] .app-content .card .bg-white,
[data-bs-theme="dark"] .modal .card .bg-white {
  background-color: var(--bs-body-bg, #1e1e2d) !important;
  border-color: var(--bs-border-color, #323248) !important;
}

[data-bs-theme="dark"] .app-content .table thead.bg-light,
[data-bs-theme="dark"] .app-content .table thead th,
[data-bs-theme="dark"] .modal .table thead.bg-light,
[data-bs-theme="dark"] .modal .table thead th {
  background-color: var(--bs-secondary-bg, #2b2b40) !important;
  color: var(--bs-body-color, #fff) !important;
  border-color: var(--bs-border-color, #323248) !important;
}

[data-bs-theme="dark"] #dashboard-content .table-responsive table thead,
[data-bs-theme="dark"] #dashboard-content .table-responsive table thead th {
  background-color: var(--bs-secondary-bg, #2b2b40) !important;
  color: var(--bs-body-color, #fff) !important;
  border-color: var(--bs-border-color, #323248) !important;
}

/* Modal-specific: sticky table thead and content blocks with hardcoded bg */
[data-bs-theme="dark"] #description-content table thead,
[data-bs-theme="dark"] #description-content table thead th,
[data-bs-theme="dark"] #appointments-content table thead,
[data-bs-theme="dark"] #appointments-content table thead th {
  background-color: var(--bs-secondary-bg, #2b2b40) !important;
  color: var(--bs-body-color, #fff) !important;
  border-color: var(--bs-border-color, #323248) !important;
}

[data-bs-theme="dark"] #questionnaire-questions-container .question-item {
  background-color: var(--bs-secondary-bg, #2b2b40) !important;
  border-color: var(--bs-border-color, #323248);
}

/* -------------------------------------------------------------------------
   SweetAlert2 (Swal) dark theme
   When data-bs-theme="dark", popups use dark background and light text.
   ------------------------------------------------------------------------- */

[data-bs-theme="dark"] .swal2-container {
  background-color: rgba(0, 0, 0, 0.6);
}

[data-bs-theme="dark"] .swal2-popup {
  background: var(--bs-body-bg, #1e1e2d) !important;
  color: var(--bs-body-color, #fff) !important;
  border: 1px solid var(--bs-border-color, #323248);
}

[data-bs-theme="dark"] .swal2-title {
  color: var(--bs-body-color, #fff) !important;
}

[data-bs-theme="dark"] .swal2-html-container {
  color: var(--bs-body-color, #fff) !important;
}

[data-bs-theme="dark"] .swal2-content,
[data-bs-theme="dark"] .swal2-input,
[data-bs-theme="dark"] .swal2-textarea,
[data-bs-theme="dark"] .swal2-select {
  color: var(--bs-body-color, #fff) !important;
}

[data-bs-theme="dark"] .swal2-input,
[data-bs-theme="dark"] .swal2-textarea,
[data-bs-theme="dark"] .swal2-select {
  background-color: var(--bs-secondary-bg, #2b2b40) !important;
  border-color: var(--bs-border-color, #323248) !important;
  color: var(--bs-body-color, #fff) !important;
}

[data-bs-theme="dark"] .swal2-validation-message {
  background-color: var(--bs-danger, #f1416c) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .swal2-footer {
  border-top-color: var(--bs-border-color, #323248) !important;
  color: var(--bs-body-color, #fff) !important;
}

[data-bs-theme="dark"] .swal2-actions .swal2-styled {
  border: 0;
}

[data-bs-theme="dark"] .swal2-progress-steps .swal2-progress-step {
  background: var(--bs-secondary-bg, #2b2b40) !important;
  color: var(--bs-body-color, #fff) !important;
}

[data-bs-theme="dark"] .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step {
  background: var(--bs-primary, #009ef7) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .swal2-progress-steps .swal2-progress-step-line {
  background: var(--bs-border-color, #323248) !important;
}

[data-bs-theme="dark"] .swal2-timer-progress-bar {
  background: var(--bs-primary, #009ef7) !important;
}