/* Admin Panel - Global Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: #f4f5f7;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Layout ---- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

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

.sidebar-logo-name {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.sidebar-logo-sub {
  color: #B8960C;
  font-size: 11px;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

.nav-link {
  display: block;
  padding: 11px 20px;
  color: #aaa;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all .18s;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.04);
  border-left-color: rgba(184,150,12,.5);
}

.nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.06);
  border-left-color: #B8960C;
}

.nav-logout {
  color: #ef4444 !important;
}

.nav-logout:hover {
  background: rgba(239,68,68,.08) !important;
  border-left-color: #ef4444 !important;
}

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

.sidebar-user {
  display: block;
  color: #666;
  font-size: 12px;
  margin-bottom: 8px;
}

/* ---- Main Content ---- */
.admin-main {
  margin-left: 240px;
  flex: 1;
  padding: 28px 30px;
  min-height: 100vh;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
}

.admin-welcome {
  font-size: 13px;
  color: #888;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 22px 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border-top: 3px solid #eee;
  transition: box-shadow .2s;
}

.stat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.stat-card.stat-highlight { border-top-color: #B8960C; }

.stat-number {
  font-size: 34px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1;
}

.stat-label {
  color: #999;
  font-size: 12px;
  margin-top: 6px;
}

/* ---- Card ---- */
.admin-card {
  background: #fff;
  border-radius: 10px;
  padding: 22px 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  margin-bottom: 22px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 10px 14px;
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #eee;
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

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

.empty-row {
  text-align: center;
  color: #bbb;
  padding: 30px !important;
}

.actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ---- Status Badges ---- */
.status-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-new       { background: #eff6ff; color: #1d4ed8; }
.status-confirmed { background: #f0fdf4; color: #15803d; }
.status-cancelled { background: #fef2f2; color: #b91c1c; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all .18s;
  font-family: 'Inter', sans-serif;
  line-height: 1;
  white-space: nowrap;
}

.btn-primary  { background: #B8960C; color: #fff; }
.btn-primary:hover { background: #9a7d0a; }

.btn-outline  { background: transparent; color: #555; border: 1px solid #ddd; }
.btn-outline:hover { background: #f4f5f7; }

.btn-danger   { background: #fef2f2; color: #b91c1c; }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-success  { background: #f0fdf4; color: #15803d; }
.btn-success:hover { background: #15803d; color: #fff; }

.btn-warning  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.btn-warning:hover { background: #d97706; color: #fff; border-color: #d97706; }

.btn-sm { padding: 6px 11px; font-size: 12px; }

/* ---- Forms ---- */
.form-group   { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #444;
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: #333;
  transition: border-color .18s;
  background: #fff;
}

.form-control:focus {
  outline: none;
  border-color: #B8960C;
  box-shadow: 0 0 0 3px rgba(184,150,12,.1);
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #B8960C;
  cursor: pointer;
}

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

/* ---- Modal ---- */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 { font-size: 17px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #999;
  line-height: 1;
  padding: 0 4px;
}

.modal-close:hover { color: #333; }

.modal-body   { padding: 22px 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 10px; }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: 7px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---- Filter Tabs ---- */
.filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid #ddd;
  text-decoration: none;
  color: #555;
  font-size: 13px;
  font-weight: 500;
  transition: all .18s;
}

.filter-tab:hover { border-color: #B8960C; color: #B8960C; }
.filter-tab.active { background: #B8960C; color: #fff; border-color: #B8960C; }

/* ---- Login Page (inline override) ---- */
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---- Patient Info Grid ---- */
.patient-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 24px;
}

.pinfo-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pinfo-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #aaa;
}

.pinfo-val {
  font-size: 15px;
  color: #1a1a1a;
  font-weight: 500;
}

.fee-amount {
  color: #B8960C;
}

/* ---- Treatment Badge ---- */
.treat-badge {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .sidebar       { width: 200px; }
  .admin-main    { margin-left: 200px; padding: 20px; }
}

@media (max-width: 900px) {
  .patient-info-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .sidebar            { width: 0; overflow: hidden; }
  .admin-main         { margin-left: 0; padding: 16px; }
  .form-row-2         { grid-template-columns: 1fr; }
  .stats-grid         { grid-template-columns: 1fr 1fr; }
  .patient-info-grid  { grid-template-columns: 1fr 1fr; }
}
