/* ============================================================
   NIRUPAMA CLINIC — Admin & Doctor Portal Styles
   ============================================================ */

:root {
  --teal:       #006064;
  --teal-light: #00838f;
  --teal-pale:  #e0f7fa;
  --magenta:    #c2185b;
  --magenta-pale: #fce4ec;
  --blue:       #1565c0;
  --blue-pale:  #e3f2fd;
  --gold:       #f9a825;
  --gold-pale:  #fff8e1;
  --green:      #2e7d32;
  --green-pale: #e8f5e9;
  --red:        #c62828;
  --red-pale:   #ffebee;
  --orange:     #e65100;
  --orange-pale:#fff3e0;
  --white:      #ffffff;
  --off-white:  #f8fafb;
  --gray-50:    #f8f9fa;
  --gray-100:   #f1f3f4;
  --gray-200:   #e8eaed;
  --gray-300:   #dadce0;
  --gray-400:   #9aa0a6;
  --gray-600:   #5f6368;
  --gray-800:   #3c4043;
  --dark:       #1a1a2e;
  --sidebar-w:  260px;
  --header-h:   64px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', sans-serif;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.12);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font-body); background: var(--off-white); color: var(--gray-800); line-height: 1.5; }
a { text-decoration: none; color: inherit; }

/* ===== LOGIN PAGE ===== */
.login-page { min-height: 100vh; display: flex; }

.login-split {
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: 100vh;
  width: 100%;
}

.login-brand {
  background: linear-gradient(160deg, var(--teal) 0%, #004d40 100%);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 40px;
}

.login-brand.doctor-brand {
  background: linear-gradient(160deg, var(--blue) 0%, #0d47a1 100%);
}

.brand-content { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.brand-logo {
  width: 80px; height: 80px;
  margin-bottom: 24px;
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.login-brand p {
  font-size: 0.95rem;
  opacity: 0.8;
  margin-bottom: 40px;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bf-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  opacity: 0.9;
  background: rgba(255,255,255,0.1);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}
.bf-item span { font-size: 1.2rem; }

.brand-footer a {
  font-size: 0.85rem;
  opacity: 0.7;
  transition: var(--transition);
}
.brand-footer a:hover { opacity: 1; }

.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--off-white);
}

.login-form-wrap {
  width: 100%;
  max-width: 420px;
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.login-icon svg { width: 28px; height: 28px; }
.admin-icon { background: var(--teal-pale); color: var(--teal); }
.doctor-icon { background: var(--blue-pale); color: var(--blue); }

.login-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}
.login-header p { font-size: 0.9rem; color: var(--gray-600); }

.login-form { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--gray-800); }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px; height: 18px;
  color: var(--gray-400);
  pointer-events: none;
}

.input-wrap input, .input-wrap select, .input-wrap textarea {
  width: 100%;
  padding: 12px 14px 12px 44px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--gray-800);
  background: white;
  transition: var(--transition);
  outline: none;
}
.input-wrap input:focus, .input-wrap select:focus, .input-wrap textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,96,100,0.1);
}

.toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  display: flex;
  align-items: center;
}
.toggle-pw svg { width: 18px; height: 18px; }
.toggle-pw:hover { color: var(--teal); }

.error-msg {
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 500;
  min-height: 20px;
  text-align: center;
}

