/* ============================================================
   PREMIUM LAYER v2.0 — Sultan's Dental Clinic
   Additive: loaded AFTER style.css. Nothing below overrides
   layout fundamentals (sidebar position, grid structure).
   Design: "Clinical Glass" — violet/cyan/mint/amber on #15151F
   ============================================================ */

/* --- safety: CSS display rules must never beat [hidden] --- */
[hidden] { display: none !important; }

/* --- refined radii rhythm --- */
:root {
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;
  --glow-violet: rgba(139, 92, 246, 0.35);
  --glow-cyan: rgba(34, 211, 238, 0.25);
  --sheen: linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0) 42%);
}

/* ================= FOCUS + SELECTION + SCROLLBAR ================= */
:focus-visible {
  outline: 2px solid #A78BFA;
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
::selection { background: rgba(139, 92, 246, 0.35); color: #fff; }

* { scrollbar-width: thin; scrollbar-color: rgba(167,139,250,0.35) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.28);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(167, 139, 250, 0.5); }

/* dark-form autofill: browsers force pale-yellow bg */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
select:-webkit-autofill,
textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-background-clip: text !important;
  caret-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
  box-shadow: inset 0 0 0 1000px rgba(255,255,255,0.05) !important;
  border-color: var(--border-strong) !important;
}

/* ================= BUTTONS ================= */
.btn {
  position: relative;
  min-height: 44px;
  padding: 11px 20px;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.22s ease, background 0.22s ease, border-color 0.22s ease;
  overflow: hidden;
}
.btn::after {           /* top sheen */
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sheen);
  pointer-events: none;
  border-radius: inherit;
}
.btn:hover { transform: translateY(-1.5px); }
.btn:active { transform: translateY(0) scale(0.985); }

.btn-primary {
  background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 55%, #6D28D9 100%);
  border: 1px solid rgba(167, 139, 250, 0.45);
  color: #fff;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #9F75FF 0%, #8B5CF6 55%, #7C3AED 100%);
  box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5), inset 0 1px 0 rgba(255,255,255,0.22);
}
.btn-ghost:hover, .btn:not(.btn-primary):not(.btn-danger):hover {
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.btn-sm { min-height: 36px; padding: 8px 14px; font-size: 13px; }
.btn-danger:hover {
  box-shadow: 0 8px 22px rgba(251, 113, 133, 0.28);
  transform: translateY(-1.5px);
}

/* ================= CARDS ================= */
.card, .stat-card {
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.055) 0%, rgba(255,255,255,0.028) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.28s ease, border-color 0.28s ease;
}
.card:hover, .stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(167, 139, 250, 0.38);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(167,139,250,0.12),
              0 0 32px rgba(139, 92, 246, 0.12);
}

.stat-card { overflow: hidden; }
.stat-card::before {
  /* accent gradient rail top */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--violet) 0%, var(--cyan) 55%, var(--mint) 100%);
  opacity: 0.75;
}
.stat-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #D6CCFF 60%, #A5B4FC 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { letter-spacing: 0.07em; font-weight: 700; }
.stat-sub { color: var(--text-2); }

.card-title {
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 16px;
}

/* ================= TABLES ================= */
.table-wrap {
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.022);
  overflow: auto;
}
table { font-size: 13.5px; }
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(26, 27, 40, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--text-2);
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(255,255,255,0.045);
}
tbody tr { transition: background 0.16s ease, box-shadow 0.16s ease; }
tbody tr:hover {
  background: rgba(139, 92, 246, 0.08);
  box-shadow: inset 3px 0 0 var(--violet);
}
tbody tr:last-child td { border-bottom: none; }

/* ================= BADGES ================= */
.badge {
  border-radius: var(--r-pill);
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 11px;
  font-size: 11.5px;
  border: 1px solid;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.badge-scheduled { box-shadow: 0 0 14px rgba(139,92,246,0.14); }
.badge-completed, .badge-paid, .badge-active { box-shadow: 0 0 14px rgba(52,211,153,0.14); }
.badge-unpaid, .badge-no-show, .badge-low { box-shadow: 0 0 14px rgba(251,113,133,0.12); }

/* ================= SIDEBAR ================= */
.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(139,92,246,0.22), rgba(34,211,238,0.14));
  border: 1px solid rgba(167,139,250,0.4);
  box-shadow: 0 8px 22px rgba(139, 92, 246, 0.22), inset 0 1px 0 rgba(255,255,255,0.14);
}
.brand-mark svg { width: 24px; height: 24px; color: #C4B5FD; }

.nav-section {
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--text-3);
}
.nav-item {
  position: relative;
  border-radius: var(--r-sm);
  margin: 2px 0;
  padding: 10px 12px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  color: var(--text-2);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(139,92,246,0.22), rgba(139,92,246,0.08));
  border: 1px solid rgba(167,139,250,0.38);
  color: #fff;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.16);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--violet-2), var(--cyan));
  box-shadow: 0 0 12px rgba(167,139,250,0.7);
}

/* SVG nav icons (replaces Unicode glyphs) */
.nav-ico {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: currentColor;
  opacity: 0.9;
}
.nav-ico svg { width: 18px; height: 18px; }

