/* =========================================================
   FLUXIA AQS — صفحة الحجز book-v2
   ========================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0f172a;
  --navy-2: #1e293b;
  --panel: rgba(30, 41, 59, 0.72);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --sky: #38bdf8;
  --gold: #fbbf24;
  --success: #10b981;
  --danger: #ef4444;
  --border: rgba(148, 163, 184, 0.22);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(56, 189, 248, 0.14), transparent 60%),
    radial-gradient(800px 400px at 10% 110%, rgba(251, 191, 36, 0.10), transparent 60%),
    linear-gradient(160deg, #0f172a 0%, #111c33 55%, #0f172a 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
}

.hidden { display: none !important; }

/* ===== التحميل ===== */
.book-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--navy);
}
.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--sky);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.book-loading p { color: var(--muted); font-size: 1rem; }

/* ===== خطأ فادح ===== */
.book-fatal {
  margin-top: 15vh;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.book-fatal p { font-size: 1.2rem; color: var(--muted); }

/* ===== الترويسة ===== */
.book-header { text-align: center; margin-bottom: 26px; }
.book-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 2px 18px rgba(251, 191, 36, 0.35);
  margin-bottom: 6px;
}
.book-header-sub { color: var(--muted); font-size: 0.95rem; }

.book-main { width: 100%; max-width: 780px; }

/* ===== مؤشر الخطوات ===== */
.stepper {
  display: flex;
  list-style: none;
  justify-content: space-between;
  margin: 0 0 28px;
  padding: 0;
  position: relative;
}
.stepper::before {
  content: "";
  position: absolute;
  top: 17px;
  inset-inline: 8%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
  z-index: 1;
}
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-2);
  color: var(--muted);
  border: 2px solid var(--border);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}
.step-label { font-size: 0.8rem; color: var(--muted); transition: color 0.3s ease; }
.step.active .step-num {
  background: var(--sky);
  border-color: var(--sky);
  color: #082f49;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.55);
}
.step.active .step-label { color: var(--sky); font-weight: 600; }
.step.done .step-num { background: var(--gold); border-color: var(--gold); color: #451a03; }
.step.done .step-label { color: var(--gold); }

/* ===== لوحات الخطوات ===== */
.book-step { display: none; }
.book-step.active { display: block; animation: stepIn 0.35s ease; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.step-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 16px; }
.time-title { margin-top: 26px; }

/* ===== الخدمات ===== */
.service-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .service-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 820px) { .service-list { grid-template-columns: repeat(3, 1fr); } }

.service-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--text);
  cursor: pointer;
  text-align: start;
  font: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.service-card:hover {
  transform: translateY(-3px);
  border-color: var(--sky);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.18);
}
.service-card.selected {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.10);
  box-shadow: 0 0 0 1px var(--gold), 0 8px 26px rgba(251, 191, 36, 0.22);
}
.service-name { font-size: 1.05rem; font-weight: 700; }
.service-meta { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--muted); flex-wrap: wrap; }

/* ===== الموظفون ===== */
.staff-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .staff-list { grid-template-columns: repeat(2, 1fr); } }

.staff-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  color: var(--text);
  cursor: pointer;
  text-align: start;
  font: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.staff-card:hover { transform: translateY(-3px); border-color: var(--sky); }
.staff-card.selected {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.10);
  box-shadow: 0 0 0 1px var(--gold);
}
.staff-card.any { border-style: dashed; }
.staff-name { font-size: 1.05rem; font-weight: 700; }
.staff-hint { font-size: 0.8rem; color: var(--muted); }

/* ===== التقويم ===== */
.calendar {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 6px;
}
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cal-nav-btn:hover:not(:disabled) { border-color: var(--sky); color: var(--sky); }
.cal-nav-btn:disabled { opacity: 0.3; cursor: default; }
.cal-month-label { font-weight: 700; color: var(--gold); font-size: 1.05rem; }

