/* ==========================================================================
   كايرو سكوير — واجهة مساعد المحادثة (chatbot.css)
   تُحمَّل بعد polish.css. تعتمد على متغيّرات التصميم الأصلية (--ink, --line, --sand, --gold ...)
   وعلى خط Almarai. كل الأسماء بالبادئة .cc- حتى لا تتعارض مع بقية الموقع.
   ========================================================================== */
.cc{ font-family:var(--ar-body, "Almarai", "Segoe UI", Tahoma, sans-serif); color:var(--ink); -webkit-tap-highlight-color:transparent; }
.cc *, .cc *::before, .cc *::after{ box-sizing:border-box; }
.cc button{ font-family:inherit; cursor:pointer; }
:where(.cc) a{ color:inherit; text-decoration:none; }
.cc :focus-visible{ outline:2px solid var(--ink); outline-offset:2px; border-radius:8px; }
.cc-sr{ position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }

/* ---------- launcher ---------- */
.cc-launcher{
  position:fixed; z-index:64; inset-inline-end:24px; bottom:24px;
  display:inline-flex; align-items:center; justify-content:center; gap:10px; height:56px; padding:0 22px 0 18px;
  border:0; border-radius:var(--r-pill, 999px); background:var(--ink); color:#fff;
  font-size:.95rem; font-weight:800; white-space:nowrap;
  /* ink fill + a cream ring: the ring is invisible on the cream page and keeps the button readable on the dark footer / dark hero photos (the fill alone is the same colour as the footer) */
  box-shadow:0 0 0 2px var(--bg, #FBF9F5), 0 18px 36px -12px rgba(21,22,26,.55), 0 3px 10px rgba(21,22,26,.22);
  transition:transform var(--dur, 220ms) var(--ease, ease), box-shadow var(--dur, 220ms) var(--ease, ease);
}
.cc-launcher:hover{ transform:translateY(-2px); }
.cc-launcher:active{ transform:scale(.96); }
.cc-launcher:focus-visible{ outline:2px solid var(--gold); outline-offset:3px; border-radius:var(--r-pill, 999px); }
.cc-launcher__ic{ display:grid; place-items:center; }
.cc-launcher__ic svg{ width:30px; height:30px; }

/* ---------- nudge bubble ---------- */
.cc-nudge{
  position:fixed; z-index:63; inset-inline-end:24px; bottom:94px; display:flex; align-items:center; gap:2px; max-width:250px;
  background:var(--surface, #fff); border:1px solid var(--line); border-radius:18px; padding:4px 4px 4px 6px;
  box-shadow:var(--shadow-md); animation:ccPop .35s var(--ease, ease) both;
}
.cc-nudge[hidden]{ display:none; }
.cc-nudge__txt{ border:0; background:none; padding:8px 10px; font-size:.86rem; font-weight:700; color:var(--ink); text-align:start; line-height:1.5; }
.cc-nudge__x{ flex:none; width:28px; height:28px; border-radius:50%; border:0; background:var(--sand); color:var(--ink-soft); display:grid; place-items:center; }

/* ---------- panel ---------- */
.cc-panel{
  position:fixed; z-index:140; inset-inline-end:24px; bottom:92px; width:396px; max-width:calc(100vw - 32px);
  height:min(660px, calc(100dvh - 116px)); height:min(660px, calc(var(--cc-h, 100dvh) - 116px));
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--bg); border:1px solid var(--line); border-radius:24px; box-shadow:var(--shadow-lg);
  opacity:0; transform:translateY(14px) scale(.98); transform-origin:bottom left;
  transition:opacity .2s var(--ease, ease), transform .2s var(--ease, ease);
}
.cc-panel[hidden]{ display:none; }
.cc-panel.is-in{ opacity:1; transform:none; }

.cc-head{ flex:none; display:flex; align-items:center; gap:12px; padding:14px 16px; background:var(--ink); color:#fff; }
.cc-head__t{ flex:1; min-width:0; }
.cc-head__name{ font-size:1rem; font-weight:800; line-height:1.3; }
.cc-head__sub{ display:flex; align-items:center; gap:6px; font-size:.75rem; color:rgba(255,255,255,.78); line-height:1.4; }
.cc-head__sub::before{ content:""; flex:none; width:7px; height:7px; border-radius:50%; background:#6FCB93; }
.cc-icon{ flex:none; width:38px; height:38px; border-radius:50%; border:0; background:rgba(255,255,255,.1); color:#fff; display:grid; place-items:center; transition:background var(--dur-fast, 150ms) ease; }
.cc-icon:hover{ background:rgba(255,255,255,.2); }
.cc-head .cc-icon:focus-visible{ outline-color:#fff; }

.cc-log{ position:relative; flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:16px 14px 10px; display:flex; flex-direction:column; gap:14px; scrollbar-width:thin; }
.cc-log:focus-visible{ outline-offset:-3px; }

/* rows + bubbles */
.cc-row{ display:flex; gap:8px; align-items:flex-start; max-width:100%; animation:ccIn .28s var(--ease, ease) both; }
.cc-row--user{ justify-content:flex-end; }
.cc-av{ flex:none; width:30px; height:30px; border-radius:50%; display:grid; place-items:center; background:var(--ink); color:#fff; margin-top:2px; }
.cc-av svg{ width:21px; height:21px; }
.cc-col{ display:flex; flex-direction:column; align-items:flex-start; gap:8px; min-width:0; flex:1; max-width:calc(100% - 38px); }
.cc-bubble{ padding:10px 14px; border-radius:18px; font-size:.92rem; line-height:1.75; max-width:100%; overflow-wrap:anywhere; }
.cc-bubble--bot{ background:var(--surface, #fff); border:1px solid var(--line); border-start-start-radius:6px; }
.cc-bubble--user{ background:var(--ink); color:#fff; border-end-end-radius:6px; max-width:86%; }
.cc-bubble strong{ font-weight:800; }
.cc-p + .cc-p{ margin-top:6px; }
.cc-li{ display:flex; align-items:baseline; gap:8px; margin-top:4px; }
.cc-p + .cc-li{ margin-top:6px; }
.cc-dot{ flex:none; width:6px; height:6px; border-radius:50%; background:var(--gold); transform:translateY(-3px); }
.cc-li__t{ min-width:0; }
.cc-note{ font-size:.75rem; line-height:1.6; color:var(--muted); padding-inline:4px; }

/* typing */
.cc-dots{ display:flex; align-items:center; gap:5px; padding:15px 16px; }
.cc-dots i{ width:7px; height:7px; border-radius:50%; background:var(--muted-2, #9A968B); animation:ccDot 1.1s ease-in-out infinite; }
.cc-dots i:nth-child(2){ animation-delay:.15s; }
.cc-dots i:nth-child(3){ animation-delay:.3s; }

/* unit cards */
.cc-cards{ display:flex; flex-direction:column; gap:8px; width:100%; }
.cc-unit{ display:flex; flex-wrap:wrap; gap:10px; padding:10px; background:var(--surface, #fff); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow-xs); }
.cc-unit__img{ flex:none; width:86px; min-height:92px; align-self:stretch; border-radius:12px; overflow:hidden; background:var(--sand); }
.cc-unit__img img{ width:100%; height:100%; object-fit:cover; display:block; }
.cc-unit__body{ flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.cc-unit__top{ display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
.cc-unit__name{ font-size:.92rem; font-weight:800; line-height:1.4; color:var(--ink); }
.cc-unit__meta{ font-size:.8rem; color:var(--ink-soft); line-height:1.5; }
.cc-unit__loc{ font-size:.76rem; color:var(--muted); line-height:1.5; }
.cc-unit__price{ font-size:.95rem; font-weight:800; margin-top:2px; font-variant-numeric:lining-nums tabular-nums; }
.cc-unit__acts{ flex:1 0 100%; display:flex; align-items:center; gap:6px; }
.cc-unit__acts .cc-btn{ flex:1; }
.cc-badge{ flex:none; font-size:.7rem; font-weight:800; line-height:1; padding:5px 8px; border-radius:var(--r-pill, 999px); white-space:nowrap; }
.cc-badge--ready{ background:var(--success-bg, #E7EFE9); color:#2D6246; }
.cc-badge--building{ background:var(--sand); color:var(--ink-soft); }
.cc-badge--soon{ background:#F1E5CC; color:#6B4A1E; }
.cc-fav{ flex:none; width:34px; height:34px; border-radius:50%; border:1px solid var(--line-strong); background:#fff; color:var(--ink); display:grid; place-items:center; transition:transform var(--dur-fast, 150ms) ease, background var(--dur-fast, 150ms) ease; }
.cc-fav:active{ transform:scale(.9); }
.cc-fav.is-fav{ color:var(--danger); background:var(--danger-bg, #F6E7E1); border-color:var(--danger); }
.cc-fav.is-fav svg{ fill:currentColor; }

/* buttons */
.cc-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:34px; padding:0 14px; border-radius:var(--r-pill, 999px);
  border:1px solid transparent; font-size:.8rem; font-weight:800; line-height:1; white-space:nowrap;
  transition:transform var(--dur-fast, 150ms) ease, background var(--dur-fast, 150ms) ease, border-color var(--dur-fast, 150ms) ease;
}
.cc-btn:active{ transform:scale(.96); }
.cc-btn--solid{ background:var(--ink); color:#fff; }
.cc-btn--solid:hover{ background:#000; }
.cc-btn--ghost, .cc-btn--outline{ background:#fff; color:var(--ink); border-color:var(--line-strong); }
.cc-btn--ghost:hover, .cc-btn--outline:hover{ border-color:var(--ink); }
.cc-btn--link{ background:var(--sand); color:var(--ink); }
.cc-btn--link:hover{ background:var(--sand-2); }
.cc-btn--link svg{ flex:none; }
.cc-btn--wa{ background:var(--success, #3F7D58); color:#fff; min-height:40px; padding:0 18px; font-size:.86rem; }
.cc-btn--wa:hover{ background:#356A4A; }
.cc-acts{ display:flex; flex-wrap:wrap; gap:8px; }
.cc-acts .cc-btn--outline{ min-height:40px; padding:0 16px; font-size:.86rem; }

/* plans */
.cc-plans{ display:flex; flex-direction:column; gap:8px; width:100%; }
.cc-plan{ background:var(--surface, #fff); border:1px solid var(--line); border-radius:16px; padding:12px 14px; }
.cc-plan__name{ font-size:.92rem; font-weight:800; margin-bottom:8px; }
.cc-plan__grid{ display:grid; grid-template-columns:1fr 1fr; gap:8px 12px; }
.cc-plan__cell{ display:flex; flex-direction:column; gap:1px; min-width:0; }
.cc-plan__k{ font-size:.74rem; color:var(--muted); line-height:1.4; }
.cc-plan__v{ font-size:.88rem; font-weight:800; font-variant-numeric:lining-nums tabular-nums; overflow-wrap:anywhere; }
.cc-plan__tag{ display:inline-block; margin-top:8px; padding:4px 10px; border-radius:var(--r-pill, 999px); background:var(--success-bg, #E7EFE9); color:#2D6246; font-size:.72rem; font-weight:800; }

/* comparison */
.cc-cmp{ width:100%; overflow-x:auto; background:var(--surface, #fff); border:1px solid var(--line); border-radius:16px; }
.cc-cmp table{ width:100%; border-collapse:collapse; font-size:.8rem; }
.cc-cmp th, .cc-cmp td{ padding:9px 10px; text-align:start; border-bottom:1px solid var(--line); vertical-align:top; line-height:1.5; }
.cc-cmp tbody th{ color:var(--muted); font-weight:700; white-space:nowrap; }
.cc-cmp thead th{ font-weight:800; background:var(--sand); }
.cc-cmp tr:last-child th, .cc-cmp tr:last-child td{ border-bottom:0; }
.cc-cmp td{ font-weight:700; font-variant-numeric:lining-nums tabular-nums; }

/* quick replies */
.cc-chips{ flex:none; display:flex; gap:8px; overflow-x:auto; padding:10px 14px; border-top:1px solid var(--line); background:var(--bg); scrollbar-width:none; -webkit-overflow-scrolling:touch; }
.cc-chips::-webkit-scrollbar{ display:none; }
.cc-chips[hidden]{ display:none; }
.cc-chip{ flex:none; min-height:36px; padding:0 14px; border-radius:var(--r-pill, 999px); border:1px solid var(--line-strong); background:var(--surface, #fff); color:var(--ink); font-size:.82rem; font-weight:700; white-space:nowrap; transition:border-color var(--dur-fast, 150ms) ease, background var(--dur-fast, 150ms) ease, transform var(--dur-fast, 150ms) ease; }
.cc-chip:hover{ border-color:var(--ink); background:var(--sand); }
.cc-chip:active{ transform:scale(.96); }

/* composer */
.cc-form{ flex:none; display:flex; align-items:center; gap:8px; padding:10px 12px; border-top:1px solid var(--line); background:var(--surface, #fff); }
.cc-input{ flex:1; min-width:0; height:46px; padding:0 18px; border-radius:var(--r-pill, 999px); border:1px solid var(--line-strong); background:var(--bg); color:var(--ink); font:inherit; font-size:16px; }
.cc-input::placeholder{ color:var(--muted); opacity:1; }
.cc-input:focus-visible{ outline:2px solid var(--ink); outline-offset:-1px; border-color:var(--ink); border-radius:var(--r-pill, 999px); }
.cc-send{ flex:none; width:46px; height:46px; border-radius:50%; border:0; background:var(--ink); color:#fff; display:grid; place-items:center; transition:opacity var(--dur-fast, 150ms) ease, transform var(--dur-fast, 150ms) ease; }
.cc-send svg{ transform:scaleX(-1); }
.cc-send:disabled{ opacity:.35; cursor:default; }
.cc-send:not(:disabled):active{ transform:scale(.92); }
.cc-foot{ flex:none; margin:0; padding:0 14px 10px; background:var(--surface, #fff); font-size:.75rem; line-height:1.5; color:var(--muted); text-align:center; }

/* ---------- page-specific lifts: keep the launcher clear of fixed UI that already exists ---------- */
/* map page: the selected-unit card sits in the same corner, so the launcher steps above it while the card is open */
body[data-page="map"]:has(.map-floating-card.is-open) .cc-launcher{ bottom:176px; }
body[data-page="map"]:has(.map-floating-card.is-open) .cc-nudge{ display:none; }
@media (min-width:768px) and (max-width:960px){
  body.has-cta-bar .cc-launcher{ bottom:104px; }
  body.has-cta-bar .cc-nudge{ bottom:174px; }
}

/* ---------- phones: round launcher above the floating nav, full-screen sheet ---------- */
@media (max-width:767px){
  .cc-launcher{
    width:56px; padding:0; inset-inline-end:16px;
    bottom:calc(var(--bottom-nav-h, 78px) + env(safe-area-inset-bottom, 0px) + 14px);
  }
  .cc-launcher__txt{ display:none; }
  body.has-cta-bar .cc-launcher{ bottom:calc(var(--bottom-nav-h, 78px) + env(safe-area-inset-bottom, 0px) + 92px); }
  body[data-page="map"]:has(.map-floating-card.is-open) .cc-launcher{ bottom:calc(var(--bottom-nav-h, 78px) + env(safe-area-inset-bottom, 0px) + 150px); }
  .cc-nudge{ inset-inline-end:16px; bottom:calc(var(--bottom-nav-h, 78px) + env(safe-area-inset-bottom, 0px) + 82px); max-width:min(250px, calc(100vw - 32px)); }
  body.has-cta-bar .cc-nudge{ bottom:calc(var(--bottom-nav-h, 78px) + env(safe-area-inset-bottom, 0px) + 160px); }
  .cc-panel{
    inset:0; top:0; bottom:0; width:auto; max-width:none; height:100dvh; height:var(--cc-h, 100dvh); border:0; border-radius:0; box-shadow:none;
    transform:translateY(24px);
  }
  .cc-panel.is-in{ transform:none; }
  .cc[data-open="true"] .cc-launcher, .cc[data-open="true"] .cc-nudge{ display:none; }
  html.cc-lock, html.cc-lock body{ overflow:hidden; }
  .cc-head{ padding:max(14px, env(safe-area-inset-top, 0px)) 14px 14px 16px; }
  .cc-form{ padding-bottom:max(10px, env(safe-area-inset-bottom, 0px)); }
  .cc-foot{ display:none; }
  .cc-bubble{ font-size:.95rem; }
}
@media (max-width:359px){ .cc-unit__img{ width:72px; } }

/* ---------- motion ---------- */
@keyframes ccIn{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }
@keyframes ccPop{ from{ opacity:0; transform:translateY(8px) scale(.96); } to{ opacity:1; transform:none; } }
@keyframes ccDot{ 0%, 80%, 100%{ transform:translateY(0); opacity:.45; } 40%{ transform:translateY(-4px); opacity:1; } }
@media (prefers-reduced-motion: reduce){
  .cc *, .cc *::before, .cc *::after{ animation:none !important; transition:none !important; }
  .cc-panel{ transform:none; }
  .cc-dots i{ opacity:.7; }
}
@media print{ .cc{ display:none !important; } }
