/* ========== RESET & BASE ========== */
* {
  box-sizing: border-box;
  font-family: Inter, sans-serif;
  margin: 0;
  padding: 0;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  border: 3px solid transparent;
  background-clip: padding-box;
}

body {
  background: #f5f7fb;
  color: #374151;
}

/* ========== LAYOUT ========== */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  /* The layout should fill the screen exactly */
}

.sidebar {
  width: 260px;
  background: #ffffff;
  padding: 24px;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* Enable scrolling if nav is too long */
  flex-shrink: 0;
}

.logo {
  font-size: 32px;
  font-weight: 700;
  color: #e63946;
  margin-bottom: 32px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 6px;
}

.sidebar-nav a {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 6px;
  cursor: pointer;
  text-decoration: none;
  color: #374151;
  transition: background 0.2s;
}

.sidebar-nav a.active {
  background: #e6f7ef;
  color: #0f766e;
}

.admin-info {
  margin-top: auto;
  border-top: 1px solid #f3f4f6;
  padding: 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-small {
  background: #6366f1;
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

.session-msg {
  font-size: 10px;
  color: #10b981;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.session-msg::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-details strong {
  font-size: 14px;
  color: #1f2937;
  line-height: 1.2;
}

.user-details small {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.logout-btn {
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fee2e2;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: inline-block;
}

.logout-btn:hover {
  background: #fee2e2;
  transform: translateY(-1px);
}

.main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  background: #f5f7fb;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ========== HEADER ========== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.avatar {
  background: #6366f1;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== KPIS ========== */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.kpis.kpi-strip {
  grid-template-columns: repeat(8, minmax(200px, 1fr));
  overflow-x: auto;
  padding-bottom: 6px;
}

.kpis.kpi-strip .kpi {
  min-width: 200px;
}

.kpi {
  background: white;
  padding: 20px;
  border-radius: 16px;
}

.green {
  border-left: 5px solid #22c55e;
}

.blue {
  border-left: 5px solid #3b82f6;
}

.orange {
  border-left: 5px solid #f59e0b;
}

.gray {
  border-left: 5px solid #9ca3af;
}

/* ========== GRID PANELS ========== */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.panel {
  background: white;
  padding: 24px;
  border-radius: 16px;
}



/* ========== TABLES ========== */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-top: 16px;
  table-layout: fixed;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  word-wrap: break-word;
}

th {
  background: #f9fafb;
  font-weight: 600;
  font-size: 13px;
}

td {
  font-size: 13px;
  color: #4b5563;
}

td:last-child,
th:last-child {
  text-align: center;
}

/* ========== FILTERS & BUTTONS ========== */
.filters,
.patients-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  flex: 1;
  min-width: 120px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  outline: none;
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
  background: #f8fafc;
  color: #64748b;
}

.profile-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.profile-identity {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 10px 18px -10px rgba(79, 70, 229, 0.5);
}

.profile-title {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.profile-name {
  font-weight: 900;
  color: #0f172a;
  font-size: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #e6f7ef;
  color: #0f766e;
}

.profile-subtext {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile-status {
  margin-top: 12px;
  font-size: 12px;
  color: #64748b;
}

.btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.btn.primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
}

.btn.primary:hover {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.btn.success {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
}

.btn.success:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.btn.warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #fff;
}

.btn.warning:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.btn.info {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
}

.btn.info:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}


.btn.small {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 10px;
}

/* ========== VIEWS ========== */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ========== EDUCATION CARDS ========== */
.education-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.edu-card {
  background: white;
  padding: 20px;
  border-radius: 16px;
}

/* ========== SCREENING MODAL ========== */
.screening-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.screening-modal.active {
  display: flex;
}

.screening-form {
  background: #fff;
  width: 500px;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  padding: 24px;
  border-radius: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.screening-form h3 {
  margin-top: 0;
}

.screening-form .modal-close {
  position: sticky;
  top: 10px;
  margin-left: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  width: 38px;
  height: 38px;
  font-size: 24px;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.25);
}

.screening-form .form-group {
  margin-bottom: 12px;
}

.screening-form .form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.screening-form .form-group input,
.screening-form .form-group select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.screening-form .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}





/* ================================
   SCREENING MODAL – PROFESSIONAL UI
================================ */

#screeningModal {
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}

