/* ==========================================================================
   Medical Care Clinics — motion & overlay system (public site)
   Timings and easing come from tokens.css (--mcc-dur-*, --mcc-ease-*).
   Rules: transform + opacity only, short, one calm entrance per element, no bounce,
   nothing loops forever, everything is visible without JavaScript, and
   prefers-reduced-motion turns movement off (overlays still open, instantly).
   ========================================================================== */

:root { --mcc-dir: 1; }
[dir="rtl"] { --mcc-dir: -1; }   /* "forward" in Arabic moves toward the left */

@keyframes mcc-rise   { from { opacity: 0; transform: translateY(var(--mcc-rise)); } to { opacity: 1; transform: none; } }
@keyframes mcc-glide  { from { transform: translateY(var(--mcc-rise)); } to { transform: none; } }
@keyframes mcc-fade   { from { opacity: 0; } to { opacity: 1; } }
@keyframes mcc-settle { from { transform: scale(1.045); } to { transform: none; } }
@keyframes mcc-pop    { from { transform: scale(.94); } to { transform: none; } }
@keyframes mcc-pop-in { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes mcc-step   { from { opacity: 0; transform: translateX(calc(var(--mcc-dir) * var(--wz-sign, 1) * -22px)); } to { opacity: 1; transform: none; } }
@keyframes mcc-draw   { from { stroke-dashoffset: 30; } to { stroke-dashoffset: 0; } }
@keyframes mcc-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes mcc-dots   { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Hover & press feedback ---------- */
.btn { transition: background-color var(--mcc-dur-hover) var(--mcc-ease-std), color var(--mcc-dur-hover) var(--mcc-ease-std),
       border-color var(--mcc-dur-hover) var(--mcc-ease-std), box-shadow var(--mcc-dur-hover) var(--mcc-ease-std), transform var(--mcc-dur-hover) var(--mcc-ease-std); }
.btn:active:not(:disabled), .chip:active, .tab:active, .wz-chip:active, .wz-time:active:not(:disabled), .wz-day:active:not(:disabled),
.wz-doc:active, .wz-dept:active, .icon-btn:active, .mobilebar a:active { transform: scale(.97); }
.chip, .tab, .link-btn, .wz-chip, .wz-time, .wz-day, .wz-doc, .wz-dept, .faq__item, .icon-btn, .contact-card {
  transition: background-color var(--mcc-dur-hover) var(--mcc-ease-std), color var(--mcc-dur-hover) var(--mcc-ease-std),
              border-color var(--mcc-dur-hover) var(--mcc-ease-std), box-shadow var(--mcc-dur-hover) var(--mcc-ease-std), transform var(--mcc-dur-hover) var(--mcc-ease-std);
}

/* Card images: a slow, small zoom on hover (pointer devices only) */
.svc__media img, .dept__media img, .offer__media img, .article__media img { transition: transform 600ms var(--mcc-ease-out); }
.doc__avatar { transition: transform 300ms var(--mcc-ease-out), box-shadow 300ms var(--mcc-ease-out); }
@media (hover: hover) {
  .svc:hover .svc__media img, .dept:hover .dept__media img, .offer:hover .offer__media img, .article:hover .article__media img { transform: scale(1.045); }
  .doc:hover .doc__avatar { transform: scale(1.05); }
  /* the "Book" button on cards is always visible (phones too); on hover it simply fills */
  .svc:hover .btn--soft, .doc:hover .btn--soft { background: var(--mcc-primary); color: #fff; border-color: var(--mcc-primary); }
}
.svc__media, .offer__media, .doc { cursor: pointer; }
.offer__media { display: block; width: 100%; padding: 0; border: 0; background: none; }

/* ---------- Hero: one calm, staggered entrance (no endless motion) ---------- */
.float-card { animation: none; }
.wa-float::before { animation-iteration-count: 3; }
@media (prefers-reduced-motion: no-preference) {
  .hero__content > * { animation: mcc-rise var(--mcc-dur-enter) var(--mcc-ease-out) both; }
  /* the headline and intro are the page's largest text: they glide in but are never hidden (keeps loading speed / LCP) */
  .hero__content > h1, .hero__content > .lead { animation-name: mcc-glide; }
  .hero__content > :nth-child(2) { animation-delay: 70ms; }
  .hero__content > :nth-child(3) { animation-delay: 140ms; }
  .hero__content > :nth-child(4) { animation-delay: 210ms; }
  .hero__content > :nth-child(5) { animation-delay: 280ms; }
  .hero__frame img { animation: mcc-settle 1100ms var(--mcc-ease-out) both; }   /* transform only: the photo is never hidden */
  .hero__visual::before { animation: mcc-fade 700ms var(--mcc-ease-out) 120ms both; }
  .float-card { animation: mcc-pop-in var(--mcc-dur-enter) var(--mcc-ease-out) both; }
  .float-card--a { animation-delay: 420ms; }
  .float-card--b { animation-delay: 520ms; }
  .float-card--c { animation-delay: 620ms; }
  .quickbar { animation: mcc-rise var(--mcc-dur-enter) var(--mcc-ease-out) 300ms both; }
}

/* ---------- Scroll reveal (JS adds .reveal only when motion is allowed) ---------- */
.reveal { opacity: 0; transform: translateY(var(--mcc-rise));
  transition: opacity var(--mcc-dur-enter) var(--mcc-ease-out), transform var(--mcc-dur-enter) var(--mcc-ease-out);
  transition-delay: calc(var(--i, 0) * var(--mcc-stagger)); }
.reveal.is-visible { opacity: 1; transform: none; }

/* Grid swap (tabs / filters): new cards fade in with a short stagger */
@media (prefers-reduced-motion: no-preference) {
  .is-swapping > * { animation: mcc-rise 280ms var(--mcc-ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
}

/* ---------- Booking wizard micro-interactions ---------- */
@media (prefers-reduced-motion: no-preference) {
  .wz-step.is-active { animation: mcc-step 300ms var(--mcc-ease-out) both; }
  .wizard[data-dir="back"] { --wz-sign: -1; }
  .mcc-pulse { animation: mcc-pop 240ms var(--mcc-ease-out); }
  .wz-error:not(:empty), .coupon__msg:not(:empty) { animation: mcc-rise 240ms var(--mcc-ease-out) both; }
  .form-success:not([hidden]) { animation: mcc-pop-in 380ms var(--mcc-ease-out) both; }
  .form-success .icon use { stroke-dasharray: 30; animation: mcc-draw 500ms var(--mcc-ease-out) 120ms both; }
}
.wz-time.is-selected::before, .wz-chip.is-selected::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-inline-end: 6px; vertical-align: -2px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.wz-picked { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 14px; border-radius: 12px;
  background: var(--mcc-success-bg); color: var(--mcc-success); font-size: 14.5px; font-weight: 500; }
.wz-picked .icon { flex-shrink: 0; }
@media (prefers-reduced-motion: no-preference) { .wz-picked { animation: mcc-pop-in 300ms var(--mcc-ease-out) both; } }

/* Loading skeletons (availability, doctor slots) */
.skel { display: block; border-radius: 12px; background: linear-gradient(90deg, var(--mcc-teal-50) 25%, #fff 50%, var(--mcc-teal-50) 75%) 0 0 / 200% 100%; }
@media (prefers-reduced-motion: no-preference) { .skel { animation: mcc-shimmer 1.3s linear infinite; } }
.skel-row { display: flex; gap: 8px; flex-wrap: wrap; }
.skel-row .skel { height: 44px; flex: 1 0 96px; max-width: 120px; }
.skel-days { display: flex; gap: 8px; }
.skel-days .skel { width: 74px; height: 86px; flex-shrink: 0; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--mcc-teal-600); animation: mcc-dots 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }

/* ---------- FAQ: smooth open/close where the browser supports it ---------- */
@supports (interpolate-size: allow-keywords) {
  .faq { interpolate-size: allow-keywords; }
  .faq__item::details-content { block-size: 0; overflow: hidden;
    transition: block-size var(--mcc-dur-enter) var(--mcc-ease-std), content-visibility var(--mcc-dur-enter) allow-discrete; }
  .faq__item[open]::details-content { block-size: auto; }
}

/* ---------- Mobile menu: list items follow the panel ---------- */
@media (max-width: 1024px) and (prefers-reduced-motion: no-preference) {
  .nav { transition: opacity var(--mcc-dur-overlay) var(--mcc-ease-out), transform var(--mcc-dur-overlay) var(--mcc-ease-out), visibility var(--mcc-dur-overlay); }
  .nav.is-open .nav__list li { animation: mcc-rise 300ms var(--mcc-ease-out) both; }
  .nav.is-open .nav__list li:nth-child(2) { animation-delay: 30ms; } .nav.is-open .nav__list li:nth-child(3) { animation-delay: 60ms; }
  .nav.is-open .nav__list li:nth-child(4) { animation-delay: 90ms; } .nav.is-open .nav__list li:nth-child(5) { animation-delay: 120ms; }
  .nav.is-open .nav__list li:nth-child(6) { animation-delay: 150ms; } .nav.is-open .nav__list li:nth-child(n+7) { animation-delay: 180ms; }
}

/* ---------- Chat ---------- */
@media (prefers-reduced-motion: no-preference) {
  .chat-panel:not([hidden]) { animation: mcc-pop-in var(--mcc-dur-overlay) var(--mcc-ease-out) both; transform-origin: bottom left; }
  [dir="ltr"] .chat-panel:not([hidden]) { transform-origin: bottom right; }
  .chat-msg { animation: mcc-rise 240ms var(--mcc-ease-out) both; }
  .chat-fab { transition: transform var(--mcc-dur-hover) var(--mcc-ease-std); }
  .chat-fab:hover { transform: translateY(-2px); }
  /* one soft glow when the launcher first appears, so it is noticed without blinking forever */
  .chat-fab:not([hidden]) .chat-fab__ic { animation: mcc-ai-glow 1.6s var(--mcc-ease-out) .6s 2 both; }
  @keyframes mcc-ai-glow { 0%, 100% { box-shadow: inset 0 0 0 2px rgba(255,255,255,.22), 0 0 0 0 rgba(18,214,204,.55); }
                           60% { box-shadow: inset 0 0 0 2px rgba(255,255,255,.22), 0 0 0 10px rgba(18,214,204,0); } }
}
.chat-msg--typing { padding: 10px 14px; }

/* ==========================================================================
   Overlay system (drawer · dialog · bottom sheet) — markup comes from overlay.js
   ========================================================================== */
html.ov-lock, html.ov-lock body { overflow: hidden; }
.ov { position: fixed; inset: 0; z-index: 400; display: flex; }
.ov__backdrop { position: absolute; inset: 0; background: var(--mcc-overlay); opacity: 0;
  transition: opacity var(--mcc-dur-overlay) var(--mcc-ease-std); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.ov.is-open .ov__backdrop { opacity: 1; }
.ov__panel { position: relative; display: flex; flex-direction: column; background: #fff; outline: none; overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0, 40, 41, .55); opacity: 0;
  transition: transform var(--mcc-dur-overlay) var(--mcc-ease-out), opacity var(--mcc-dur-overlay) var(--mcc-ease-out); }
.ov.is-closing .ov__panel { transition-timing-function: var(--mcc-ease-in); transition-duration: calc(var(--mcc-dur-overlay) * .8); }
.ov.is-open .ov__panel { opacity: 1; transform: none; }
.ov__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.ov__titles { flex: 1; min-width: 0; }
.ov__title { font-size: 19px; font-weight: 600; color: var(--ink); margin: 0; line-height: 1.4; outline: none; }
.ov__sub { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.ov__close { flex-shrink: 0; width: 44px; height: 44px; margin: -6px; border-radius: 50%; border: 0; background: var(--tint); color: var(--ink);
  display: grid; place-items: center; transition: background-color var(--mcc-dur-hover) var(--mcc-ease-std); margin-inline-start: auto; }
.ov__close:hover { background: var(--mcc-teal-100); }
.ov__extra { flex-shrink: 0; padding: 0 20px 14px; border-bottom: 1px solid var(--line); }
.ov__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* "bare" overlays (photo on top): the close button floats over the content */
.ov--bare .ov__head { position: absolute; top: 0; inset-inline: 0; z-index: 2; border: 0; padding: 14px; pointer-events: none; }
.ov--bare .ov__close { pointer-events: auto; background: rgba(255, 255, 255, .94); box-shadow: var(--sh-sm); margin: 0; margin-inline-start: auto; }

/* dialog: centred card */
.ov--dialog { align-items: center; justify-content: center; padding: 24px; }
.ov--dialog .ov__panel { width: min(640px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); border-radius: var(--r-xl); transform: translateY(14px) scale(.98); }
.ov--dialog.ov--wide .ov__panel { width: min(780px, 100%); }

/* drawer: full-height panel from the inline-end side */
.ov--drawer { justify-content: flex-end; }
.ov--drawer .ov__panel { width: min(580px, 100%); height: 100%; border-start-start-radius: var(--r-xl); border-end-start-radius: var(--r-xl); transform: translateX(104%); }
[dir="rtl"] .ov--drawer .ov__panel { transform: translateX(-104%); }
.ov--drawer.is-open .ov__panel { transform: none; }

/* bottom sheet (phones) */
.ov--sheet { align-items: flex-end; }
.ov--sheet .ov__panel { width: 100%; max-height: calc(var(--vvh, 100dvh) - 10px); border-radius: 24px 24px 0 0; transform: translateY(100%); opacity: 1;
  padding-bottom: env(safe-area-inset-bottom); }
.ov--sheet.ov--tall .ov__panel { height: calc(var(--vvh, 100dvh) - 10px); }
.ov--sheet.is-open .ov__panel { transform: none; }
.ov__handle { display: flex; justify-content: center; padding: 10px 0 2px; cursor: grab; touch-action: none; flex-shrink: 0; }
.ov__handle span { width: 42px; height: 5px; border-radius: 99px; background: var(--mcc-gray-200); }
.ov--sheet .ov__head { touch-action: none; padding-top: 6px; }
.ov--sheet.ov--bare .ov__head { top: 18px; }

/* Content inside overlays */
.ov .mdl-hero { aspect-ratio: 16 / 8; }
.ov .mdl-content { padding: 24px 28px 28px; }
@media (max-width: 760px) { .ov .mdl-content { padding: 18px 18px 24px; } }
.mdl-section { margin-top: 20px; }
.mdl-section h3 { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0 0 10px; }
.mdl-docs { display: grid; gap: 8px; }
.mdl-doc-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: var(--r); border: 1.5px solid var(--line); background: #fff; text-align: start;
  transition: border-color var(--mcc-dur-hover) var(--mcc-ease-std), background-color var(--mcc-dur-hover) var(--mcc-ease-std); }
.mdl-doc-row:hover { border-color: var(--brand-300); background: var(--mcc-teal-50); }
.mdl-doc-row b { display: block; color: var(--ink); font-weight: 600; font-size: 14.5px; }
.mdl-doc-row small { color: var(--muted); font-size: 12.5px; }
.mdl-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.mdl-slot { display: flex; flex-direction: column; align-items: center; padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; line-height: 1.45; }
.mdl-slot b { font-size: 15px; font-weight: 600; }
.mdl-slot:hover { border-color: var(--brand); background: var(--mcc-teal-50); }
.mdl-note { color: var(--muted); font-size: 14px; margin: 0; }
.mdl-price { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 4px; }
.mdl-price strong { font-size: 30px; font-weight: 700; color: var(--mcc-primary); }
.mdl-price del { color: var(--muted); }
.mdl-terms { font-size: 13.5px; color: var(--muted); margin-top: 10px; }
.mdl-sample { display: inline-block; margin-top: 8px; font-size: 12.5px; color: var(--mcc-warning); background: var(--mcc-warning-bg); padding: 2px 10px; border-radius: 99px; }

/* Booking drawer */
.ov--booking .ov__body { background: var(--tint); }
.ov--booking .wizard { min-height: 100%; border-radius: 0; box-shadow: none; padding: 22px 24px 0; }
.ov--booking .wz-nav { position: sticky; bottom: 0; z-index: 2; margin: 24px -24px 0; padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .ov--booking .wizard { padding: 16px 16px 0; }
  .ov--booking .wz-nav { margin-inline: -16px; padding-inline: 16px; }
  .ov--booking .wz-nav .btn { flex: 1; }
}
.ov-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; list-style: none; margin: 0; padding: 0; }
.ov-steps li { font-size: 12px; color: var(--muted); text-align: center; }
.ov-steps li::before { content: ""; display: block; height: 4px; border-radius: 99px; margin-bottom: 6px;
  background: linear-gradient(var(--mcc-primary), var(--mcc-primary)) no-repeat 0 0 / 0% 100%, var(--mcc-gray-200);
  transition: background-size var(--mcc-dur-enter) var(--mcc-ease-out); }
[dir="rtl"] .ov-steps li::before { background-position: 100% 0, 0 0; }
.ov-steps li.is-done::before, .ov-steps li.is-active::before { background-size: 100% 100%, auto; }
.ov-steps li.is-active { color: var(--mcc-primary); font-weight: 600; }
.wizard-home { display: grid; place-items: center; gap: 12px; padding: 48px 24px; border-radius: var(--r-xl); border: 1.5px dashed rgba(255, 255, 255, .3); text-align: center; color: #fff; }
.wizard-home p { margin: 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 500; inset-inline: 0; top: 16px; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 460px; padding: 12px 18px; border-radius: 14px; background: var(--mcc-ink); color: #fff;
  font-size: 14.5px; box-shadow: var(--sh-lg); opacity: 0; transform: translateY(-10px);
  transition: opacity var(--mcc-dur-overlay) var(--mcc-ease-out), transform var(--mcc-dur-overlay) var(--mcc-ease-out); pointer-events: auto; }
.toast.is-in { opacity: 1; transform: none; }
.toast--success .icon { color: var(--mcc-sage-500); }
.toast--error { background: var(--mcc-error); }

/* Page transitions now live in style.css (every page loads it, and both pages must opt in). */

/* ---------- Reduced motion: no movement anywhere (overlays still open, instantly) ---------- */
@media (prefers-reduced-motion: reduce) {
  .ov__backdrop, .ov__panel, .toast, .ov-steps li::before { transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* A heading that is also a button (offer titles) */
.link-plain { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.link-plain:hover { color: var(--mcc-interactive); }
.ov--booking .wz-error, .ov--booking .form-success { scroll-margin-bottom: 104px; scroll-margin-top: 16px; }
.mdl-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }

/* ---------- Chat: rich cards (services, doctors, earliest times) ---------- */
.chat-msg--cards { max-width: 100%; width: 100%; background: transparent; box-shadow: none; padding: 0; }
.chat-msg--cards > p { background: #fff; display: inline-block; padding: 9px 13px; border-radius: 16px; border-start-start-radius: 4px; box-shadow: var(--sh-sm); margin: 0 0 8px; }
.chat-cards { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.chat-card { flex: 0 0 200px; scroll-snap-align: start; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--sh-sm); }
.chat-card img { width: 100%; height: 110px; object-fit: cover; }
.chat-card b { padding: 8px 12px 0; font-size: 14px; color: var(--ink); line-height: 1.45; }
.chat-card small { padding: 0 12px; color: var(--muted); font-size: 12.5px; }
.chat-card__acts { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 12px; margin-top: auto; }
.chat-card--doc { align-items: center; text-align: center; padding-top: 14px; }
.chat-card--doc .wz-doc__av { width: 56px; height: 56px; font-size: 20px; }
.chat-card--doc .chat-card__acts { width: 100%; }
.chat-slots { flex: 1 0 100%; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.chat-slots > b { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); margin-bottom: 8px; }
.chat-cards:has(.chat-slots) { flex-direction: column; overflow: visible; }
.chat-panel__quick { scrollbar-width: none; }
.nav__list a { white-space: nowrap; }
/* the logo never squashes: keep its proportions and give the menu room on narrower laptops */
.header .brand { flex-shrink: 0; }
.header .brand__logo { width: auto; }
@media (max-width: 1340px) and (min-width: 1025px) {
  .header .brand__logo { height: 46px; }
  .header .icon-btn { display: none; }
  .nav__list a { padding-inline: 7px; font-size: 14px; }
  .header__cta { padding-inline: 16px; }
}
