:root {
  --primary: #00BEAE;
  --primary-dark: #049688;
  --secondary: #3D3D3D;
  --danger: #E11D48;
  --success: #16A34A;
  --bg: #FAFAFA;
  --card-border: #E5E7EB;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Cairo', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--secondary);
  direction: rtl;
}

header.clinic-header {
  position: relative;
  overflow: hidden;
  background: var(--primary);
  background-position: center;
  background-size: cover;
  color: #fff;
  min-height: 270px;
  padding: 38px 16px 30px;
  text-align: center;
}
header.clinic-header.has-cover { background-color: #245F61; }
header.clinic-header .hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 43, 49, .18), rgba(8, 43, 49, .82));
  pointer-events: none;
}
header.clinic-header > *:not(.hero-shade) { position: relative; z-index: 1; }
header.clinic-header img.logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  margin-bottom: 8px;
}
header.clinic-header h1 { margin: 0; font-size: 20px; }
header.clinic-header .contact { margin-top: 6px; font-size: 13px; opacity: .95; }

.header-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.action-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, .5);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.action-pill svg { width: 16px; height: 16px; fill: #fff; }
.social-row { display: flex; justify-content: center; gap: 14px; margin-top: 14px; }
.social-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}
.social-icon:hover { background: rgba(255, 255, 255, .3); transform: translateY(-2px); }
.social-icon svg { width: 19px; height: 19px; fill: #fff; }

main { max-width: 1040px; margin: 0 auto; padding: 26px 20px 42px; }
.booking-intro { margin-bottom: 18px; text-align: center; }
.booking-intro span { color: var(--primary-dark); font-size: 12px; font-weight: bold; }
.booking-intro h2 { margin: 5px 0 0; color: var(--secondary); font-size: 21px; }
.service-category { margin-bottom: 28px; }
.category-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: bold;
  margin: 0 0 12px;
  color: var(--secondary);
}
.category-title::before {
  content: '';
  width: 5px;
  height: 25px;
  border-radius: 8px;
  background: var(--primary);
}
.services-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.service-card {
  min-height: 112px;
  background: linear-gradient(135deg, #fff 0%, #F4FBFA 100%);
  border: 1px solid #DCEFEB;
  border-radius: 18px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(22, 52, 58, .06);
  transition: transform .18s ease, box-shadow .18s ease;
}
.service-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(22, 52, 58, .1); }
.service-card img, .service-card .icon-fallback {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}
.service-card img { background: #eee; }
.service-card .icon-fallback {
  background: rgba(0, 190, 174, .12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.service-card .info { flex: 1; min-width: 0; }
.service-card .info h3 { margin: 0 0 4px; font-size: 15px; }
.service-card .info p { margin: 0; font-size: 12.5px; color: #6B7280; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:disabled { background: #B7E5E1; cursor: not-allowed; }
.btn-outline { background: #fff; border: 1.5px solid var(--primary); color: var(--primary); }

/* بانر الخصم العائم */
.promo-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  width: min(340px, calc(100vw - 36px));
  overflow: hidden;
  background: #fff;
  border: 1px solid #DCEFEB;
  border-radius: 18px;
  box-shadow: 0 14px 38px rgba(22, 52, 58, .2);
  animation: promo-in .35s ease both;
}
.promo-banner img { width: 100%; height: 128px; object-fit: cover; display: block; }
.promo-content { padding: 12px 14px 14px; }
.promo-content h3 { margin: 0 0 4px; color: #16343A; font-size: 16px; }
.promo-content p { margin: 0 0 10px; color: #6B7280; font-size: 12px; line-height: 1.6; }
.promo-content .btn { width: 100%; }
.promo-close {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  cursor: pointer;
}
@keyframes promo-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

/* ورقة "اتصل بنا" والشاشة المنبثقة للحجز */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.overlay.hidden { display: none; }
.sheet { background: #fff; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 20px 18px 26px; }
.sheet h2 { margin: 0 0 16px; font-size: 17px; }
.sheet-header { position: relative; }
.sheet .step-label { font-size: 13px; color: #6B7280; margin-bottom: 8px; }
.close-btn { position: absolute; left: 16px; top: 0; background: none; border: none; font-size: 20px; cursor: pointer; color: #9CA3AF; }
.contact-option { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--card-border); border-radius: 12px; margin-bottom: 10px; text-decoration: none; color: var(--secondary); }
.contact-option .circle { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.contact-option .circle.call { background: rgba(0, 190, 174, .12); }
.contact-option .circle.whatsapp { background: rgba(37, 211, 102, .12); }
.contact-option svg { width: 20px; height: 20px; }
.contact-option .circle.call svg { fill: var(--primary); }
.contact-option .circle.whatsapp svg { fill: #25D366; }
.contact-option .label { font-weight: bold; font-size: 14px; }
.contact-option .sub { font-size: 12px; color: #6B7280; direction: ltr; text-align: right; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { padding: 9px 16px; border-radius: 20px; border: 1.5px solid var(--card-border); background: #fff; cursor: pointer; font-size: 13.5px; font-family: inherit; }
.chip.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.doctor-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.doctor-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--card-border); background: #fff; cursor: pointer; font-family: inherit; text-align: right; width: 100%; }
.doctor-card img, .doctor-card .avatar-fallback { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.doctor-card img { background: #eee; }
.doctor-card .avatar-fallback { background: rgba(0, 190, 174, .12); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: bold; }
.doctor-card span { font-size: 14.5px; font-weight: bold; }
input[type="text"], input[type="tel"], input[type="date"], select { width: 100%; padding: 12px; border-radius: 10px; border: 1.5px solid var(--card-border); font-size: 14px; font-family: inherit; margin-bottom: 14px; }
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.slot-btn { padding: 10px 4px; border-radius: 10px; border: 1.5px solid var(--card-border); background: #fff; cursor: pointer; font-size: 13px; font-family: inherit; direction: ltr; }
.slot-btn.selected { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============ شبكة أيام الحجز (بديل الـ date picker مال الهاتف) ============ */
.grid-nav-row { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.grid-nav-btn {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--card-border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--primary-dark);
}
.grid-nav-btn:disabled { opacity: .35; cursor: not-allowed; }
.grid-today-btn {
  margin-inline-start: auto;
  border: 1.5px solid var(--primary);
  color: var(--primary-dark);
  background: #fff;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
}
.day-scroller {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 4px;
  scroll-snap-type: x proximity;
}
.day-col {
  flex: 0 0 108px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.day-col-header {
  text-align: center;
  padding: 8px 4px;
  border-radius: 12px;
  background: #F5F5F5;
}
.day-col-header.is-today { background: var(--primary); color: #fff; }
.day-col-weekday { font-size: 11px; opacity: .8; }
.day-col-num { font-size: 17px; font-weight: bold; }
.day-slot-btn {
  width: 100%;
  padding: 9px 4px;
  border-radius: 10px;
  border: 1.5px solid var(--primary);
  background: #fff;
  color: var(--primary-dark);
  font-size: 12.5px;
  font-family: inherit;
  direction: ltr;
  cursor: pointer;
}
.day-slot-btn.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.day-slot-btn.booked {
  border-color: var(--card-border);
  background: #F3F3F3;
  color: #B0B0B0;
  cursor: not-allowed;
  text-decoration: line-through;
}
.day-slot-dash {
  width: 100%;
  padding: 9px 4px;
  text-align: center;
  color: #C7C7C7;
  font-size: 13px;
}
.day-grid-loading { text-align: center; padding: 18px 0; color: #9CA3AF; font-size: 13px; }

/* صندوق اليوم الواحد + أسهم التنقل — يستبدل منتقي التاريخ الافتراضي */
.day-box-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.day-box-arrow {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--card-border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--primary-dark);
}
.day-box-arrow:disabled { opacity: .35; cursor: not-allowed; }
.day-box {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
}
.day-box-weekday { font-size: 12.5px; opacity: .9; }
.day-box-date { font-size: 17px; font-weight: bold; margin-top: 2px; direction: ltr; }

/* شبكة أوقات اليوم الواحد — ثلاثة أعمدة (زي التقويم) */
.day-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.summary-box { background: rgba(0, 190, 174, .08); border-radius: 12px; padding: 14px; margin-bottom: 16px; font-size: 14px; line-height: 1.9; }
.error-text { color: var(--danger); font-size: 13px; margin-bottom: 10px; }
.success-box { text-align: center; padding: 20px 0; }
.success-box .icon { font-size: 48px; color: var(--success); margin-bottom: 12px; }
.loading-center { text-align: center; padding: 40px 0; color: #9CA3AF; }

@media (max-width: 680px) {
  header.clinic-header { min-height: 235px; padding-top: 28px; }
  main { padding: 22px 14px 32px; }
  .services-grid { grid-template-columns: 1fr; gap: 11px; }
  .service-card { min-height: 100px; }
  .promo-banner { right: 12px; bottom: 12px; }
}
.nearest-note { background: rgba(0, 190, 174, .12); color: var(--secondary); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; line-height: 1.7; }
.nearest-note.warn { background: rgba(225, 29, 72, .08); color: var(--danger); }
header.clinic-header img.logo.custom-logo { object-fit: contain; padding: 5px; }

