/* דף ההיסטוריה */
/* ===== דף "היסטוריה" ===== */
/* מכסה את אזור הצ'אט (מימין לתפריט הצד), באותו רקע. תפריט הצד נשאר מעליו */
.history-page {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 25;
  background: var(--bg);
}
.history-page[hidden] {
  display: none;
}
/* הלשוניות בדף ההיסטוריה ("נכסים", "מושגים", "חדשות"): בפינה הימנית העליונה של container היסטוריה.
   בין הרקעים של שתי לשוניות יש 15 פיקסלים (הרקע בולט 10 מכל צד, ולכן 35 בין המילים) */
/* הלשוניות בדף ההיסטוריה: מימין המתג "פקודות / חישובים", ומשמאלו הלשוניות של מה שנבחר
   ("נכסים", "מחירים", "חדשות", "מושגים" או "משכנתא"). בין הרקעים של שתי לשוניות 15 פיקסלים
   (הרקע בולט 10 מכל צד, ולכן 35 בין המילים). השורה מורמת 8 פיקסלים, כדי שהלשוניות יישארו
   באותו גובה כמו קודם (המתג גבוה מהן) */
.history-tabs {
  position: absolute;
  top: -8px;
  right: 0;
  display: flex;
  align-items: center;
  gap: 35px;
}
.history-tab[hidden] {
  display: none;
}
/* המתג: רקע #EEEEEE עם פינות 10, ובתוכו שני כפתורים. הנבחר: רקע לבן וטקסט שחור, השני #9A9A9A */
.history-seg {
  display: flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--sidebar-bg);
}
.history-seg-btn {
  margin: 0;
  padding: 6px 16px;
  border: none;
  border-radius: 8px;
  background: none;
  font-family: inherit;
  font-size: calc(16px * var(--a11y-text, 1));
  font-weight: 400;
  line-height: 1;
  color: var(--placeholder);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.history-seg-btn[aria-current="page"] {
  background: var(--box-bg);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: default;
}
@media (hover: hover) {
  :where(html:not(.phone-ui)) .history-seg-btn:not([aria-current="page"]):hover{
    color: var(--text);
  }
}
.history-seg-btn:focus-visible {
  outline: 2px solid var(--send-active);
  outline-offset: 2px;
}
/* container היסטוריה: לא נראה לעין, רק קובע את הרוחב והמיקום של התוכן בדף ההיסטוריה.
   ממורכז בדף, 75 מלמעלה ו-75 מלמטה. הרוחב 1060 (הרוחב שיצא בין "נכסים" לחיפוש
   במסך ברוחב 1920 כשתפריט הצד סגור). במסך צר יותר הוא מתכווץ ומשאיר לפחות 75 מכל צד.
   כל מה שנמצא בו ממוקם ביחס אליו */
.history-container {
  position: absolute;
  top: 75px;
  /* הרשימה מגיעה עד תחתית המסך: החיפושים יורדים עד הסוף */
  bottom: 0;
  left: 0;
  right: 0;
  width: min(1060px, calc(100% - 150px));
  margin: 0 auto;
}
/* חיפוש בדף ההיסטוריה: סמל זכוכית מגדלת בפינה השמאלית העליונה של container היסטוריה.
   בלחיצה נפתח container חיפוש ברוחב 220, שגדל ימינה: הצד השמאלי שלו לא זז, וגם הסמל לא זז.
   ה-container של החיפוש בגובה 40, והסמל בתוכו 12 פיקסלים משמאל ו-12 מלמעלה,
   ולכן הוא מתחיל 12 פיקסלים לפני הפינה של container היסטוריה, והסמל נמצא בדיוק בפינה */
.history-search {
  position: absolute;
  top: -12px;
  left: -12px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: width 150ms ease, background-color 150ms ease, border-color 150ms ease;
}
/* פתוח: בלי מילוי, רק מסגרת */
.history-search.is-open {
  width: 220px;
  border-color: var(--box-stroke);
}
@media (prefers-reduced-motion: reduce) {
  .history-search {
    transition: none;
  }
}
.history-search-button {
  position: absolute;
  top: 11px;
  left: 11px;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--placeholder);
  cursor: pointer;
  isolation: isolate;
  z-index: 1;
}
/* hover: רקע רק מאחורי הסמל (כמו בכפתורי תפריט הצד: 6 מסביב, פינות 5, var(--c-DDDDDD)), והסמל שחור */
.history-search-button::before {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: -1;
  background: var(--box-stroke);
  border-radius: 5px;
  opacity: 0;
}
@media (hover: hover) {
  :where(html:not(.phone-ui)) .history-search-button:hover{
    color: var(--text);
  }
  :where(html:not(.phone-ui)) .history-search-button:hover::before{
    opacity: 1;
  }
  /* כשהחיפוש פתוח, :where(html:not(.phone-ui)) אין רקע ב-hover על הסמל */
  .history-search.is-open .history-search-button:hover::before{
    opacity: 0;
  }
}
.history-search-button svg {
  display: block;
  width: 15px;
  height: 15px;
}
.history-search-button:focus-visible {
  outline: 2px solid var(--send-active);
  outline-offset: 4px;
}
/* שדה ההקלדה: רק כשה-container פתוח. הטקסט מימין, ונעצר 10 פיקסלים לפני הסמל */
.history-search-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 15px 0 36px;
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: calc(16px * var(--a11y-text, 1));
  font-weight: 500;
  color: var(--text);
  text-align: right;
  opacity: 0;
  pointer-events: none;
}
.history-search.is-open .history-search-input {
  opacity: 1;
  pointer-events: auto;
}
.history-search-input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}
/* פס הפרדה לרוחב container היסטוריה, 15 פיקסלים מתחת ל-container החיפוש
   (החיפוש נגמר 28 פיקסלים מתחת לראש ה-container: 40 - 12) */
