/* ─── Site Header Base Styling ─── */
.site-header {
  background-color: #ffffff;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); /* optional soft shadow */
  z-index: 1000;
  position: relative;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--bs-body-color);
  margin: 0;
}

/* ─── Base Nav Link Layout ─── */
.nav-icons {
  gap: 2rem;
}

.nav-icons .nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1rem;
  color: var(--bs-body-color-secondary);
  padding: 0.75rem 0;
  transition: color 0.2s;
}

.nav-icons .nav-link .bi {
  font-size: 1.6rem;
  margin-bottom: 0.3rem;
}

.nav-icons .nav-link.active {
  color: var(--bs-primary);
  font-weight: 600;
}

.nav-icons .nav-link.active .bi {
  color: var(--bs-primary);
}

.nav-icons .nav-link.active::after {
  content: "";
  display: block;
  width: 1.75rem;
  height: 3px;
  background: var(--bs-primary);
  margin-top: 0.3rem;
  border-radius: 2px;
}

/* Logout Icon Consistency */
.user-icon {
  padding: 0.25rem;
  margin-left: 0.5rem;
}

.user-icon i {
  font-size: 1.5rem;
  color: #dc3545;
}

.site-header,
.navbar,
.site-header .container {
  border-bottom: none !important;
  box-shadow: none !important;
}

/* ─── Dark Mode Toggle Switch Styling ─── */
.theme-toggle input#themeToggle {
  display: none;
}

#themeToggle + .toggle-track {
  position: relative;
  width: 62px;
  height: 29px;
  background: var(--bs-border-color);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  cursor: pointer;
  transition: background 0.3s;
}

#themeToggle + .toggle-track .bi {
  color: var(--bs-body-color-secondary);
  font-size: 1rem;
}

#themeToggle + .toggle-track .toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: var(--bs-body-bg);
  border-radius: 50%;
  transition: transform 0.3s;
}

#themeToggle:checked + .toggle-track {
  background: var(--bs-primary);
}

#themeToggle:checked + .toggle-track .bi {
  color: #fff;
}

#themeToggle:checked + .toggle-track .toggle-thumb {
  transform: translateX(32px);
}

/* ─── Dark Mode Support for Header ─── */
[data-bs-theme="dark"] .site-header {
  background-color: var(--bs-body-bg) !important;
  border-bottom: none !important;
  box-shadow: none !important;
}

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

[data-bs-theme="dark"] .nav-icons .nav-link {
  color: var(--bs-body-color-secondary) !important;
}

[data-bs-theme="dark"] .nav-icons .nav-link.active,
[data-bs-theme="dark"] .nav-icons .nav-link.active .bi {
  color: var(--bs-primary) !important;
}

[data-bs-theme="dark"] .user-icon i {
  color: #f87171 !important; /* lighter red for dark bg */
}

.modal {
  display: none;
  position: fixed;
  z-index: 1055;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  margin: 5% auto;
  padding: 30px;
  width: 90%;
  max-width: 600px;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.3s ease;
}

.modal .close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 22px;
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.close {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 4rem;
  font-weight: bold;
  color: #000;
  cursor: pointer;
  z-index: 9999;
  padding: 10px;
}
.close:hover {
  color: #dc3545;
  transform: scale(1.1);
  transition: all 0.2s ease-in-out;
}

/* Make table headers and background adapt to dark mode */
[data-bs-theme="dark"] .table thead {
  background-color: var(--bs-gray-800);
  color: var(--bs-gray-100);
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
  background-color: rgba(
    255,
    255,
    255,
    0.05
  ); /* subtle contrast in dark mode */
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) {
  background-color: rgba(255, 255, 255, 0.075);
}

/* Optional: tweak border and cell colors in dark mode */
[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th {
  border-color: var(--bs-gray-700);
}

select.country-flag-select option {
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 20px 15px;
  padding-left: 26px;
}

select.country-flag-select option[data-flag] {
  background-image: none; /* Remove fallback */
}

.select2-results__option[data-flag]::before,
.select2-selection__rendered[data-flag]::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 15px;
  background-size: cover;
  background-repeat: no-repeat;
  margin-right: 8px;
  vertical-align: middle;
}