.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-weekdays span { text-align: center; font-size: 0.75rem; color: var(--muted); padding: 4px 0; }
.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 46px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cal-day small { font-size: 0.62rem; opacity: 0.85; }
.cal-day.available { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.25); }
.cal-day.available:hover { background: rgba(251, 191, 36, 0.2); border-color: var(--gold); }
.cal-day.selected {
  background: var(--gold);
  color: #451a03;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
}
.cal-day.today:not(.selected) { border-color: var(--sky); color: var(--sky); font-weight: 600; }
.cal-day.disabled { color: rgba(148, 163, 184, 0.4); cursor: default; }
.cal-empty { min-height: 46px; }

/* ===== الأوقات المتاحة ===== */
.slot-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.slot-btn {
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--navy-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.slot-btn:hover { border-color: var(--sky); color: var(--sky); transform: translateY(-2px); }
.slot-btn.selected { background: var(--gold); border-color: var(--gold); color: #451a03; }
.slot-note { color: var(--muted); padding: 10px 0; font-size: 0.95rem; }

/* ===== نموذج البيانات ===== */
.book-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.field input, .field textarea {
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus, .field textarea:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}
.field textarea { resize: vertical; }

/* ===== ملخص الحجز ===== */
.book-summary {
  margin-top: 22px;
  background: rgba(251, 191, 36, 0.06);
  border: 1px dashed rgba(251, 191, 36, 0.4);
  border-radius: 12px;
  padding: 16px 18px;
}
.book-summary h3 { color: var(--gold); font-size: 1rem; margin-bottom: 10px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 0.95rem; }
.sum-row + .sum-row { border-top: 1px solid rgba(148, 163, 184, 0.12); }
.sum-row dt { color: var(--muted); }
.sum-row dd { font-weight: 600; text-align: end; }

/* ===== رسائل الخطأ ===== */
.book-error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-size: 0.9rem;
}

/* ===== أزرار التنقل ===== */
.book-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.btn-primary, .btn-secondary, .btn-gold {
  padding: 13px 26px;
  border-radius: 12px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #082f49;
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(56, 189, 248, 0.5); }
.btn-gold {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #451a03;
  box-shadow: 0 8px 22px rgba(251, 191, 36, 0.35);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(251, 191, 36, 0.5); }
.btn-secondary { background: transparent; border: 1.5px solid var(--border); color: var(--muted); }
.btn-secondary:hover { border-color: var(--sky); color: var(--sky); }
.btn-primary:disabled, .btn-gold:disabled { opacity: 0.6; cursor: wait; transform: none; }

/* ===== شاشة النجاح (تُنشأ ديناميكياً من JS، ولا تظهر إلا عند .visible) ===== */
.book-success { display: none; }
.book-success.visible {
  width: 100%;
  max-width: 560px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 30px 0;
}
.success-icon {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  border: 3px solid var(--success);
  color: var(--success);
  font-size: 2.6rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 34px rgba(16, 185, 129, 0.35);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.4);
}
@keyframes popIn {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.book-success h2 { color: var(--gold); font-size: 1.6rem; }
.success-msg { color: var(--muted); }
.booking-code-box {
  background: rgba(251, 191, 36, 0.08);
  border: 2px dashed var(--gold);
  border-radius: 14px;
  padding: 18px 34px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.booking-code-label { color: var(--muted); font-size: 0.85rem; }
#book-booking-code {
  font-size: 2.4rem;
  letter-spacing: 10px;
  color: var(--gold);
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 16px rgba(251, 191, 36, 0.5);
}
/* اليوم والشهر خارج مربع الرقم */
.booking-date-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1rem;
  color: var(--muted);
}
.booking-date-line strong { color: var(--text); font-size: 1.15rem; }
/* مربع تحذيري واضح: حفظ الرقم والتاريخ */
.booking-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: rgba(251, 191, 36, 0.14);
  border: 1.5px solid var(--gold);
  border-radius: 12px;
  padding: 13px 18px;
  color: var(--gold);
  font-weight: 700;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.18);
}
.booking-warning p { margin: 0; font-size: 0.95rem; line-height: 1.6; }
.booking-warning-icon { font-size: 1.3rem; flex-shrink: 0; }
.success-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ===== التذييل ===== */
.book-footer { margin-top: auto; padding-top: 30px; color: var(--muted); font-size: 0.85rem; }
.book-footer strong { color: var(--sky); }
.book-footer a { color: inherit; text-decoration: none; }