.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 4px;
}
.btn-login svg { width: 20px; height: 20px; }
.admin-btn { background: var(--teal); color: white; }
.admin-btn:hover:not(:disabled) { background: var(--teal-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.doctor-btn { background: var(--blue); color: white; }
.doctor-btn:hover:not(:disabled) { background: #1976d2; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.login-hint { margin-top: 24px; }
.hint-box {
  background: var(--gold-pale);
  border: 1px solid #ffe082;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.82rem;
  color: var(--gray-800);
}
.hint-box strong { display: block; margin-bottom: 4px; color: var(--orange); }
.hint-box code { background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }

.login-alt {
  text-align: center;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--gray-600);
}
.login-alt a { color: var(--teal); font-weight: 600; }
.login-alt a:hover { text-decoration: underline; }

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 36px; height: 36px; flex-shrink: 0;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}
.sidebar-subtitle { font-size: 0.7rem; opacity: 0.5; text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.4;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: rgba(0,150,136,0.3); color: white; }
.nav-item.active svg { color: #4db6ac; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  margin-bottom: 8px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-name { font-size: 0.85rem; font-weight: 600; }
.user-role { font-size: 0.7rem; opacity: 0.5; }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(198,40,40,0.15);
  color: #ef9a9a;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover { background: rgba(198,40,40,0.3); color: #ffcdd2; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.top-bar-left h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--dark);
}
.top-bar-left p { font-size: 0.78rem; color: var(--gray-600); }

.top-bar-right { display: flex; align-items: center; gap: 12px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-primary svg { width: 16px; height: 16px; }
.btn-primary:hover { background: var(--teal-light); transform: translateY(-1px); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--gray-100);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--gray-200); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--red-pale);
  color: var(--red);
  border: 1px solid #ffcdd2;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-danger:hover { background: var(--red); color: white; }
.btn-danger svg { width: 14px; height: 14px; }

.btn-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--teal-pale);
  color: var(--teal);
  border: 1px solid #b2dfdb;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-edit:hover { background: var(--teal); color: white; }
.btn-edit svg { width: 14px; height: 14px; }

/* Page Content */
.page-content {
  padding: 28px;
  flex: 1;
}

/* Tabs */
.tab-section { display: none; }
.tab-section.active { display: block; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.teal { background: var(--teal-pale); color: var(--teal); }
.stat-icon.blue { background: var(--blue-pale); color: var(--blue); }
.stat-icon.green { background: var(--green-pale); color: var(--green); }
.stat-icon.magenta { background: var(--magenta-pale); color: var(--magenta); }
.stat-icon.gold { background: var(--gold-pale); color: var(--gold); }

.stat-info strong { display: block; font-size: 1.6rem; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-info span { font-size: 0.78rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.05em; }

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
}

.card-body { padding: 24px; }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

.td-actions { display: flex; gap: 8px; align-items: center; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-green { background: var(--green-pale); color: var(--green); }
.badge-red { background: var(--red-pale); color: var(--red); }
.badge-gold { background: var(--gold-pale); color: #e65100; }
.badge-blue { background: var(--blue-pale); color: var(--blue); }
.badge-teal { background: var(--teal-pale); color: var(--teal); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* Doctor Avatar in table */
.doc-cell { display: flex; align-items: center; gap: 10px; }
.doc-cell-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark);
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  transition: var(--transition);
}
.modal-close:hover { background: var(--gray-200); color: var(--dark); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Form inside modal */
.modal-form { display: flex; flex-direction: column; gap: 18px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.modal-form .form-group { display: flex; flex-direction: column; gap: 6px; }
.modal-form label { font-size: 0.82rem; font-weight: 600; color: var(--gray-800); }

.modal-form input,
.modal-form select,
.modal-form textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: white;
  transition: var(--transition);
  outline: none;
  width: 100%;
}
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,96,100,0.1);
}
.modal-form textarea { resize: vertical; min-height: 80px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--dark);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 999;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-width: 220px;
}
.search-bar svg { width: 16px; height: 16px; color: var(--gray-400); flex-shrink: 0; }
.search-bar input {
  border: none;
  background: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--gray-800);
  width: 100%;
}

/* Filter row */
.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 8px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--gray-800);
  background: white;
  outline: none;
  cursor: pointer;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* Color picker row */
.color-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.color-opt {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: var(--transition);
}
.color-opt.selected { border-color: var(--dark); transform: scale(1.15); }

/* Responsive */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .login-split { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}