/* ==========================================================================
   Chat interface - desktop split view + app-grade mobile layout
   Mobile is the primary target: single app bar, keyboard-aware input,
   safe-area insets, generous touch targets.
   ========================================================================== */

/* --app-height is kept in sync with window.visualViewport by chat.js so the
   layout tracks the on-screen keyboard on iOS/Android. Falls back to dvh. */
.chat-shell{
  height:calc(100dvh - var(--header-h));
  display:flex;
  overflow:hidden;
  background:var(--paper-50);
}

/* ---------- Sidebar (desktop) ---------- */
.chat-sidebar{
  width:var(--sidebar-w); flex-shrink:0; background:var(--paper-0);
  border-right:1px solid var(--line-200); display:flex; flex-direction:column; height:100%;
}
.chat-sidebar-header{ padding:0.5rem; border-bottom:1px solid var(--line-200); }
.chat-sidebar-list{ flex:1; overflow-y:auto; overscroll-behavior:contain; padding:0.5rem; }
.chat-sidebar-footer{ padding:0.75rem 1rem; border-top:1px solid var(--line-200); }
.chat-sidebar-nav{ display:none; }

.convo-group-label{
  font-size:0.72rem; text-transform:uppercase; letter-spacing:0.05em;
  color:var(--text-400); font-weight:700; padding:0.75rem 0.6rem 0.4rem;
}
.convo-item{
  display:flex; align-items:center; gap:0.6rem; padding:0.6rem 0.7rem; border-radius:var(--r-sm);
  color:var(--text-700); font-size:0.875rem; cursor:pointer; text-decoration:none;
  transition:background var(--dur) var(--ease), color var(--dur) var(--ease);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.convo-item > span{ overflow:hidden; text-overflow:ellipsis; }
.convo-item > i{ flex-shrink:0; color:var(--text-400); }
.convo-item:hover{ background:var(--paper-100); color:var(--ink-900); }
.convo-item.active{ background:var(--paper-100); color:var(--ink-900); font-weight:600; }
.convo-item-title{ flex:1 1 auto; overflow:hidden; text-overflow:ellipsis; }
.convo-item-actions{
  flex-shrink:0; display:flex; align-items:center; gap:0.1rem;
  opacity:0; transition:opacity var(--dur) var(--ease);
}
.convo-item:hover .convo-item-actions,
.convo-item.active .convo-item-actions,
.convo-item-actions:focus-within{ opacity:1; }
@media (hover:none){ .convo-item-actions{ opacity:1; } }
.convo-item-edit,
.convo-item-del{
  border:0; background:transparent; color:var(--text-400);
  padding:0.15rem 0.3rem; border-radius:var(--r-sm); line-height:1; font-size:0.85rem;
  transition:color var(--dur) var(--ease);
}
.convo-item-edit:hover,
.convo-item-del:hover{ color:var(--brand-500); }
.convo-item-rename{
  flex:1 1 auto; min-width:0; font:inherit; color:var(--ink-900);
  background:var(--paper-0); border:1px solid var(--brand-500);
  border-radius:var(--r-sm); padding:0.1rem 0.35rem;
}
.convo-item-rename:focus{ outline:2px solid var(--brand-100); outline-offset:0; }

/* ---------- Main chat column ---------- */
.chat-main{ flex:1; display:flex; flex-direction:column; min-width:0; height:100%; }

.chat-topbar{
  display:flex; align-items:center; gap:0.75rem;
  padding:0.85rem 1.25rem; border-bottom:1px solid var(--line-200);
  background:var(--paper-0); flex-shrink:0;
}
.chat-topbar-title{ flex:1; min-width:0; }
.chat-topbar-title h4{ font-size:1.125rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-topbar-title small{ display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-topbar-clear{ flex-shrink:0; }

/* Çelësi i gjuhës SQ / EN */
.chat-lang-switch{ display:inline-flex; flex-shrink:0; border:1px solid var(--line-300);
  border-radius:999px; overflow:hidden; background:var(--paper-0); }
.chat-lang-switch button{
  border:0; background:transparent; color:var(--text-500);
  font-size:0.75rem; font-weight:600; letter-spacing:0.02em;
  padding:0.3rem 0.6rem; cursor:pointer; line-height:1;
  transition:background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chat-lang-switch button + button{ border-left:1px solid var(--line-300); }
.chat-lang-switch button.active{ background:var(--brand-600); color:#fff; }
.chat-lang-switch button:not(.active):hover{ background:var(--brand-100); color:var(--brand-600); }

/* Mobile-only menu button in the app bar (matches btn-outline-brand sizing) */
.chat-topbar-menu{
  flex-shrink:0; width:38px; height:38px; border-radius:var(--r-sm);
  border:1px solid var(--line-300); background:var(--paper-0); color:var(--brand-600);
  display:none; align-items:center; justify-content:center; font-size:1.15rem;
  transition:background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chat-topbar-menu:hover{ background:var(--brand-100); border-color:var(--brand-400); }
.chat-topbar-menu:active{ background:var(--brand-100); }

.chat-status-dot{
  width:8px; height:8px; border-radius:50%; background:var(--success-600);
  display:inline-block; position:relative; vertical-align:middle;
}
@media (prefers-reduced-motion: no-preference){
  .chat-status-dot::after{
    content:""; position:absolute; inset:-3px; border-radius:50%;
    border:1px solid var(--success-600); opacity:0.6;
    animation:status-pulse 2.4s var(--ease-out) infinite;
  }
}
@keyframes status-pulse{ 0%{ transform:scale(0.7); opacity:0.7; } 70%,100%{ transform:scale(1.6); opacity:0; } }

.chat-scroll{
  flex:1; overflow-y:auto; overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch; padding:1.5rem 1.25rem 1rem;
  scroll-padding-bottom:2rem;
}
.chat-scroll-inner{ width:100%; margin:0; display:flex; flex-direction:column; gap:1.5rem; }

/* ---------- Messages ---------- */
.msg-row{ display:flex; gap:0.75rem; align-items:flex-start; }
.msg-row.msg-user{ flex-direction:row-reverse; }
@media (prefers-reduced-motion: no-preference){
  .msg-row{ animation:msg-in .38s var(--ease-out) both; }
}
@keyframes msg-in{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }

.msg-avatar{
  width:32px; height:32px; border-radius:var(--r-sm); flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:0.8rem; font-weight:700;
  letter-spacing:0.02em;
}
.msg-avatar.ai{ background:var(--brand-500); color:#fff; }
.msg-avatar.user{ background:var(--paper-100); color:var(--ink-800); }

.msg-bubble{ max-width:80%; min-width:0; }
.msg-row.msg-user > div:not(.msg-avatar){ display:flex; flex-direction:column; align-items:flex-end; min-width:0; }
.msg-user .msg-bubble{
  background:var(--brand-500); color:#fff; border-radius:var(--r-md) var(--r-md) var(--r-sm) var(--r-md);
  padding:0.3rem 0.5rem; overflow-wrap:anywhere;
}
.msg-ai .msg-bubble{ max-width:100%; }
.msg-ai .msg-bubble-content{
  background:var(--paper-0); border:1px solid var(--line-200);
  border-radius:var(--r-sm) var(--r-md) var(--r-md) var(--r-md);
  padding:0.3rem 0.5rem; box-shadow:var(--shadow-sm); overflow-wrap:anywhere;
}
.msg-ai .msg-bubble-content p{ font-size:0.95rem; line-height:1.6; }

.msg-meta{ font-size:0.7rem; color:var(--text-400); margin-top:0.35rem; }
.msg-user .msg-meta{ text-align:right; }

.msg-actions{ display:flex; gap:0.35rem; margin-top:0.6rem; }
.msg-action-btn{
  border:1px solid var(--line-200); background:var(--paper-0); color:var(--text-500);
  width:32px; height:32px; border-radius:var(--r-sm); display:inline-flex;
  align-items:center; justify-content:center; font-size:0.85rem;
  transition:color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.msg-action-btn:hover{ color:var(--ink-900); border-color:var(--line-300); background:var(--paper-100); }
.msg-action-btn.active-up{ color:var(--success-600); border-color:var(--success-600); }
.msg-action-btn.active-down{ color:var(--danger-600); border-color:var(--danger-600); }
.msg-action-btn.msg-action-comment.has-comment{
  color:var(--brand-500); border-color:var(--brand-500); background:var(--brand-100);
}

/* Feedback comment modal */
.fb-comment-dialog{ max-width:440px; }
#fbCommentModal .modal-content{ border:0; border-radius:var(--r-md, 14px); }
#fbCommentModal .modal-header{ border-bottom:1px solid var(--line-200); padding:1rem 1.15rem; }
#fbCommentModal .modal-title{ font-size:0.98rem; font-weight:600; color:var(--ink-900); }
#fbCommentModal .modal-title i{ color:var(--brand-500); }
#fbCommentModal .modal-body{ padding:1.15rem; }
#fbCommentModal .modal-footer{ border-top:1px solid var(--line-200); padding:0.85rem 1.15rem; }
#fbCommentModal textarea{ resize:vertical; min-height:88px; font-size:0.9rem; }
#fbCommentModal #fbCommentCount{ font-size:0.75rem; margin-top:0.3rem; }

/* "A të ndihmoi përgjigjja?" modal (pas pyetjes së 3-të) */
.helpful-dialog{ max-width:420px; }
#helpfulModal .modal-content{ border:0; border-radius:var(--r-md, 14px); }
#helpfulModal .modal-header{ border-bottom:1px solid var(--line-200); padding:1rem 1.15rem; }
#helpfulModal .modal-title{ font-size:0.98rem; font-weight:600; color:var(--ink-900); }
#helpfulModal .modal-title i{ color:var(--brand-500); }
#helpfulModal .modal-body{ padding:1.15rem; line-height:1.55; }
#helpfulModal .modal-footer{ border-top:1px solid var(--line-200); padding:0.85rem 1.15rem; }
.helpful-contact{
  display:flex; align-items:center; gap:0.6rem; padding:0.55rem 0.75rem;
  border:1px solid var(--line-200); border-radius:var(--r-sm, 10px);
  color:var(--ink-900); text-decoration:none; font-size:0.9rem; overflow-wrap:anywhere;
}
.helpful-contact:hover{ border-color:var(--brand-500); color:var(--brand-500); }
.helpful-contact i{ color:var(--brand-500); font-size:1.05rem; flex-shrink:0; }

/* Confirmation modal (replaces window.confirm) */
.confirm-dialog{ max-width:420px; }
#confirmModal .modal-content{ border:0; border-radius:var(--r-md, 14px); }
#confirmModal .modal-header{ border-bottom:1px solid var(--line-200); padding:1rem 1.15rem; }
#confirmModal .modal-title{ font-size:0.98rem; font-weight:600; color:var(--ink-900); }
#confirmModal .modal-title i{ color:var(--danger-600); font-size:1.05rem; }
#confirmModal .modal-body{ padding:1.15rem; }
#confirmModal .modal-body p{ color:var(--text-500); font-size:0.92rem; line-height:1.5; }
#confirmModal .modal-footer{ border-top:1px solid var(--line-200); padding:0.85rem 1.15rem; }

.msg-sources{ display:flex; flex-wrap:wrap; gap:0.5rem; margin-top:0.85rem; }
.msg-sources a.source-chip{ text-decoration:none; cursor:pointer; }

/* Typing indicator */
.typing-dots{ display:inline-flex; gap:4px; padding:0.25rem 0; }
.typing-dots span{ width:6px; height:6px; border-radius:50%; background:var(--text-400); animation:typing-bounce 1.1s infinite ease-in-out; }
.typing-dots span:nth-child(2){ animation-delay:0.15s; }
.typing-dots span:nth-child(3){ animation-delay:0.3s; }
@keyframes typing-bounce{ 0%,60%,100%{ transform:translateY(0); opacity:0.5; } 30%{ transform:translateY(-4px); opacity:1; } }

/* ---------- Input bar ---------- */
.chat-input-bar{
  border-top:1px solid var(--line-200); background:var(--paper-0);
  padding:0.9rem 1.25rem calc(1.1rem + env(safe-area-inset-bottom));
  flex-shrink:0;
}
.chat-input-inner{ max-width:760px; margin:0 auto; }

/* ---------- Pyetje të shpeshta (sidebar + sheet) & tab-et ---------- */
.side-tabs{
  display:flex; gap:0.25rem; padding:0.55rem 0.75rem; flex-shrink:0;
  border-bottom:1px solid var(--line-200); background:var(--paper-0);
}
.side-tab{
  flex:1 1 0; display:inline-flex; align-items:center; justify-content:center; gap:0.4rem;
  height:36px; border:0; border-radius:999px; background:transparent; color:var(--text-500);
  font-size:0.85rem; font-weight:600; cursor:pointer;
  transition:background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.side-tab:hover{ background:var(--paper-100); color:var(--ink-900); }
.side-tab.active{ background:var(--brand-100); color:var(--brand-700); }
.side-tab:focus-visible{ outline:2px solid var(--brand-500); outline-offset:2px; }
.side-pane{ display:flex; flex-direction:column; flex:1 1 auto; min-height:0; }

.faq-panel{ flex:1 1 auto; min-height:0; display:flex; flex-direction:column; }
.faq-cat-list,
.faq-q-list{ flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch; padding:0.5rem; display:flex; flex-direction:column; gap:0.2rem; }
.faq-cat-row{
  display:flex; align-items:center; gap:0.65rem; width:100%; padding:0.6rem 0.65rem;
  border:0; border-radius:var(--r-sm); background:transparent; color:var(--text-700);
  text-align:left; font-size:0.9rem; cursor:pointer;
  transition:background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.faq-cat-row:hover{ background:var(--paper-100); color:var(--ink-900); }
.faq-cat-ico{
  flex:0 0 auto; width:34px; height:34px; border-radius:10px; display:inline-flex;
  align-items:center; justify-content:center; background:var(--brand-100); color:var(--brand-600);
  font-size:1rem;
}
.faq-cat-name{ flex:1 1 auto; min-width:0; font-weight:600; line-height:1.3; overflow-wrap:anywhere; }
.faq-cat-count{ flex:0 0 auto; font-size:0.72rem; color:var(--text-400); font-variant-numeric:tabular-nums; }
.faq-cat-go{ flex:0 0 auto; color:var(--text-400); font-size:0.8rem; }
.faq-cat-row:hover .faq-cat-go{ color:var(--brand-500); }

.faq-panel-head{
  display:flex; align-items:center; gap:0.6rem; padding:0.55rem 0.75rem; flex-shrink:0;
  border-bottom:1px solid var(--line-200);
}
.faq-panel-title{ min-width:0; display:flex; align-items:center; gap:0.45rem; font-weight:600;
  font-size:0.92rem; color:var(--ink-900); overflow-wrap:anywhere; }
.faq-panel-title .bi{ color:var(--brand-600); flex:0 0 auto; }
.faq-back{
  flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; border:1px solid var(--line-200); background:var(--paper-0);
  color:var(--text-700); border-radius:999px; cursor:pointer;
  transition:border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.faq-back:hover{ border-color:var(--brand-500); color:var(--brand-600); }
.faq-q-row{
  display:flex; align-items:flex-start; justify-content:space-between; gap:0.6rem; width:100%;
  padding:0.65rem 0.75rem; border:1px solid var(--line-200); border-radius:var(--r-sm);
  background:var(--paper-0); color:var(--text-700); text-align:left; font-size:0.88rem;
  line-height:1.4; cursor:pointer;
  transition:border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.faq-q-row > i{ flex:0 0 auto; margin-top:0.1rem; color:var(--text-400); }
.faq-q-row:hover{ border-color:var(--brand-500); background:var(--brand-100); color:var(--ink-900); }
.faq-q-row:hover > i{ color:var(--brand-600); }

/* Tab-bar nën header (mobile + widget) */
.chat-tabbar{
  display:flex; flex-shrink:0; background:var(--paper-0); border-bottom:1px solid var(--line-200);
}
.tabbar-item{
  flex:1 1 0; min-width:0; height:46px; display:inline-flex; align-items:center; justify-content:center; gap:0.45rem;
  border:0; background:transparent; color:var(--text-700); font-size:0.86rem; font-weight:600; cursor:pointer;
  transition:background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tabbar-item + .tabbar-item{ border-left:1px solid var(--line-200); }
.tabbar-item .bi{ font-size:1.05rem; color:var(--brand-600); }
.tabbar-item span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tabbar-item:hover,
.tabbar-item:active{ background:var(--paper-100); }
.tabbar-item:focus-visible{ outline:2px solid var(--brand-500); outline-offset:-2px; }
.tabbar-new{ color:var(--brand-600); }
.chat-input-box{
  display:flex; align-items:flex-end; gap:0.6rem; border:1.5px solid var(--line-300);
  border-radius:var(--r-md); padding:0.5rem 0.5rem 0.5rem 1rem; background:var(--paper-0);
  transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.chat-input-box:focus-within{ border-color:var(--brand-500); box-shadow:0 0 0 3px rgba(177,0,93,0.12); }
.chat-input-box textarea{
  border:none; outline:none; resize:none; flex:1; min-width:0; max-height:160px;
  font-size:1rem; line-height:1.5; font-family:var(--font-sans);
  background:transparent; padding:0.4rem 0;
}
.chat-send-btn{
  width:40px; height:40px; border-radius:var(--r-sm); background:var(--brand-500); color:#fff;
  border:none; display:flex; align-items:center; justify-content:center; flex-shrink:0;
  font-size:1rem;
  transition:background var(--dur) var(--ease), transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease);
}
.chat-send-btn:hover:not(:disabled){ background:var(--brand-600); transform:translateY(-1px); box-shadow:var(--shadow-brand); }
.chat-send-btn:active:not(:disabled){ transform:translateY(0); }
.chat-send-btn:disabled{ background:var(--line-300); cursor:not-allowed; }

/* Numëratori i karaktereve + njoftimi kur pyetja e kalon kufirin (MAX_CHARS te chat.js) */
.chat-input-hint{ display:none; align-items:flex-start; gap:0.75rem; margin-top:0.4rem; }
.chat-input-hint.has-content{ display:flex; }
.chat-input-warn{
  flex:1 1 auto; min-width:0; font-size:0.78rem; font-weight:500;
  color:var(--danger-600); line-height:1.35;
}
.chat-char-count{
  margin-left:auto; flex-shrink:0; font-size:0.75rem; color:var(--text-400);
  font-variant-numeric:tabular-nums; white-space:nowrap; padding-top:0.05rem;
}
.chat-char-count.is-near{ color:var(--text-500); }
.chat-char-count.is-over{ color:var(--danger-600); font-weight:600; }
.chat-input-box.is-over{ border-color:var(--danger-600); }
.chat-input-box.is-over:focus-within{ border-color:var(--danger-600); box-shadow:0 0 0 3px var(--danger-100); }

.chat-disclaimer{ text-align:center; font-size:0.75rem; color:var(--text-400); margin-top:0.6rem; }

/* Sheet mobile/widget: pyetje + biseda në një bottom sheet */
#chatSidebarOffcanvas.chat-sheet{
  height:min(calc(var(--app-height, 100dvh) * 0.82), 640px); max-width:640px; margin:0 auto;
  border:0; border-radius:18px 18px 0 0; box-shadow:0 -10px 40px rgba(26,10,20,0.22);
  background:var(--paper-0);
}
.chat-sheet-grip{ flex:0 0 auto; width:38px; height:4px; border-radius:4px; background:var(--line-300); margin:8px auto 0; }
.chat-sheet .offcanvas-header{ padding:0.5rem 1rem 0.5rem; }
#chatSidebarOffcanvas .offcanvas-body{ padding:0; display:flex; flex-direction:column; min-height:0; overflow:hidden; }
#chatSidebarOffcanvas .chat-sidebar-list{ padding:0.5rem; }

/* ==========================================================================
   Tablet / small desktop
   ========================================================================== */
@media (max-width:991.98px){
  /* On the chat route the global site header is replaced by the in-app bar. */
  .chat-page .site-header{ display:none; }
  .chat-page{ overflow:hidden; }

  .chat-shell{ height:var(--app-height, 100dvh); }

  .chat-topbar{ padding:calc(0.7rem + env(safe-area-inset-top)) 0.9rem 0.7rem; }
  .chat-topbar-menu{ display:inline-flex; }
  .chat-topbar-clear{ display:none; }   /* "Bisedë e re" jeton te tab-bar */

  .chat-sidebar-nav{
    display:flex; flex-direction:column; gap:0.15rem;
    padding:0.6rem 0.5rem calc(0.6rem + env(safe-area-inset-bottom));
    border-top:1px solid var(--line-200);
  }

  .chat-scroll{ padding:1rem 0.85rem 0.75rem; }
  .chat-scroll-inner{ gap:1.15rem; }
  .msg-bubble{ max-width:88%; }

  .chat-input-bar{ padding:0.7rem 0.85rem calc(0.8rem + env(safe-area-inset-bottom)); }
  .chat-disclaimer{ font-size:0.7rem; margin-top:0.5rem; }

}

/* ==========================================================================
   Phone
   ========================================================================== */
@media (max-width:575.98px){
  .chat-topbar{ gap:0.5rem; }
  .chat-topbar-title h4{ font-size:1rem; }
  .chat-lang-switch button{ padding:0.3rem 0.5rem; font-size:0.7rem; }
  .msg-row{ gap:0.55rem; }
  .msg-avatar{ width:28px; height:28px; font-size:0.72rem; }
  .msg-bubble{ max-width:calc(100% - 34px); }
  .msg-ai .msg-bubble-content{ padding:0.3rem 0.5rem; }
  .msg-user .msg-bubble{ padding:0.3rem 0.5rem; }
  .msg-action-btn{ width:34px; height:34px; }
  .chat-send-btn{ width:44px; height:44px; }
}

/* ==========================================================================
   Landscape phone - reclaim vertical space
   ========================================================================== */
@media (max-height:480px) and (max-width:991.98px){
  .chat-topbar-title small{ display:none; }
  .chat-scroll{ padding-top:0.6rem; }
  .chat-disclaimer{ display:none; }
}

/* ==========================================================================
   Desktop (/chat.html, jo widget): kartë e qendërzuar, jo fullscreen
   ========================================================================== */
@media (min-width:992px){
  html:not(.embed) .chat-page{
    overflow:hidden;
    background:
      radial-gradient(900px 420px at 12% -10%, rgba(177,0,93,0.07), transparent 60%),
      radial-gradient(800px 380px at 100% 0%, rgba(177,0,93,0.05), transparent 55%),
      var(--paper-100);
  }
  html:not(.embed) .chat-shell{
    width:min(1180px, calc(100% - 3rem));
    height:min(820px, calc(100dvh - var(--header-h) - 2.5rem));
    margin:1.25rem auto;
    border:1px solid var(--line-200);
    border-radius:20px;
    background:var(--paper-0);
    box-shadow:0 18px 50px rgba(26,10,20,0.10), 0 2px 8px rgba(26,10,20,0.05);
  }
  html:not(.embed) .chat-sidebar{ background:var(--paper-50); }
  html:not(.embed) .chat-sidebar .side-tabs{ background:transparent; }
  html:not(.embed) .chat-sidebar .chat-sidebar-header{ border-bottom:0; padding:0.75rem 1rem 0.5rem; }
  html:not(.embed) .chat-main{ background:var(--paper-50); }
  html:not(.embed) .chat-topbar{ padding:0.9rem 1.5rem; }
  html:not(.embed) .chat-scroll{ padding:1.5rem 1.75rem 1rem; }
  html:not(.embed) .chat-input-bar{ padding:0.9rem 1.75rem 1rem; }
  html:not(.embed) .chat-input-inner{ max-width:none; }
}

/* ==========================================================================
   Widget - /embed/chat.html brenda iframe-it të widget.js në website-e të tjera.
   Pa header/navigim të faqes kryesore; lartësia = iframe-i i plotë.
   ========================================================================== */
.embed .site-header,
.embed #navDrawer,
.embed .chat-sidebar-nav{ display:none !important; }
.embed .chat-page{ overflow:hidden; background:var(--paper-0); }
.embed .chat-shell{ height:var(--app-height, 100dvh); background:var(--paper-50); }
.chat-embed-avatar{ display:none; }
.chat-embed-close{
  flex-shrink:0; display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; border:0; border-radius:999px;
  background:transparent; color:var(--text-500, #6b6070); font-size:1rem;
  transition:background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chat-embed-close[hidden]{ display:none; }
.chat-embed-close:hover{ background:var(--paper-100); color:var(--ink-900); }
.chat-embed-close:focus-visible{ outline:2px solid var(--brand-500); outline-offset:2px; }

/* Header-i me ngjyrën e markës: avatar · titull · [SQ/EN] [historiku] [bisedë e re] [mbyll] */
.embed .chat-topbar{
  gap:0.5rem; padding:0.8rem 0.6rem 0.8rem 0.9rem; border-bottom:0;
  background:linear-gradient(135deg, var(--brand-700) 0%, var(--brand-500) 100%); color:#fff;
  box-shadow:0 4px 14px rgba(122,0,65,0.18); position:relative; z-index:2;
}
.embed .chat-embed-avatar{
  order:1; position:relative; flex-shrink:0; display:inline-flex;
  width:40px; height:40px; border-radius:50%;
  /* unazë e bardhë e hollë - e ndan vulën bordo nga gradienti bordo i header-it */
  box-shadow:0 0 0 2px #fff, 0 2px 8px rgba(0,0,0,0.25);
}
.embed .chat-embed-avatar img{ display:block; width:100%; height:100%; border-radius:50%; }
/* pika "online" mbi avatar në vend të rreshtit me pikë */
.embed .chat-embed-avatar::after{
  content:""; position:absolute; right:-1px; bottom:-1px; width:11px; height:11px; border-radius:50%;
  background:#3ddc84; border:2px solid var(--brand-600);
}
.embed .chat-topbar-title{ order:2; }
.embed .chat-topbar-title h4{ color:#fff; font-family:var(--font-sans); font-size:0.98rem; font-weight:600; letter-spacing:0; }
.embed .chat-topbar-title small{ color:rgba(255,255,255,0.82) !important; font-size:0.72rem; margin-top:0.05rem; }
.embed .chat-topbar-title .chat-status-dot{ display:none; }
.embed .chat-lang-switch{ order:3; background:rgba(255,255,255,0.12); border-color:rgba(255,255,255,0.3); }
.embed .chat-lang-switch button{ color:rgba(255,255,255,0.85); padding:0.28rem 0.45rem; font-size:0.66rem; }
.embed .chat-lang-switch button + button{ border-left-color:rgba(255,255,255,0.3); }
.embed .chat-lang-switch button.active{ background:#fff; color:var(--brand-600); }
.embed .chat-lang-switch button:not(.active):hover{ background:rgba(255,255,255,0.18); color:#fff; }
.embed .chat-topbar-menu{ order:4; }
.embed .chat-topbar-clear{ order:5; }
.embed .chat-embed-close{ order:6; }
.embed .chat-topbar-menu,
.embed .chat-topbar-clear{ display:none !important; }   /* zëvendësohen nga .chat-tabbar */
.embed .chat-embed-close{
  width:34px; height:34px; padding:0; border:0; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  background:transparent; color:#fff; font-size:1.05rem; box-shadow:none;
}
.embed .chat-embed-close[hidden]{ display:none; }
.embed .chat-topbar-clear > span{ display:none !important; }
.embed .chat-embed-close:hover{ background:rgba(255,255,255,0.16); color:#fff; border-color:transparent; }
.embed .chat-embed-close:focus-visible{ outline:2px solid #fff; outline-offset:1px; }

.embed #chatSidebarOffcanvas.chat-sheet{ max-width:none; }
.embed .chat-tabbar{ box-shadow:0 1px 0 var(--line-200); }

/* Mesazhet - më kompakte, flluska të rrumbullakosura si në aplikacionet e mesazheve */
.embed .chat-scroll{ padding:1rem 0.85rem 0.75rem; }
.embed .chat-scroll-inner{ gap:1rem; }
.embed .msg-row{ gap:0.5rem; }
.embed .msg-avatar.user{ display:none; }
.embed .msg-avatar.ai{
  width:28px; height:28px; border-radius:50%; font-size:0.62rem; margin-top:2px;
  background:linear-gradient(135deg, var(--brand-600), var(--brand-400));
}
.embed .msg-bubble{ max-width:86%; }
.embed .msg-ai .msg-bubble{ max-width:calc(100% - 36px); }
.embed .msg-user .msg-bubble{
  background:linear-gradient(135deg, var(--brand-600), var(--brand-500));
  border-radius:16px 16px 4px 16px; padding:0.55rem 0.85rem;
  font-size:0.9rem; line-height:1.5; box-shadow:0 2px 8px rgba(177,0,93,0.18);
}
.embed .msg-ai .msg-bubble-content{
  border-radius:4px 16px 16px 16px; padding:0.65rem 0.85rem;
  border-color:var(--line-200); box-shadow:0 1px 3px rgba(22,16,22,0.06);
}
.embed .md,
.embed .msg-ai .msg-bubble-content p{ font-size:0.9rem; line-height:1.55; }
.embed .msg-meta{ font-size:0.66rem; margin-top:0.25rem; }
.embed .msg-actions{ gap:0.15rem; margin-top:0.3rem; }
.embed .msg-action-btn{
  width:28px; height:28px; border:0; border-radius:999px; background:transparent; font-size:0.8rem;
}
.embed .msg-action-btn:hover{ background:var(--paper-100); }
.embed .msg-action-btn.active-up{ background:var(--success-100); }
.embed .msg-action-btn.active-down{ background:var(--danger-100); }
.embed .msg-action-btn.msg-action-comment.has-comment{ border:0; }

/* Burimet: një rresht secili, i shkurtuar - në telefon nuk mbulojnë më gjithë ekranin */
.embed .msg-sources{
  flex-direction:column; flex-wrap:nowrap; gap:0.3rem;
  margin-top:0.65rem; padding-top:0.6rem; border-top:1px solid var(--line-200);
}
.embed .source-chip{
  display:flex; max-width:100%; min-width:0; gap:0.45rem; padding:0.35rem 0.55rem;
  border-radius:8px; background:var(--paper-50); border-color:transparent;
  font-size:0.75rem; line-height:1.3; color:var(--text-700);
}
.embed a.source-chip:hover{ background:var(--brand-100); border-color:transparent; color:var(--brand-700); transform:none; }
.embed .source-chip .num{ width:16px; height:16px; font-size:0.6rem; background:var(--brand-600); }
.embed .source-label{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Zona e shkrimit */
.embed .chat-input-bar{ padding:0.6rem 0.75rem 0.55rem; border-top-color:var(--line-200); }
.embed .chat-input-box{
  border:1px solid var(--line-300); border-radius:14px; padding:0.3rem 0.3rem 0.3rem 0.85rem;
  background:var(--paper-50); align-items:flex-end;
}
.embed .chat-input-box:focus-within{ background:var(--paper-0); }
.embed .chat-input-box textarea{ font-size:16px; line-height:1.45; padding:0.45rem 0; } /* 16px: iOS s'bën zoom */
.embed .chat-send-btn{ width:38px; height:38px; border-radius:11px; font-size:0.95rem; }
.embed .chat-disclaimer{ font-size:0.64rem; margin-top:0.4rem; line-height:1.35; }

/* Iframe shumë i ngushtë (p.sh. 320px): SQ/EN del nga header-i, mbetet te gjuha e website-it */
@media (max-width:359.98px){
  .embed .chat-lang-switch{ display:none !important; }
}

/* Widget i gjerë (desktop): sidebar majtas me Pyetje / Bisedat / E re, pa tab-bar */
@media (min-width:700px){
  .embed .chat-sidebar{ display:flex !important; width:auto; }
  .embed .chat-tabbar{ display:none !important; }
  /* Header-i i vetëm, në gjerësi të plotë mbi sidebar + chat */
  .embed .chat-shell{ display:grid; grid-template-columns:250px minmax(0,1fr); grid-template-rows:auto minmax(0,1fr) auto; }
  .embed .chat-main{ display:contents; }
  .embed .chat-topbar{ grid-column:1 / -1; grid-row:1; }
  .embed .chat-sidebar{ grid-column:1; grid-row:2 / 4; min-height:0; }
  .embed .chat-scroll{ grid-column:2; grid-row:2; min-height:0; }
  .embed .chat-input-bar{ grid-column:2; grid-row:3; }
}
