/* =============================================
   MediCare Hospital - Global Stylesheet
   Aesthetic: Clinical Luxury / Medical Precision
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --navy: #0a1628;
  --navy-mid: #142238;
  --teal: #0d9488;
  --teal-light: #14b8a6;
  --teal-pale: #ccfbf1;
  --cream: #faf9f6;
  --white: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --error: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 4px 20px rgba(0,0,0,.1);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.15);
  --radius: 12px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, .serif { font-family: 'DM Serif Display', serif; }

a { color: var(--teal); text-decoration: none; transition: color .2s; }
a:hover { color: var(--teal-light); }

img { max-width: 100%; display: block; }

/* ── LAYOUT ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-wrapper { display: flex; min-height: 100vh; }

/* ── NAVBAR ── */
.navbar {
  background: var(--navy);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,.3);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
}

.navbar-brand .cross {
  width: 32px; height: 32px;
  background: var(--teal);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: white;
  font-weight: bold;
}

.navbar-nav { display: flex; align-items: center; gap: 8px; }

.navbar-nav a {
  color: rgba(255,255,255,.75);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  transition: all .2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: white;
  background: rgba(255,255,255,.1);
}

.navbar-nav .btn-nav {
  background: var(--teal);
  color: white;
  padding: 8px 20px;
}

.navbar-nav .btn-nav:hover { background: var(--teal-light); }

/* ── SIDEBAR ── */
.sidebar {
  width: 260px;
  background: var(--navy);
  min-height: 100vh;
  padding: 30px 0;
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 0 24px 30px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 20px;
}

.sidebar-brand .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
}

.sidebar-brand .cross {
  width: 36px; height: 36px;
  background: var(--teal);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  color: white;
}

.sidebar-nav { flex: 1; padding: 0 12px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.65);
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: 4px;
  transition: all .2s;
}

.sidebar-nav a .icon { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: white;
  background: rgba(13,148,136,.25);
}

.sidebar-nav a.active { background: var(--teal); }

.sidebar-section {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 16px 14px 6px;
}

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

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.5);
  font-size: .9rem;
  transition: all .2s;
}

.sidebar-footer a:hover { color: #f87171; background: rgba(248,113,113,.1); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 36px 40px;
}

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

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

.card-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  color: var(--navy);
}

.card-body { padding: 24px; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.teal { background: var(--teal-pale); }
.stat-icon.navy { background: #dbeafe; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.amber { background: #fef3c7; }

.stat-number {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  color: var(--navy);
  line-height: 1;
}

.stat-label {
  font-size: .83rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

/* ── FORMS ── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
  letter-spacing: .01em;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: white;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

.form-control::placeholder { color: #94a3b8; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

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

.form-hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: #0b7a72; color: white; }

.btn-navy { background: var(--navy); color: white; }
.btn-navy:hover { background: var(--navy-mid); color: white; }

.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #b91c1c; color: white; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }

.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }

.btn-block { width: 100%; justify-content: center; }

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

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

.table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: var(--text);
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfc; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: #f1f5f9; color: #64748b; }

/* ── ALERTS ── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 30px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.page-header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.9rem;
  color: var(--navy);
}

.page-header p {
  color: var(--text-muted);
  font-size: .92rem;
  margin-top: 4px;
}

/* ── AUTH PAGES ── */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-panel-left {
  background: var(--navy);
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-panel-left::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(13,148,136,.3) 0%, transparent 70%);
  top: -100px; right: -100px;
  border-radius: 50%;
}

.auth-panel-left::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(13,148,136,.15) 0%, transparent 70%);
  bottom: -50px; left: -50px;
  border-radius: 50%;
}

.auth-left-content { position: relative; z-index: 1; }

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 50px;
}

.auth-logo .cross {
  width: 48px; height: 48px;
  background: var(--teal);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.auth-logo span {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  color: white;
}

.auth-tagline {
  font-family: 'DM Serif Display', serif;
  font-size: 2.5rem;
  color: white;
  line-height: 1.2;
  margin-bottom: 20px;
}

.auth-tagline em { color: var(--teal-light); font-style: italic; }

.auth-desc {
  color: rgba(255,255,255,.6);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 360px;
}

.auth-features {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,.75);
  font-size: .9rem;
}

.auth-feature .dot {
  width: 8px; height: 8px;
  background: var(--teal);
  border-radius: 50%;
  flex-shrink: 0;
}

.auth-panel-right {
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.auth-form-box {
  width: 100%;
  max-width: 420px;
}

.auth-form-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.8rem;
  color: var(--navy);
  margin-bottom: 6px;
}

.auth-form-subtitle {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 32px;
}

.auth-links {
  text-align: center;
  margin-top: 24px;
  font-size: .87rem;
  color: var(--text-muted);
}

/* ── AVATAR ── */
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  background: var(--teal-pale);
  color: var(--teal);
  flex-shrink: 0;
}

/* ── USER INFO ── */
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name { font-weight: 600; font-size: .9rem; color: var(--text); }
.user-role { font-size: .78rem; color: var(--text-muted); }

/* ── EMPTY STATE ── */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { font-family: 'DM Serif Display', serif; color: var(--navy); margin-bottom: 8px; }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideIn .2s ease;
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

.modal-title { font-family: 'DM Serif Display', serif; font-size: 1.2rem; color: var(--navy); }
.modal-close { cursor: pointer; color: var(--text-muted); font-size: 1.2rem; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── SEARCH BAR ── */
.search-bar {
  position: relative;
  max-width: 320px;
}

.search-bar input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-family: 'DM Sans', sans-serif;
  background: white;
  outline: none;
  transition: border-color .2s;
}

.search-bar input:focus { border-color: var(--teal); }

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .9rem;
}

/* ── UTILITIES ── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .85rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mt-3 { margin-top: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 16px; }
.gap-1 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-panel-left { display: none; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}