#screeningModal .modal-content {
  background: #ffffff;
  border-radius: 14px;
  padding: 24px 28px;
  max-width: 720px;
  width: 95%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* Modal Header */
#screeningModal h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 18px;
}

/* Section Titles */
#screeningModal h4 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 22px 0 10px;
}

/* Inputs & Textareas */
#screeningModal input[type="text"],
#screeningModal input[type="number"],
#screeningModal textarea,
#screeningModal select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#screeningModal input:focus,
#screeningModal textarea:focus,
#screeningModal select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Textarea */
#screeningModal textarea {
  resize: vertical;
  min-height: 90px;
}

/* ================================
   CHECKBOX GROUP (FIXED ALIGNMENT)
================================ */

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
  margin-top: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #374151;
}

/* Custom checkbox */
.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
}

/* Checkbox labels */
.checkbox-item label {
  cursor: pointer;
  line-height: 1.2;
}

/* ================================
   FORM GRID (CLEAN LAYOUT)
================================ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* ================================
   ACTION BUTTONS
================================ */

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions .btn {
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-weight: 500;
}

.modal-actions .btn.primary {
  background: #2563eb;
  color: #fff;
}

.modal-actions .btn.secondary {
  background: #f3f4f6;
  color: #374151;
}

.modal-actions .btn:hover {
  opacity: 0.92;
}

/* Close button */
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
}

/* ========== CLINICAL HISTORY MODAL ========== */
.history-container {
  max-height: 500px;
  overflow-y: auto;
  padding: 10px 0;
}

.history-section {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.history-section h4 {
  color: #111827;
  font-size: 16px;
  margin-bottom: 12px;
  border-bottom: 2px solid #e6f7ef;
  display: inline-block;
  padding-bottom: 4px;
}

.history-section p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
  color: #4b5563;
}

.history-section strong {
  color: #1f2937;
}

@media print {
  body * {
    visibility: hidden;
  }

  #historyModal,
  #historyModal * {
    visibility: visible;
  }

  #historyModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: white;
  }

  .modal-close,
  .form-actions {
    display: none !important;
  }
}

/* ========== BOOKING MODAL POLISH ========== */
#bookingDetailsModal .screening-form {
  animation: slideTop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

@keyframes slideTop {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.booking-add-patient input,
.booking-add-patient select {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  transition: all 0.2s;
}

.booking-add-patient input:focus,
.booking-add-patient select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  outline: none;
}

#bookingPatientsList tr {
  transition: background 0.2s;
}

#bookingPatientsList tr:hover {
  background: #f8fafc;
}


/* Premium Date Picker Styling */
input[type='date'] {
  appearance: none;
  -webkit-appearance: none;
  background: #ffffff;
  color: #1e293b;
  font-family: inherit;
  cursor: pointer;
}

.booking-add-patient input[type='date'] {
  position: relative;
  overflow: hidden;
  /* Ensure indicator doesn't bleed out */
}

.booking-add-patient input[type='date']::-webkit-calendar-picker-indicator {
  background: transparent;
  bottom: 0;
  color: transparent;
  cursor: pointer;
  height: 100%;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  z-index: 1;
}

.form-group-custom {
  position: relative;
}

.form-group-custom input {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group-custom input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  outline: none;
}

/* MOBILE FIX */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    left: -260px;
    transition: 0.3s;
    z-index: 1000;
  }

  .sidebar.active {
    left: 0;
  }

  .mobile-toggle {
    display: flex !important;
    position: fixed;
    top: 15px;
    right: 15px;
    background: #6366f1;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    border: none;
    z-index: 1100;
    cursor: pointer;
  }

  .mobile-toggle span {
    width: 20px;
    height: 2px;
    background: white;
  }

  .kpis,
  .grid {
    grid-template-columns: 1fr !important;
  }

  .kpis.kpi-strip {
    grid-template-columns: repeat(8, 220px) !important;
  }
}

/* Multi-selector styling */
#mainBookingPatientDropdown::-webkit-scrollbar,
#modalBookingPatientDropdown::-webkit-scrollbar {
  width: 6px;
}

#mainBookingPatientDropdown::-webkit-scrollbar-track,
#modalBookingPatientDropdown::-webkit-scrollbar-track {
  background: #f1f5f9;
}

#mainBookingPatientDropdown::-webkit-scrollbar-thumb,
#modalBookingPatientDropdown::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