/* ================= TOPBAR + PAGE TITLE ================= */
.topbar {
  background: rgba(21, 21, 31, 0.78);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.page-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(120deg, #fff 0%, #DDD6FE 55%, #A5B4FC 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.cmdk-trigger {
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  padding: 8px 14px;
  min-height: 38px;
  font-family: var(--mono);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.cmdk-trigger:hover {
  border-color: rgba(167,139,250,0.45);
  box-shadow: 0 0 18px rgba(139,92,246,0.16);
}

/* ================= FORMS ================= */
.field input, .field select, .field textarea,
.form-input, input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="tel"], input[type="date"], select, textarea {
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.045);
  min-height: 46px;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus,
input:focus, select:focus, textarea:focus {
  border-color: rgba(167, 139, 250, 0.65);
  background: rgba(139, 92, 246, 0.07);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18), 0 0 22px rgba(139, 92, 246, 0.14);
  outline: none;
}
.field span, label > span {
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--text-2);
}

/* ================= MODAL ================= */
.modal {
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #20212F 0%, #1A1B28 100%);
  border: 1px solid var(--border-strong);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(167,139,250,0.1),
              0 0 60px rgba(139, 92, 246, 0.1);
  animation: modalIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.975); }
  to   { opacity: 1; transform: none; }
}
.modal h3 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.modal-overlay {
  background: rgba(8, 8, 14, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-x {
  border-radius: var(--r-xs);
  transition: background 0.18s ease, transform 0.18s ease;
}
.modal-x:hover { transform: rotate(90deg); }

/* ================= TOASTS ================= */
.toast {
  border-radius: var(--r-sm);
  background: rgba(30, 31, 46, 0.94);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 13px 16px;
  font-weight: 600;
  animation: toastIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: none; }
}
.toast-ok  { border-left: 3px solid var(--mint);  box-shadow: 0 18px 44px rgba(0,0,0,0.4), 0 0 22px rgba(52,211,153,0.12); }
.toast-err, .toast-error { border-left: 3px solid var(--rose); box-shadow: 0 18px 44px rgba(0,0,0,0.4), 0 0 22px rgba(251,113,133,0.12); }
.toast-warn { border-left: 3px solid var(--amber); box-shadow: 0 18px 44px rgba(0,0,0,0.4), 0 0 22px rgba(251,191,36,0.12); }

/* ================= LOGIN / PORTAL ================= */
.login-screen, .portal-screen { padding: 24px 18px; }
.login-card, .portal-card {
  width: 100%;
  max-width: 420px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(32, 33, 47, 0.82) 0%, rgba(26, 27, 40, 0.88) 100%);
  border: 1px solid rgba(167, 139, 250, 0.22);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04),
              0 0 80px rgba(139, 92, 246, 0.1);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  animation: loginIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.login-mark {
  width: 62px;
  height: 62px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, rgba(139,92,246,0.28), rgba(34,211,238,0.16));
  border: 1px solid rgba(167,139,250,0.45);
  box-shadow: 0 14px 36px rgba(139, 92, 246, 0.3), inset 0 1px 0 rgba(255,255,255,0.18);
}
.login-mark svg { width: 32px; height: 32px; color: #C4B5FD; }
.login-logo h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(120deg, #fff 0%, #DDD6FE 55%, #A5B4FC 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-portal-link a {
  color: #A5B4FC;
  font-weight: 700;
  position: relative;
  text-decoration: none;
}
.login-portal-link a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.login-portal-link a:hover::after { transform: scaleX(1); transform-origin: left; }
.login-portal-link a:hover { text-decoration: none; }

/* Demo button — on-brand violet, distinct from Sign In */
.demo-btn {
  background: linear-gradient(135deg, rgba(139,92,246,0.16), rgba(34,211,238,0.1)) !important;
  color: #DDD6FE !important;
  border: 1px solid rgba(167,139,250,0.45) !important;
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.18) !important;
  min-height: 46px;
}
.demo-btn:hover {
  background: linear-gradient(135deg, rgba(139,92,246,0.28), rgba(34,211,238,0.16)) !important;
  box-shadow: 0 16px 40px rgba(139, 92, 246, 0.3) !important;
}
.demo-sep { letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.68rem; font-weight: 700; }

/* ================= COMMAND PALETTE ================= */
.cmdk-overlay {
  background: rgba(8, 8, 14, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.cmdk-panel {
  border-radius: var(--r-lg);
  background: rgba(30, 31, 46, 0.96);
  border: 1px solid var(--border-strong);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6), 0 0 60px rgba(139, 92, 246, 0.12);
  overflow: hidden;
}
.cmdk-row {
  border-radius: var(--r-xs);
  transition: background 0.14s ease;
}
.cmdk-row:hover { background: rgba(139, 92, 246, 0.14); }

/* ================= EMPTY STATES ================= */
.empty, .empty-state, [class*="empty"] {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-2);
  border: 1px dashed rgba(167, 139, 250, 0.28);
  border-radius: var(--r-md);
  background: rgba(139, 92, 246, 0.04);
}

/* ================= AMBIENT BG UPGRADE ================= */
.orb { opacity: 0.5; }
.orb-violet { background: #7C3AED; }
.orb-cyan { background: #0891B2; }

/* ================= MOTION SAFETY ================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card:hover, .stat-card:hover, .btn:hover, .nav-item:hover { transform: none; }
}

/* ================= RESPONSIVE ================= */
@media (max-width: 860px) {
  .page-content { padding: 20px 14px; }   /* generous, never cramped */
  .btn { min-height: 46px; }              /* thumb-friendly */
  .stat-value { font-size: 26px; }
  .login-card, .portal-card { padding: 28px 22px; }
  td { padding: 12px 13px; }
  th { padding: 12px 13px; }
}
@media (max-width: 480px) {
  .page-title { font-size: 17px; }
  .login-logo h1 { font-size: 21px; }
  .login-mark { width: 56px; height: 56px; }
  .login-mark svg { width: 28px; height: 28px; }
}