/* ===== ملاحظة فارغة ===== */
.empty-note {
  color: var(--muted);
  padding: 18px;
  text-align: center;
  background: var(--panel);
  border-radius: 12px;
  border: 1px dashed var(--border);
}

/* ===== استجابة الشاشات الصغيرة ===== */
@media (max-width: 480px) {
  .book-header h1 { font-size: 1.5rem; }
  .step-label { font-size: 0.68rem; }
  .cal-day { min-height: 40px; font-size: 0.85rem; }
  #book-booking-code { font-size: 1.8rem; letter-spacing: 6px; }
  .book-nav { flex-direction: column-reverse; }
  .book-nav button { width: 100%; }
}

/* ===== الشريط العلوي (اللغة + الثيم) ===== */
.book-topbar {
  width: 100%;
  max-width: 780px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.lang-select {
  background: var(--navy-2);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}
.lang-select:hover, .lang-select:focus { border-color: var(--sky); }
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--navy-2);
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover { border-color: var(--sky); transform: scale(1.08); }

/* ===== الوقت المحدد (شريحة ذهبية قابلة للإلغاء) ===== */
.slot-btn.chosen {
  background: var(--gold);
  border-color: var(--gold);
  color: #451a03;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}
.chosen-x {
  margin-inline-start: 8px;
  font-weight: 900;
  opacity: 0.75;
}
.slot-btn.chosen:hover .chosen-x { opacity: 1; }

/* ===== تنبيه الخصوصية ===== */
.privacy-note {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.85;
  text-align: center;
  line-height: 1.7;
}

/* ===== التقييم بالنجوم ===== */
.rating-card {
  width: 100%;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.rating-card h3 { color: var(--gold); font-size: 1.05rem; }
.rating-stars { display: flex; justify-content: center; gap: 6px; }
.star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  color: rgba(148, 163, 184, 0.4);
  transition: color 0.15s ease, transform 0.15s ease;
  padding: 0;
}
.star:hover { transform: scale(1.18); }
.star.on {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}
.rating-card textarea {
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.rating-card textarea:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}
.rating-msg { font-size: 0.9rem; color: var(--muted); min-height: 1.2em; }
.rating-msg.ok { color: var(--success); }

/* ===== الوضع الفاتح ===== */
html.light {
  --navy: #f1f5f9;
  --navy-2: #ffffff;
  --panel: rgba(255, 255, 255, 0.85);
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15, 23, 42, 0.16);
}
html.light body {
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(56, 189, 248, 0.12), transparent 60%),
    radial-gradient(800px 400px at 10% 110%, rgba(251, 191, 36, 0.12), transparent 60%),
    linear-gradient(160deg, #eef2f7 0%, #ffffff 55%, #eef2f7 100%);
  color: var(--text);
}
html.light .field input,
html.light .field textarea,
html.light .rating-card textarea {
  background: #ffffff;
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.18);
}
html.light .book-loading { background: #eef2f7; }
html.light .service-card.selected,
html.light .staff-card.selected { background: rgba(251, 191, 36, 0.15); }
html.light .book-summary { background: rgba(251, 191, 36, 0.12); }
html.light .star { color: rgba(71, 85, 105, 0.35); }
html.light .booking-code-box { background: rgba(251, 191, 36, 0.12); }
html.light .booking-warning { background: rgba(251, 191, 36, 0.18); border-color: #b45309; color: #92400e; box-shadow: none; }
