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

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

/* ========== LAYOUT ========== */
.layout {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 260px;
  background: #ffffff;
  padding: 24px;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.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;
  font-size: 14px;
}

.main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* ========== 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;
}

.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: 2fr 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;
}

.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.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;
}

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

.screening-form .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.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;
}

.panel canvas {
  width: 100% !important;
  max-width: 100% !important;
  display: block;
}

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

/* ================================
   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;
}