.history-divider {
  position: absolute;
  top: 43px;
  left: 0;
  right: 0;
  height: 1px;
  margin: 0;
  border: none;
  background: var(--box-stroke);
}
/* רשימת החיפושים: מתחת לפס ועד תחתית ה-container, נגללת.
   היא בולטת 60 פיקסלים שמאלה, כדי שהלוגו של הסוכן (שנמצא משמאל לתשובה) לא ייחתך.
   בתחתית אין fade: הרשימה נחתכת בקו התחתון שלה. בסוף הגלילה החיפוש האחרון 30 פיקסלים מעל הקו */
.history-list {
  position: absolute;
  top: 44px;
  bottom: 0;
  left: -60px;
  right: 0;
  padding: 0 0 30px 60px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.history-list::-webkit-scrollbar {
  display: none;
}
/* פס גלילה של ההיסטוריה: כמו בצ'אט, בצד ימין של הדף ולכל גובהו, ברוחב 8, בלי רקע,
   והחלק הנגרר #C1C1C1 עם פינות 4. הוא מראה איפה נמצאים ברשימת החיפושים ומזיז אותה */
.history-scrollbar {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 8px;
  z-index: 2;
}
.history-scrollbar[hidden] {
  display: none;
}
.history-scrollbar-thumb {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: var(--c-C1C1C1);
  border-radius: 4px;
  touch-action: none;
}
.history-page.is-dragging-scrollbar {
  user-select: none;
}
/* חיפוש אחד: תאריך ושעה במרכז, ומתחתם הפקודה והתשובה.
   הפקודה והתשובה באותו רוחב ומיקום כמו בצ'אט (ממורכזים בדף, עד 600), ולא בקצוות ה-container */
.history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* 50 בין הפקודה לתשובה, כמו בצ'אט */
  gap: 50px;
  width: min(600px, calc(100vw - var(--sidebar-width) - 32px));
  max-width: 100%;
  margin: 30px auto 0;
}
/* תאריך ושעה: 14, Regular, #9A9A9A, במרכז. 30 מעליהם (מהפס או מהחיפוש הקודם) ו-30 מתחתם עד הפקודה */
.history-date {
  align-self: stretch;
  /* המרווח בין הפריטים הוא 50, ולכן כאן 20- כדי שבין התאריך לפקודה יישארו 30 */
  margin: 0 0 -20px;
  color: var(--placeholder);
  font-size: calc(14px * var(--a11y-text, 1));
  font-weight: 400;
  line-height: 1;
  text-align: center;
}
.history-item .agent-answer {
  align-self: flex-end;
}
/* בצ'אט שנפתח מהרשימה "צ'אטים": 30 מעל התאריך (מהתשובה הקודמת) ו-30 מתחתיו עד הפקודה, כמו בהיסטוריה */
.thread .history-date {
  margin-top: -20px;
}
.thread .history-date:first-child {
  margin-top: 0;
}
/* חיפוש בהיסטוריה: המילה שחיפשו מסומנת בפקודה ובתשובה בכחול (#1E6DF6) וב-SemiBold, בלי רקע */
.history-match {
  background: none;
  color: var(--selected);
  font-weight: 600;
}
/* כשאין חיפושים בקטגוריה: באותו מקום כמו התאריך של חיפוש (30 פיקסלים מתחת לקו), באותו גודל וצבע */
.history-empty {
  margin: 30px 0 0;
  color: var(--placeholder);
  font-size: calc(14px * var(--a11y-text, 1));
  font-weight: 400;
  line-height: 1;
  text-align: center;
}
/* לשונית: 16, Regular, #9A9A9A. הלשונית הפעילה: שחור עם רקע */
.history-tab {
  position: relative;
  isolation: isolate;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: calc(16px * var(--a11y-text, 1));
  font-weight: 400;
  line-height: 1;
  color: var(--placeholder);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
/* הרקע: גובה 27, #DDDDDD, 10 פיקסלים מכל צד של המילה, עם חצי עיגול בשני הצדדים */
/* הלשונית הנבחרת: טקסט שחור, ופס שחור בעובי 2 שיושב על קו ההפרדה שמתחת ללשוניות
   ובולט 4 פיקסלים מכל צד של המילה (במקום רקע) */
.history-tab[aria-current="page"] {
  color: var(--text);
}
.history-tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  top: calc(100% + 25px);
  height: 2px;
  background: var(--text);
}
/* לשונית שלא נבחרה: ב-hover הטקסט מתכהה, בלי פס */
@media (hover: hover) {
  :where(html:not(.phone-ui)) .history-tab:not([aria-current="page"]):hover{
    color: var(--text);
  }
}
.history-tab:focus-visible {
  outline: 2px solid var(--send-active);
  outline-offset: 8px;
}
