/* ============================================================
   Doctor at Home — Modern Healthcare Dashboard
   ============================================================ */

/* --- Base --- */
body {
  font-family: 'Noto Sans Thai', 'Inter', sans-serif;
  background: #f8fafc;
  color: #334155;
}

/* --- Navbar --- */
.navbar {
  background: #1e1b4b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.nav-tab {
  color: rgba(255,255,255,0.6);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-tab:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.08);
}

.nav-tab-active {
  color: #4f46e5 !important;
  background: rgba(255,255,255,0.95) !important;
  font-weight: 600;
}

/* --- Cards --- */
.card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: all 0.2s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Stat gradient cards */
.stat-card {
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.stat-card-clickable { cursor: pointer; user-select: none; }
.stat-card-red { background: linear-gradient(135deg, #fef2f2, #fee2e2); }
.stat-card-yellow { background: linear-gradient(135deg, #fffbeb, #fef3c7); }
.stat-card-green { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.stat-card-gray { background: linear-gradient(135deg, #f9fafb, #f3f4f6); }
.stat-card-purple { background: linear-gradient(135deg, #faf5ff, #f3e8ff); }

/* --- Risk badges --- */
.badge-red { background-color: #fef2f2; color: #dc2626; border: 1px solid #fecaca; border-radius: 6px; }
.badge-yellow { background-color: #fffbeb; color: #d97706; border: 1px solid #fde68a; border-radius: 6px; }
.badge-green { background-color: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; border-radius: 6px; }
.badge-gray { background-color: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; border-radius: 6px; }
.badge-purple { background-color: #faf5ff; color: #9333ea; border: 1px solid #e9d5ff; border-radius: 6px; }

.badge-pending { background-color: #fffbeb; color: #d97706; border: 1px solid #fde68a; border-radius: 6px; }
.badge-completed { background-color: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; border-radius: 6px; }

/* --- Risk dot indicator --- */
.risk-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* --- Tables --- */
.table-modern {
  width: 100%;
  font-size: 14px;
}
.table-modern thead {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}
.table-modern thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #64748b;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
.table-modern tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.table-modern tbody tr:hover {
  background: #eef2ff;
}
.table-modern tbody td {
  padding: 12px 16px;
  color: #334155;
}
.table-modern tbody tr:nth-child(even) {
  background: #fafbfd;
}
.table-modern tbody tr:nth-child(even):hover {
  background: #eef2ff;
}

/* --- Forms --- */
.input-modern {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  background: #fff;
  color: #334155;
}
.input-modern:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.select-modern {
  padding: 8px 32px 8px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s;
  color: #334155;
}
.select-modern:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* --- Buttons --- */
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(79,70,229,0.3);
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  box-shadow: 0 4px 12px rgba(79,70,229,0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #e2e8f0;
  color: #64748b;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-outline:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #334155;
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(22,163,74,0.3);
  border: none;
  cursor: pointer;
}
.btn-success:hover {
  box-shadow: 0 4px 12px rgba(22,163,74,0.4);
  transform: translateY(-1px);
}

.btn-ghost-white {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.8);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-ghost-white:hover {
  border-color: rgba(255,255,255,0.6);
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 28px;
  max-width: 32rem;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

/* --- Patient card (patients page keeps card layout for mobile) --- */
.card-patient {
  transition: transform 0.15s, box-shadow 0.15s;
  border-radius: 12px;
}
.card-patient:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.risk-red { background: linear-gradient(135deg, #fef2f2, #fff); border-left: 4px solid #ef4444; }
.risk-yellow { background: linear-gradient(135deg, #fffbeb, #fff); border-left: 4px solid #f59e0b; }
.risk-green { background: linear-gradient(135deg, #f0fdf4, #fff); border-left: 4px solid #22c55e; }
.risk-gray { background: linear-gradient(135deg, #f9fafb, #fff); border-left: 4px solid #9ca3af; }
.risk-purple { background: linear-gradient(135deg, #faf5ff, #fff); border-left: 4px solid #a855f7; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Leaflet overrides --- */
.pie-marker { background: transparent !important; border: none !important; }
.zone-label-marker { background: transparent !important; border: none !important; }

/* --- Avatar circle --- */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* --- Toggle switch --- */
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #e2e8f0;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch.active { background: #6366f1; }
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.active::after { transform: translateX(18px); }

/* --- Search input with icon --- */
.search-wrapper {
  position: relative;
}
.search-wrapper .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}
.search-wrapper input {
  padding-left: 42px;
}

/* --- Skeleton loader --- */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Print --- */
@media print {
  .no-print { display: none !important; }
}

/* --- Mobile nav --- */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 40;
}

/* --- Responsive logo --- */
.navbar-logo {
  height: 44px;
  width: auto;
}
@media (max-width: 768px) {
  .navbar-logo { height: 36px; }
  .login-logo { height: 80px !important; }
}
