/* תפריט הנגישות והגדרות הנגישות */
/* ===== נגישות =====
   כפתור עגול כחול (#1E6DF6) עם סמל של דמות, צף בראש המסך ונשאר במקום גם בגלילה.
   משתמש מחובר: בפינה הימנית העליונה, 25 מימין ו-25 מלמעלה, 40 על 40.
   לא מחובר (אורח, דף ההתחברות): בפינה השמאלית העליונה, בשורה של "התחברות".
   לחיצה פותחת את תפריט הנגישות: במחשב חלון קטן מתחת לכפתור, בטלפון חלון שעולה מלמטה */
.a11y-btn {
  position: fixed;
  top: calc(25px + env(safe-area-inset-top, 0px));
  right: 25px;
  /* מעל דף ההיסטוריה (50), מתחת להגדרות (200) ולחלונות (400) */
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #1E6DF6;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.a11y-btn svg {
  display: block;
  width: 24px;
  height: 24px;
}
@media (hover: hover) {
  :where(html:not(.phone-ui)) .a11y-btn:hover {
    background: #1A5FD8;
  }
}
.a11y-btn:focus-visible {
  outline: 2px solid #1E6DF6;
  outline-offset: 3px;
}
:root.guest .a11y-btn,
.login-screen:not([hidden]) ~ .a11y-btn {
  right: auto;
  left: 25px;
}
/* בדף ההתחברות (100) הכפתור מעליו */
.login-screen:not([hidden]) ~ .a11y-btn {
  z-index: 101;
}
/* החלון: שכבה שקופה על כל המסך (לחיצה מחוץ לחלון סוגרת), והחלון עצמו ממוקם מתחת לכפתור */
.a11y-overlay {
  position: fixed;
  inset: 0;
  z-index: 410;
  visibility: hidden;
}
.a11y-overlay.is-open {
  visibility: visible;
}
.a11y-box {
  position: absolute;
  width: 300px;
  max-height: calc(100% - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid var(--box-stroke);
  border-radius: 15px;
  background: var(--box-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  color: var(--text);
  text-align: right;
}
.a11y-box:focus {
  outline: none;
}
.a11y-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.a11y-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.a11y-close {
  position: relative;
  display: block;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--placeholder);
  cursor: pointer;
}
/* אזור לחיצה גדול יותר מהסמל */
.a11y-close::before {
  content: "";
  position: absolute;
  inset: -10px;
}
.a11y-close svg {
  display: block;
  width: 15px;
  height: 15px;
}
@media (hover: hover) {
  :where(html:not(.phone-ui)) .a11y-close:hover {
    color: var(--text);
  }
}
.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.a11y-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 12px 6px 10px;
  border: 1px solid var(--box-stroke);
  border-radius: 10px;
  background: none;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.a11y-opt > svg:not(.a11y-check) {
  display: block;
  width: 20px;
  height: 20px;
  color: var(--selected);
}
/* אפשרות פעילה: רקע ומסגרת כחולים, וגם סימן ✓ בפינה (לא רק צבע) */
.a11y-opt[aria-pressed="true"] {
  border-color: var(--selected);
  background: var(--c-EEF4FF);
}
.a11y-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 14px;
  height: 14px;
  color: var(--selected);
  display: none;
}
.a11y-opt[aria-pressed="true"] .a11y-check {
  display: block;
}
.a11y-size {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
}
.a11y-size-opts {
  display: flex;
  gap: 6px;
}
.a11y-size-opt {
  min-width: 44px;
  height: 32px;
  margin: 0;
  padding: 0 6px;
  border: 1px solid var(--box-stroke);
  border-radius: 8px;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.a11y-size-opt[aria-pressed="true"] {
  border-color: var(--selected);
  background: var(--c-EEF4FF);
  font-weight: 600;
}
@media (hover: hover) {
  :where(html:not(.phone-ui)) .a11y-opt:hover,
  :where(html:not(.phone-ui)) .a11y-size-opt:hover {
    border-color: var(--selected);
  }
}
.a11y-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--box-stroke);
  font-size: 13px;
}
.a11y-link {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--selected);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.a11y-close:focus-visible,
.a11y-opt:focus-visible,
.a11y-size-opt:focus-visible,
.a11y-link:focus-visible {
  outline: 2px solid var(--send-active);
  outline-offset: 2px;
}
/* טלפון: הכפתור 36 על 36, 8 מלמעלה ו-16 מהצד (בקו אחד עם הצ'אט). אורח: בשורה של "התחברות" (15 מלמעלה, 40 גובה).
   מתחת לרקע המוחשך של התפריט (28), כך שכשהתפריט פתוח הכפתור מוחשך ולא לחיץ.
   החלון עולה מלמטה כמו "דיווח על תקלה": פס גרירה, גרירה למטה או לחיצה מחוץ לחלון סוגרות */