/* Global table styles - used across multiple modules */
.tabela {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, sans-serif;
  border: 1px solid #ddd;
}

.tabela a {
  color: black;
}

.tabela th,
.tabela td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: left;
}

.tabela th {
  background-color: #f4f4f4;
  white-space: nowrap;
}

.tabela tr:nth-child(even) {
  background-color: #f9f9f9; /* Light grey */
}

.tabela tr:nth-child(odd) {
  background-color: #ffffff; /* White */
}

.tabela tr:hover {
  background-color: #e0e0e0; /* Slightly darker grey on hover */
  cursor: pointer;
  transition: background-color 0.3s ease-in-out;
}

/* Dark mode support for tabela and filter tables */
[data-bs-theme="dark"] .tabela,
[data-bs-theme="dark"] #filterTable,
[data-bs-theme="dark"] #filterTable1,
[data-bs-theme="dark"] #filterTable2,
[data-bs-theme="dark"] #filterTable3,
[data-bs-theme="dark"] #filterTable4,
[data-bs-theme="dark"] #LastNextPatients,
[data-bs-theme="dark"] #conversationTable,
[data-bs-theme="dark"] #CurrentlyAtHospital,
[data-bs-theme="dark"] #WaitingProformas {
  background-color: #1e1e1e;
  color: #e0e0e0;
}

[data-bs-theme="dark"] .tabela th,
[data-bs-theme="dark"] .tabela td,
[data-bs-theme="dark"] #filterTable th,
[data-bs-theme="dark"] #filterTable td,
[data-bs-theme="dark"] #filterTable1 th,
[data-bs-theme="dark"] #filterTable1 td,
[data-bs-theme="dark"] #filterTable2 th,
[data-bs-theme="dark"] #filterTable2 td,
[data-bs-theme="dark"] #filterTable3 th,
[data-bs-theme="dark"] #filterTable3 td,
[data-bs-theme="dark"] #filterTable4 th,
[data-bs-theme="dark"] #filterTable4 td,
[data-bs-theme="dark"] #LastNextPatients th,
[data-bs-theme="dark"] #LastNextPatients td,
[data-bs-theme="dark"] #conversationTable th,
[data-bs-theme="dark"] #conversationTable td,
[data-bs-theme="dark"] #CurrentlyAtHospital th,
[data-bs-theme="dark"] #CurrentlyAtHospital td,
[data-bs-theme="dark"] #WaitingProformas th,
[data-bs-theme="dark"] #WaitingProformas td {
  background-color: #2a2a2a;
  border-color: #444;
  color: #e0e0e0;
}

[data-bs-theme="dark"] .tabela tr:nth-child(even),
[data-bs-theme="dark"] #filterTable tr:nth-child(even),
[data-bs-theme="dark"] #filterTable1 tr:nth-child(even),
[data-bs-theme="dark"] #filterTable2 tr:nth-child(even),
[data-bs-theme="dark"] #filterTable3 tr:nth-child(even),
[data-bs-theme="dark"] #filterTable4 tr:nth-child(even),
[data-bs-theme="dark"] #LastNextPatients tr:nth-child(even),
[data-bs-theme="dark"] #conversationTable tr:nth-child(even),
[data-bs-theme="dark"] #CurrentlyAtHospital tr:nth-child(even),
[data-bs-theme="dark"] #WaitingProformas tr:nth-child(even) {
  background-color: #252525;
}

[data-bs-theme="dark"] .tabela tr:nth-child(odd),
[data-bs-theme="dark"] #filterTable tr:nth-child(odd),
[data-bs-theme="dark"] #filterTable1 tr:nth-child(odd),
[data-bs-theme="dark"] #filterTable2 tr:nth-child(odd),
[data-bs-theme="dark"] #filterTable3 tr:nth-child(odd),
[data-bs-theme="dark"] #filterTable4 tr:nth-child(odd),
[data-bs-theme="dark"] #LastNextPatients tr:nth-child(odd),
[data-bs-theme="dark"] #conversationTable tr:nth-child(odd),
[data-bs-theme="dark"] #CurrentlyAtHospital tr:nth-child(odd),
[data-bs-theme="dark"] #WaitingProformas tr:nth-child(odd) {
  background-color: #1e1e1e;
}

