/* ───────────────────────────────────────────────────────────────────────────
   Soraqçı — üzən söhbət köməkçisi (floating chat widget). Hər səhifədə: SPA + Xəbərçi.
   Ekranın aşağı-sağ küncündə: dairəvi FAB düymə + onun üstündə açılan söhbət
   pəncərəsi. Dizayn əsas sayt sistemi ilə eyni (yaşıl #2d5a3d, parşomen, IBM Plex,
   9px künc). Modallar (z-index 60) açılanda onların altında qalsın deyə z-index 55.
   ─────────────────────────────────────────────────────────────────────────── */
@keyframes adv-pop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes adv-blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.advisor {
  position: fixed; right: 22px; bottom: 22px; z-index: 55;
  display: flex; flex-direction: column; align-items: flex-end; gap: 14px;
}

/* FAB — açma/bağlama düyməsi (3D qabarıq: üst parıltı + alt bevel + yer kölgəsi).
   position:fixed valideynindən (.advisor) ötürü skroll zamanı yeri DƏYİŞMİR. */
.advisor-fab {
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer; padding: 0;
  color: #f8f2e4;
  background: radial-gradient(125% 125% at 32% 24%, #3c7150 0%, #2d5a3d 48%, #1f4a30 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    0 14px 24px -8px rgba(20, 44, 28, .55),      /* yer kölgəsi — dərinlik */
    0 4px 8px -2px rgba(0, 0, 0, .25),
    inset 0 2px 2px rgba(255, 255, 255, .38),    /* üst parıltı — qabarıqlıq */
    inset 0 -5px 8px rgba(10, 30, 18, .55);      /* alt içəri kölgə — bevel */
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.advisor-fab:hover {
  transform: translateY(-3px); filter: brightness(1.06);
  box-shadow:
    0 22px 34px -10px rgba(20, 44, 28, .6),
    0 6px 12px -2px rgba(0, 0, 0, .28),
    inset 0 2px 2px rgba(255, 255, 255, .42),
    inset 0 -5px 8px rgba(10, 30, 18, .55);
}
.advisor-fab:active {
  transform: translateY(0);
  box-shadow:
    0 6px 12px -6px rgba(20, 44, 28, .5),
    inset 0 2px 5px rgba(10, 30, 18, .5),
    inset 0 -1px 1px rgba(255, 255, 255, .22);
}
.advisor-fab-icon { display: block; filter: drop-shadow(0 1px 1px rgba(10, 30, 18, .4)); }
.advisor[data-open="true"] .advisor-fab { filter: brightness(.95); }

/* Söhbət pəncərəsi */
.advisor-panel {
  width: 380px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 110px);
  background: #f7f1e4; border: 1px solid #e2d7bf; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px -18px rgba(28, 40, 28, .5), 0 6px 18px -8px rgba(0,0,0,.22);
  transform-origin: bottom right; animation: adv-pop .2s ease both;
}

/* Başlıq */
.advisor-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 14px; background: #2d5a3d; color: #f5eddc; flex: 0 0 auto;
}
.advisor-id { display: flex; align-items: center; gap: 11px; min-width: 0; }
.advisor-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  background: rgba(245, 237, 220, .14); color: #f5eddc;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(245, 237, 220, .28);
}
.advisor-meta { min-width: 0; }
.advisor-title { font-family: 'IBM Plex Serif', Georgia, serif; font-weight: 600; font-size: 16px; line-height: 1.2; }
.advisor-status { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .85; margin-top: 2px; }
.advisor-dot { width: 7px; height: 7px; border-radius: 50%; background: #8fd6a4; box-shadow: 0 0 0 2px rgba(143, 214, 164, .25); }
.advisor-x {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  background: transparent; border: none; color: #f5eddc; opacity: .85;
  display: flex; align-items: center; justify-content: center; transition: background .15s ease, opacity .15s ease;
}
.advisor-x:hover { background: rgba(245, 237, 220, .16); opacity: 1; }

/* Mesaj lenti */
.advisor-log {
  flex: 1 1 auto; overflow-y: auto; padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background:
    radial-gradient(900px 500px at 50% 0%, #faf6ec 0%, #f7f1e4 60%);
  scroll-behavior: smooth;
}
.advisor-msg {
  max-width: 82%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word; animation: ek-up .2s ease both;
}
.advisor-msg.bot { align-self: flex-start; background: #fffdf7; border: 1px solid #e7dcc4; color: #2b2922; border-bottom-left-radius: 5px; }
.advisor-msg.user { align-self: flex-end; background: #2d5a3d; color: #f5eddc; border-bottom-right-radius: 5px; }
.advisor-time { display: block; font-size: 11px; opacity: .55; margin-top: 4px; }
.advisor-head .advisor-meta { flex: 1 1 auto; }
.advisor-x[hidden] { display: none; }
.advisor-head { justify-content: flex-start; }
.advisor-head .advisor-id { flex: 1 1 auto; }
.advisor-msg { white-space: normal; }
.advisor-msg.bot { max-width: 92%; }
.advisor-msg.err { border-color: #e2b4ab; background: #fdf4f1; }
.advisor-body strong { font-weight: 600; }
.advisor-cite { font-size: 10px; font-weight: 600; color: #2d5a3d; margin-left: 1px; }
.advisor-sources, .advisor-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
/* Mənbə çipi: uzun ad (məs. Plenum qərarı) bir neçə sətrə düşür → «hap» (999px) künclər sətirləri
   kəsib fondan kənara daşırırdı. Yumşaq dördbucaq + ən çox 2 sətir; tam ad title-da. */
.advisor-src {
  font-size: 12px; line-height: 1.35; padding: 4px 10px; border-radius: 10px; text-decoration: none;
  background: #eef3ea; color: #234a31; border: 1px solid #d3e0cc;
  max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; display: inline-block;
}
/* Kəsmə daxili elementdə: padding-li elementdə line-clamp 3-cü sətri alt boşluqda yarımçıq göstərirdi. */
.advisor-src-t {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.advisor-src:hover { background: #e2ecdc; }
.advisor-link, .advisor-copy, .advisor-login {
  font-family: inherit; font-weight: 600; font-size: 12.5px; line-height: 1.3; padding: 5px 10px; border-radius: 8px; cursor: pointer;
  text-decoration: none; background: transparent; color: #2d5a3d; border: 1px solid #d9cdb4; display: inline-block;
}
.advisor-link:hover, .advisor-copy:hover { background: #f2ead9; }
.advisor-copy { margin-top: 8px; font-weight: 500; font-size: 12px; color: #6b6352; }
.advisor-login { margin-top: 9px; background: #2d5a3d; color: #f5eddc; border-color: #2d5a3d; }
.advisor-login:hover { background: #234a31; }
.advisor-msg.err .advisor-link { margin-top: 8px; }
.advisor-note { margin-top: 8px; font-size: 11.5px; line-height: 1.4; color: #857b66; }
.advisor-card { margin-top: 8px; padding: 9px 11px; border: 1px solid #e7dcc4; border-radius: 10px; background: #fbf7ee; }
.advisor-card-name { font-weight: 600; font-size: 13.5px; }
.advisor-card-meta { font-size: 12px; color: #6b6352; margin-top: 2px; }
.advisor-card-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.advisor-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.advisor-chip {
  font: inherit; font-size: 13px; text-align: left; padding: 7px 12px; border-radius: 16px; cursor: pointer;
  max-width: 100%; overflow-wrap: anywhere;   /* admin uzun sual yaza bilər — iki sətirdə də fonda qalsın */
  background: #fffdf7; color: #234a31; border: 1px solid #cfdcc8; transition: background .15s ease;
}
.advisor-chip:hover { background: #eef3ea; }
.advisor-chips-inline { flex-direction: row; flex-wrap: wrap; margin-top: 8px; }

/* "yazır…" göstəricisi */
.advisor-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: #fffdf7; border: 1px solid #e7dcc4; border-radius: 14px; border-bottom-left-radius: 5px; }
.advisor-typing span { width: 7px; height: 7px; border-radius: 50%; background: #2d5a3d; opacity: .3; animation: adv-blink 1.2s infinite both; }
.advisor-typing span:nth-child(2) { animation-delay: .2s; }
.advisor-typing span:nth-child(3) { animation-delay: .4s; }

/* Giriş sahəsi */
.advisor-form {
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; border-top: 1px solid #e7dcc4; background: #f5eddc;
}
.advisor-text {
  flex: 1 1 auto; resize: none; border: 1px solid #d9cdb4; border-radius: 11px;
  padding: 10px 12px; font: inherit; font-size: 14px; line-height: 1.4; color: #26231c;
  background: #fffdf7; max-height: 120px; overflow-y: auto;
}
.advisor-text::placeholder { color: #9a9079; }
.advisor-text:focus-visible { outline: none; border-color: #2d5a3d; box-shadow: 0 0 0 2px rgba(45, 90, 61, .18); }
.advisor-send {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px; border: none; cursor: pointer;
  background: #2d5a3d; color: #f5eddc; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, opacity .15s ease, transform .1s ease;
}
.advisor-send:hover:not(:disabled) { background: #234a31; }
.advisor-send:active:not(:disabled) { transform: scale(.94); }
.advisor-send:disabled { opacity: .4; cursor: default; }

/* Mobil: açıq söhbət TAM EKRAN vərəqdir (üzən kart deyil) — arxadakı səhifə kənarlardan görünmür,
   FAB gizlənir (başlıqda ✕ var), hündürlük dvh (URL zolağı/klaviatura ilə dəyişir), çentik/ev zolağı
   üçün safe-area, mətn sahəsi 16px (iOS fokusda zoom etməsin), arxa səhifə skroll olmur. */
@keyframes adv-sheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 480px) {
  .advisor { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .advisor-fab { width: 48px; height: 48px; }
  /* Klaviatura açıq (sahə fokusda) olanda FAB yazılan mətnin/düymənin üstünü örtməsin */
  body:has(input:not([type=checkbox]):not([type=radio]):focus, textarea:focus, select:focus) .advisor:not([data-open="true"]) { display: none; }
  .advisor-fab-open { width: 34px; height: 34px; }

  .advisor[data-open="true"] { inset: 0; gap: 0; align-items: stretch; }
  .advisor[data-open="true"] .advisor-fab { display: none; }
  .advisor-panel {
    width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none;
    border: none; border-radius: 0; box-shadow: none; animation-name: adv-sheet;
  }
  html:has(.advisor[data-open="true"]), html:has(.advisor[data-open="true"]) body { overflow: hidden; }

  .advisor-head { padding: calc(10px + env(safe-area-inset-top, 0px)) 8px 10px 14px; gap: 4px; }
  .advisor-avatar { width: 34px; height: 34px; }
  .advisor-x { width: 40px; height: 40px; }
  .advisor-log { padding: 14px 12px; overscroll-behavior: contain; }
  .advisor-msg { max-width: 88%; }
  .advisor-msg.bot { max-width: 94%; }
  .advisor-chip { padding: 9px 14px; font-size: 14px; }
  .advisor-form { padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .advisor-text { font-size: 16px; padding: 9px 12px; }
  .advisor-send { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .advisor-panel, .advisor-msg { animation: none; }
  .advisor-typing span { animation-duration: 2.4s; }
}

/* ── Limit pop-up-ı və əlaqə düymələri (common.js). Bu fayl SPA və Xəbərçidə yüklənir. ── */
.ek-quota-overlay {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(32, 28, 20, .48);
}
.ek-quota {
  width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto; box-sizing: border-box;
  padding: 26px; background: #fbf8f1; color: #26231c; border-radius: 14px;
  font-family: "IBM Plex Sans", system-ui, sans-serif; box-shadow: 0 24px 60px -18px rgba(20, 30, 22, .55);
}
.ek-quota-title { margin: 0 0 10px; font-family: "IBM Plex Serif", Georgia, serif; font-size: 22px; font-weight: 600; color: #8f3f24; }
.ek-quota-text { margin: 0; font-size: 14.5px; line-height: 1.55; }
.ek-quota-plan { margin: 8px 0 0; font-size: 13px; color: #6b6455; }
.ek-quota-plan:empty { display: none; }
.ek-quota-hint { margin: 10px 0 0; font-size: 12.5px; color: #6b6455; }
.ek-quota-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 1px solid #e6ded0; }
.ek-quota-link { font-size: 14px; color: #2d5a3d; }
.ek-quota-close {
  min-height: 40px; padding: 8px 18px; font: inherit; font-size: 14px; color: #26231c; cursor: pointer;
  background: transparent; border: 1px solid #cfc6b4; border-radius: 9px;
}
.ek-quota-close:hover { background: #f0eadc; }
.ek-contact { display: flex; flex-wrap: wrap; gap: 8px; }
.ek-quota .ek-contact:not(:empty) { margin-top: 16px; }
.ek-contact-btn {
  flex: 1 1 110px; box-sizing: border-box; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 14px; font-size: 14px; font-weight: 600; text-decoration: none; border-radius: 9px;
  color: #fff; background: #2d5a3d;
}
.ek-contact-btn:hover { background: #24492f; }
.ek-contact-email { color: #2d5a3d; background: transparent; box-shadow: inset 0 0 0 1px #2d5a3d; }
.ek-contact-email:hover { background: #e9efe6; }
