/* Dr. Farah — Admin SPA
   Dark, warm-noir theme matching the public site's brand vocabulary.
   Gold used sparingly as accent, never as decoration. */

:root {
  --ink:       #070D0F;
  --noir:      #0C1518;
  --noir-2:    #10201F;
  --noir-3:    #16292A;
  --bone:      #ECE4D6;
  --bone-dim:  #C9C2B4;
  --gold:      #C6A15B;
  --gold-lite: #E4CE9E;
  --gold-deep: #A07E42;
  --muted:     #7E8E8C;
  --line:      rgba(198,161,91,.20);
  --line-soft: rgba(236,228,214,.10);
  --danger:    #D4736B;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--ink);
  color: var(--bone);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Header ── */
header {
  width: 100%;
  max-width: 720px;
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}
header h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: 0.02em;
  color: var(--bone);
}
header h1 span { color: var(--gold); }

/* ── Main card ── */
main {
  width: 100%;
  max-width: 1100px;
  padding: 0 1.5rem 3rem;
}
.card {
  background: var(--noir);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn-primary {
  background: var(--gold);
  color: var(--ink);
}
.btn-primary:hover { background: var(--gold-lite); }
.btn-ghost {
  background: transparent;
  color: var(--bone-dim);
  border: 1px solid var(--line-soft);
}
.btn-ghost:hover { background: var(--noir-2); color: var(--bone); }
.btn-sm {
  font-size: 0.82rem;
  padding: 0.4rem 0.9rem;
}

/* ── Identity panel ── */
.identity {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
}
.identity dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 0.75rem;
}
.identity dd {
  font-size: 1rem;
  color: var(--bone);
  margin-top: 0.15rem;
  word-break: break-all;
}
.roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.3rem;
}
.role-tag {
  display: inline-block;
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: var(--noir-3);
  color: var(--gold-lite);
  border: 1px solid var(--line);
}
.no-roles {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Errors ── */
.error-box {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(212,115,107,.12);
  border: 1px solid rgba(212,115,107,.30);
  border-radius: 6px;
  color: var(--danger);
  font-size: 0.88rem;
}

/* ── Loading ── */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line-soft);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
footer {
  margin-top: auto;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ════════════════════════════════════════════════════════════════
   Appointments Section
   ════════════════════════════════════════════════════════════════ */

.apt-heading {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 1.3rem;
  color: var(--gold);
  margin-bottom: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* ── Filter bar ── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}
.filters select,
.filters input {
  background: var(--noir-2);
  color: var(--bone);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.5rem 0.7rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
}
.filters select:focus,
.filters input:focus {
  outline: none;
  border-color: var(--gold);
}
.filters input[type="date"] {
  color-scheme: dark;
}
.filters input[type="text"] {
  min-width: 200px;
  flex: 1;
}

/* ── Table ── */
.apt-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.apt-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}
.apt-table-wrap thead {
  background: var(--noir-2);
}
.apt-table-wrap th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.apt-table-wrap td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--bone);
}
.apt-table-wrap tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
.apt-table-wrap tbody tr:hover {
  background: var(--noir-2);
}
.apt-table-wrap tbody tr:last-child td {
  border-bottom: none;
}

/* ── Status badges ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}
.badge-pending {
  background: rgba(198,161,91,.15);
  color: var(--gold-lite);
  border: 1px solid rgba(198,161,91,.25);
}
.badge-confirmed {
  background: rgba(76,175,80,.15);
  color: #81C784;
  border: 1px solid rgba(76,175,80,.25);
}
.badge-cancelled {
  background: rgba(212,115,107,.15);
  color: #EF9A9A;
  border: 1px solid rgba(212,115,107,.25);
}
.badge-completed {
  background: rgba(100,149,237,.15);
  color: #90CAF9;
  border: 1px solid rgba(100,149,237,.25);
}
.badge-no_show {
  background: rgba(158,158,158,.15);
  color: #BDBDBD;
  border: 1px solid rgba(158,158,158,.25);
}

/* ── Pager ── */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.pager .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Empty state ── */
.apt-empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
  font-style: italic;
}

/* ── Detail panel ── */
.detail-panel {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--noir-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}
.detail-header h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--bone);
}
.detail-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1.5rem;
}
.detail-body .field {
  margin-bottom: 0.3rem;
}
.detail-body .field-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.1rem;
}
.detail-body .field-value {
  font-size: 0.9rem;
  color: var(--bone);
  word-break: break-word;
}
.detail-body .field-full {
  grid-column: 1 / -1;
}
.detail-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}
.detail-status-row label {
  font-size: 0.82rem;
  color: var(--bone-dim);
}
.detail-status-row select {
  background: var(--noir);
  color: var(--bone);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
}
.detail-status-row select:focus {
  outline: none;
  border-color: var(--gold);
}

/* ── Utility ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }


.badge-draft {
  background: rgba(198,161,91,.12);
  color: var(--gold-lite);
  border: 1px solid rgba(198,161,91,.22);
}
.badge-submitted {
  background: rgba(76,175,80,.15);
  color: #81C784;
  border: 1px solid rgba(76,175,80,.25);
}