[data-bs-theme="dark"] .tabela tr:hover,
[data-bs-theme="dark"] #filterTable tr:hover,
[data-bs-theme="dark"] #filterTable1 tr:hover,
[data-bs-theme="dark"] #filterTable2 tr:hover,
[data-bs-theme="dark"] #filterTable3 tr:hover,
[data-bs-theme="dark"] #filterTable4 tr:hover,
[data-bs-theme="dark"] #LastNextPatients tr:hover,
[data-bs-theme="dark"] #conversationTable tr:hover,
[data-bs-theme="dark"] #CurrentlyAtHospital tr:hover,
[data-bs-theme="dark"] #WaitingProformas tr:hover {
  background-color: #333;
}

/* Fix links in tables */
[data-bs-theme="dark"] .tabela a,
[data-bs-theme="dark"] #filterTable a,
[data-bs-theme="dark"] #filterTable1 a,
[data-bs-theme="dark"] #filterTable2 a,
[data-bs-theme="dark"] #filterTable3 a,
[data-bs-theme="dark"] #filterTable4 a,
[data-bs-theme="dark"] #LastNextPatients a,
[data-bs-theme="dark"] #conversationTable a,
[data-bs-theme="dark"] #CurrentlyAtHospital a,
[data-bs-theme="dark"] #WaitingProformas a {
  color: #9ecbff;
}

/* Global dropdown submenu styles - used in multiple headers */
.nav-tabs .dropdown-menu {
  position: absolute !important;
}

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu > .dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -1px;
  display: none;
  position: absolute;
  z-index: 1050;
}

.dropdown-submenu:hover > .dropdown-menu {
  display: block;
}

/* Global DataTables dark mode styles - used across modules */
body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button {
  background-color: #333 !important;
  color: #fff !important;
  border: 1px solid #666;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: #444 !important;
}

body.dark-mode
  .dataTables_wrapper
  .dataTables_paginate
  .paginate_button.current {
  background-color: #007bff !important;
  border-color: #007bff;
}

body.dark-mode
  .dataTables_wrapper
  .dataTables_paginate
  .paginate_button.disabled {
  background-color: #555 !important;
  color: #999 !important;
  border-color: #555;
}

/* Global utility classes - used across multiple modules */
.status-badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
}

.attachment-list {
  max-height: 200px;
  overflow-y: auto;
}

.file-row {
  padding: 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.audit-filter {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Cross-cutting project styles used by multiple modules */

/* Project specific cards - used across modules */
.card-blue {
  border-left: 4px solid #0d6efd;
}
.card-green {
  border-left: 4px solid #198754;
}
.card-orange {
  border-left: 4px solid #fd7e14;
}
.card-lightblue {
  border-left: 4px solid #0dcaf0;
}
.card-dark {
  border-left: 4px solid #212529;
}

/* Theme toggle - used across modules */
.theme-toggle {
  background: none;
  border: none;
  padding: 0.5rem;
  border-radius: 50%;
}
.toggle-track {
  width: 40px;
  height: 20px;
  background: #6c757d;
  border-radius: 10px;
  position: relative;
}
.toggle-thumb {
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
}

/* Generic utility classes used across modules */
.badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
}
.badge-priority {
  text-transform: uppercase;
  font-weight: 600;
}
.avatar-lg {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

/* Generic button styles used across modules */
.deleteEmployeeBtn,
.editEmployeeBtn,
.editContractBtn,
.edit-task,
.delete-task {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  margin: 0 0.25rem;
}

.deleteEmployeeBtn,
.delete-task {
  background: #dc3545;
  color: white;
}
.editEmployeeBtn,
.editContractBtn,
.edit-task {
  background: #0d6efd;
  color: white;
}

/* File handling used across modules */
.file-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Close button used across modules */
.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Responsive utilities for shared components */
@media (max-width: 768px) {
  .avatar-lg {
    width: 48px;
    height: 48px;
  }
  .card-blue,
  .card-green,
  .card-orange,
  .card-lightblue,
  .card-dark {
    border-left-width: 2px;
  }
}