@media (max-width: 767px) {
  .a11y-btn {
    top: calc(8px + env(safe-area-inset-top, 0px));
    right: 16px;
    z-index: 27;
    width: 36px;
    height: 36px;
  }
  .a11y-btn svg {
    width: 22px;
    height: 22px;
  }
  :root.guest .a11y-btn,
  .login-screen:not([hidden]) ~ .a11y-btn {
    top: calc(17px + env(safe-area-inset-top, 0px));
    left: 16px;
  }
  .a11y-overlay {
    background: rgba(0, 0, 0, 0);
    transition: background-color 280ms ease, visibility 0s linear 280ms;
  }
  .a11y-overlay.is-open {
    background: rgba(0, 0, 0, 0.25);
    transition: background-color 280ms ease, visibility 0s;
  }
  .a11y-box {
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0;
    width: auto;
    max-height: calc(100% - 80px);
    padding: 0 16px calc(28px + env(safe-area-inset-bottom, 0px));
    border-radius: 15px 15px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .a11y-overlay.is-open .a11y-box {
    transform: none;
  }
  .a11y-box::before {
    content: "";
    display: block;
    width: 36px;
    height: 5px;
    margin: 8px auto 17px;
    border-radius: 3px;
    background: var(--box-stroke);
  }
  .a11y-opt {
    padding: 14px 6px 12px;
    font-size: 14px;
  }
}
/* --- ניגודיות גבוהה: טקסט משני, מסגרות וסמלים כהים יותר (בבהיר) ובהירים יותר (בכהה) --- */
:root.a11y-contrast:not([data-theme="dark"]) {
  --placeholder: #595959;
  --box-stroke: #767676;
  --menu-stroke: #767676;
  --highlight: #0B4FCC;
  --selected: #0B4FCC;
  --c-9A9A9A: #595959;
  --c-707070: #4A4A4A;
  --c-6B6B6B: #404040;
  --c-B5B5B5: #767676;
  --c-C1C1C1: #767676;
  --c-C8C8C8: #767676;
  --c-C9C9C9: #767676;
  --c-CFCFCF: #767676;
  --c-DDDDDD: #767676;
}
:root.a11y-contrast[data-theme="dark"] {
  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --on-inverse: #000000;
  --send-arrow-idle: #000000;
  --text: #FFFFFF;
  --placeholder: #BDBDBD;
  --box-stroke: #8C8C8C;
  --menu-stroke: #8C8C8C;
  --highlight: #8DB4FF;
  --selected: #8DB4FF;
  --c-000000: #FFFFFF;
  --c-404040: #E0E0E0;
  --c-6B6B6B: #D0D0D0;
  --c-707070: #CFCFCF;
  --c-9A9A9A: #BDBDBD;
  --c-B5B5B5: #8C8C8C;
  --c-C1C1C1: #8C8C8C;
  --c-C8C8C8: #8C8C8C;
  --c-C9C9C9: #8C8C8C;
  --c-CFCFCF: #8C8C8C;
  --c-DDDDDD: #8C8C8C;
  --c-F6F6F6: #000000;
}
/* רקעים של בחירה ומעבר עכבר נשארים בגוון הרגיל (רק המסגרות והקווים כהים יותר) */
:root.a11y-contrast:not([data-theme="dark"]) :is(.sidebar-btn, .history-search-button, .settings-close, .settings-item, .profile-menu-item)::before,
:root.a11y-contrast:not([data-theme="dark"]) :is(.sidebar-profile, .settings-avatar) {
  background: #DDDDDD;
}
:root.a11y-contrast[data-theme="dark"] :is(.sidebar-btn, .history-search-button, .settings-close, .settings-item, .profile-menu-item)::before,
:root.a11y-contrast[data-theme="dark"] :is(.sidebar-profile, .settings-avatar) {
  background: #333333;
}
:root.a11y-contrast:not([data-theme="dark"]) svg [fill="#9A9A9A"] { fill: #595959; }
:root.a11y-contrast:not([data-theme="dark"]) svg [stroke="#9A9A9A"] { stroke: #595959; }
:root.a11y-contrast[data-theme="dark"] svg [fill="#9A9A9A"] { fill: #BDBDBD; }
:root.a11y-contrast[data-theme="dark"] svg [stroke="#9A9A9A"] { stroke: #BDBDBD; }
/* --- עצירת אנימציות: בלי תנועה בכלל, וגם כל מה שהאתר עושה כשהמכשיר מוגדר ל"הפחתת תנועה" --- */
:root.a11y-nomotion *,
:root.a11y-nomotion *::before,
:root.a11y-nomotion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
:root.a11y-nomotion .thinking-dots .dot {
    animation: none;
    opacity: 0.6;
}
:root.a11y-nomotion .agent-answer.is-waiting .agent-logo {
  animation: none;
}
:root.a11y-nomotion .think-orb,
:root.a11y-nomotion .think-orb i,
:root.a11y-nomotion .agent-answer.is-waiting .think-orb {
  animation: none;
}
:root.a11y-nomotion .think-word {
  animation: none;
  background: none;
  -webkit-text-fill-color: currentColor;
}
:root.a11y-nomotion.sidebar-animating,
:root.a11y-nomotion .sidebar-label,
:root.a11y-nomotion .sidebar-profile-name,
:root.a11y-nomotion .sidebar-settings,
:root.a11y-nomotion .sidebar-logo,
:root.a11y-nomotion .sidebar-report {
    transition: none !important;
}
:root.a11y-nomotion .folder-icon .folder-closed,
:root.a11y-nomotion .folder-icon .folder-open,
:root.a11y-nomotion .folder-icon .folder-front { transition: none;
}
:root.a11y-nomotion .chat-menu,
:root.a11y-nomotion .chat-menu.is-open {
    transition: none;
}
:root.a11y-nomotion .history-search {
    transition: none;
}
:root.a11y-nomotion .upgrade-page,
:root.a11y-nomotion .upgrade-page.is-open {
    transition: none;
}
:root.a11y-nomotion .upgrade-agent.is-playing .eyes,
:root.a11y-nomotion .upgrade-agent.is-playing .eye {
    animation: none;
}
:root.a11y-nomotion .settings-overlay,
:root.a11y-nomotion .settings-overlay.is-open,
:root.a11y-nomotion .settings-modal {
    transition: none;
}
:root.a11y-nomotion .settings-switch,
:root.a11y-nomotion .settings-switch::after {
    transition: none;
}
:root.a11y-nomotion .profile-menu,
:root.a11y-nomotion .profile-menu.is-open {
    transition: none;
}
:root.a11y-nomotion .send-button { transition: none;
}
/* --- הדגשת קישורים: קו תחתון עבה ומודגש לכל קישור --- */
:root.a11y-links a[href] {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px !important;
  font-weight: 600 !important;
}
/* --- גופן קריא: Arial במקום Noto Sans Hebrew --- */
:root.a11y-font body,
:root.a11y-font body * {
  font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif !important;
}
