@font-face {
  font-family: 'Parastoo';
  src: url('/fonts/Parastoo-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --sidebar-w: 300px;
}

body {
  font-family: 'Parastoo', 'Segoe UI', 'Tahoma', Arial, sans-serif;
  direction: rtl;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.65;
}

/* ─── Typography ─────────────────────────── */
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .3s;
}

.sidebar-logo {
  padding: 1.75rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: .85rem;
}
.sidebar-logo .logo-icon {
  width: 48px; height: 48px;
  background: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  color: white;
}
.sidebar-logo h1 { font-size: 1.2rem; color: white; }
.sidebar-logo small { font-size: .8rem; color: var(--gray-400); display: block; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-section {
  padding: .6rem 1.5rem .3rem;
  font-size: .75rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .8rem 1.5rem;
  color: var(--gray-300);
  cursor: pointer;
  transition: all .2s;
  border-right: 3px solid transparent;
  font-size: .975rem;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.nav-item.active { background: rgba(37,99,235,.2); color: white; border-right-color: var(--primary); }
.nav-item .nav-icon {
  font-size: 1.35rem;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
  color: rgba(255,255,255,.75);
}

.sidebar-footer {
  padding: 1.1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
}
.user-info { display: flex; align-items: center; gap: .85rem; margin-bottom: .85rem; }
.user-avatar {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  flex-shrink: 0;
}
.user-name { font-size: .95rem; font-weight: 600; }
.user-role { font-size: .75rem; color: var(--gray-400); }

.main-content {
  flex: 1;
  margin-right: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1.2rem; font-weight: 700; }

.page-content { padding: 1.75rem; flex: 1; }

/* ─── Cards ──────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.card-header {
  padding: 1.35rem 1.6rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 1.6rem; }
.card-footer {
  padding: 1.1rem 1.6rem;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ─── Stats Grid ─────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.4rem;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}
.stat-value { font-size: 2.1rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .85rem; color: var(--gray-500); margin-top: .3rem; }
.stat-icon { font-size: 1.8rem; margin-bottom: .6rem; color: var(--primary); line-height: 1; }

/* ─── Buttons ────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.1rem;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 500;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover:not(:disabled) { background: #b45309; }
.btn-outline { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover:not(:disabled) { background: var(--gray-50); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }
.btn-sm { padding: .38rem .8rem; font-size: .85rem; }
.btn-lg { padding: .85rem 1.75rem; font-size: 1.05rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: .45rem; width: 36px; height: 36px; justify-content: center; }

/* ─── Forms ──────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .95rem; font-weight: 500; color: var(--gray-700); margin-bottom: .45rem; }
.form-label .required { color: var(--danger); }
.form-control {
  width: 100%;
  padding: .65rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  font-size: .95rem;
  color: var(--gray-800);
  background: white;
  transition: border-color .2s, box-shadow .2s;
  direction: rtl;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: .8rem; color: var(--gray-500); margin-top: .35rem; }
.form-row { display: grid; gap: 1.1rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ─── Tables ─────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: .85rem 1.1rem; text-align: right; font-size: .85rem; font-weight: 600; color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
tbody td { padding: .85rem 1.1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; font-size: .95rem; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* ─── Badges ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .7rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  gap: .3rem;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ─── Alerts ─────────────────────────────── */
.alert {
  padding: .95rem 1.1rem;
  border-radius: 7px;
  font-size: .95rem;
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin-bottom: 1rem;
}
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--primary-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ─── Modal ──────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: white;
  border-radius: var(--radius);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(.95); transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  padding: 1.35rem 1.6rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: 1.6rem; }
.modal-footer { padding: 1.1rem 1.6rem; border-top: 1px solid var(--gray-200); display: flex; gap: .75rem; justify-content: flex-end; }

/* ─── Upload Zone ────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gray-50);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone .upload-icon { font-size: 2.8rem; margin-bottom: .75rem; color: var(--gray-400); line-height: 1; }
.upload-zone p { color: var(--gray-500); font-size: .95rem; }
.upload-zone strong { color: var(--primary); }

/* ─── Tabs ───────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); gap: 0; margin-bottom: 1.5rem; }
.tab-btn {
  padding: .85rem 1.35rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: .95rem;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
  font-weight: 500;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover:not(.active) { color: var(--gray-700); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ─── Toggle Switch ──────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: .85rem; }
.toggle {
  position: relative;
  width: 48px; height: 26px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--gray-300);
  border-radius: 99px;
  transition: .3s;
}
.toggle input:checked + .toggle-track { background: var(--primary); }
.toggle-track::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  right: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: .3s;
}
.toggle input:checked + .toggle-track::before { transform: translateX(-22px); }

/* ─── Login Page ─────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .logo-circle {
  width: 72px; height: 72px;
  background: var(--primary);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin-bottom: .85rem;
  color: white;
}
.login-logo h1 { font-size: 1.6rem; }
.login-logo p { color: var(--gray-500); font-size: .95rem; margin-top: .3rem; }

/* ─── Booking Page ───────────────────────── */
.booking-page {
  min-height: 100vh;
  background: var(--gray-50);
  padding: 1rem;
}
.booking-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 1.35rem 1.6rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.booking-container {
  max-width: 680px;
  margin: 0 auto;
}
.booking-steps { display: flex; justify-content: center; gap: .5rem; margin-bottom: 2rem; }
.step {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  font-weight: 600;
  background: var(--gray-200);
  color: var(--gray-500);
  position: relative;
}
.step.done { background: var(--success); color: white; }
.step.active { background: var(--primary); color: white; }
.step-connector { width: 40px; height: 2px; background: var(--gray-200); align-self: center; }
.step-connector.done { background: var(--success); }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); gap: .5rem; }
.slot-btn {
  padding: .65rem .4rem;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  text-align: center;
  font-size: .9rem;
  font-weight: 500;
  transition: all .2s;
  color: var(--gray-700);
}
.slot-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.slot-btn.selected { border-color: var(--primary); background: var(--primary); color: white; }

.date-group { margin-bottom: 1.25rem; }
.date-label { font-size: .85rem; font-weight: 600; color: var(--gray-500); margin-bottom: .5rem; background: var(--gray-100); padding: .4rem .85rem; border-radius: 5px; display: inline-block; }

/* ─── Misc ───────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: .85rem; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: .85rem; color: var(--gray-300); }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--gray-800);
  color: white;
  padding: .85rem 1.75rem;
  border-radius: 8px;
  font-size: .95rem;
  z-index: 999;
  transition: transform .3s;
  max-width: 90vw;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(var(--sidebar-w)); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
}

.copy-field {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  padding: .5rem .85rem;
}
.copy-field input {
  flex: 1;
  border: none;
  background: none;
  font-size: .85rem;
  color: var(--gray-700);
  direction: ltr;
  text-align: left;
}
.copy-field input:focus { outline: none; }

.divider { border: none; border-top: 1px solid var(--gray-200); margin: 1.6rem 0; }

/* Progress bar */
.progress { height: 9px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s; }

/* Pending badge in sidebar */
.nav-pending-badge { display: none; margin-right: auto; }
.nav-pending-badge.visible { display: inline-flex; }

/* Utility */
.hidden { display: none !important; }

/* OTP reschedule */
.otp-sent-msg { background: var(--success-light); border: 1px solid #bbf7d0; border-radius: var(--radius); padding: .75rem 1rem; color: var(--success); font-size: .9rem; margin-bottom: .5rem; }
.otp-input { font-size: 1.4rem; letter-spacing: .4rem; text-align: center; font-weight: 700; }
