/* Easy Accessibility Widget v1.0.0 */
.ea-root {
  --ea-primary: #1E5EFF;
  --ea-text: #111827;
  --ea-muted: #4b5563;
  --ea-border: #e5e7eb;
  --ea-shadow: 0 18px 50px rgba(2, 6, 23, .24);
  --ea-offset-x: 20px;
  --ea-offset-y: 20px;
  --ea-btn-size: 58px;
}

.ea-root,
.ea-root * {
  box-sizing: border-box;
}

.ea-size-small { --ea-btn-size: 46px; }
.ea-size-medium { --ea-btn-size: 58px; }
.ea-size-large { --ea-btn-size: 70px; }

/* ---------- כפתור צף ---------- */

.ea-toggle {
  position: fixed;
  z-index: 2147483000;
  width: var(--ea-btn-size);
  height: var(--ea-btn-size);
  border: 0;
  border-radius: 999px;
  background: var(--ea-primary);
  color: #fff;
  box-shadow: 0 8px 24px rgba(2, 6, 23, .3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  transition: transform .18s ease, box-shadow .18s ease;
}

.ea-pos-bottom-right .ea-toggle { right: var(--ea-offset-x); bottom: var(--ea-offset-y); }
.ea-pos-bottom-left .ea-toggle { left: var(--ea-offset-x); bottom: var(--ea-offset-y); }
.ea-pos-top-right .ea-toggle { right: var(--ea-offset-x); top: var(--ea-offset-y); }
.ea-pos-top-left .ea-toggle { left: var(--ea-offset-x); top: var(--ea-offset-y); }

.ea-toggle:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 30px rgba(2, 6, 23, .38);
}

.ea-toggle:focus-visible {
  outline: 3px solid #facc15;
  outline-offset: 3px;
}

.ea-toggle-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 999px;
}

svg.ea-toggle-icon {
  border-radius: 0;
}

/* ---------- פאנל ---------- */

.ea-panel {
  position: fixed;
  z-index: 2147483001;
  width: min(380px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--ea-text);
  border: 1px solid var(--ea-border);
  border-radius: 20px;
  box-shadow: var(--ea-shadow);
  direction: rtl;
  text-align: right;
  font-family: Heebo, Assistant, Arial, sans-serif;
  overflow: hidden;
}

.ea-pos-bottom-right .ea-panel { right: var(--ea-offset-x); bottom: calc(var(--ea-offset-y) + var(--ea-btn-size) + 14px); }
.ea-pos-bottom-left .ea-panel { left: var(--ea-offset-x); bottom: calc(var(--ea-offset-y) + var(--ea-btn-size) + 14px); }
.ea-pos-top-right .ea-panel { right: var(--ea-offset-x); top: calc(var(--ea-offset-y) + var(--ea-btn-size) + 14px); }
.ea-pos-top-left .ea-panel { left: var(--ea-offset-x); top: calc(var(--ea-offset-y) + var(--ea-btn-size) + 14px); }

.ea-panel[hidden] {
  display: none !important;
}

.ea-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 12px;
  background: var(--ea-primary);
  color: #fff;
}

.ea-panel-header h2 {
  margin: 0 0 2px;
  font-size: 20px;
  line-height: 1.25;
  color: #fff;
  font-weight: 800;
}

.ea-panel-header p {
  margin: 0;
  color: rgba(255, 255, 255, .85);
  font-size: 13px;
  line-height: 1.4;
}

.ea-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .4);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.ea-close:hover {
  background: rgba(255, 255, 255, .25);
}

.ea-panel-body {
  overflow-y: auto;
  padding: 14px 18px;
}

/* ---------- כפתורי גודל טקסט ---------- */

.ea-text-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--ea-border);
  border-radius: 14px;
  padding: 8px 10px;
  background: #f8fafc;
}

.ea-text-btn {
  min-height: 40px !important;
  min-width: 70px;
  font-size: 16px !important;
}

.ea-text-level {
  font-weight: 800;
  font-size: 14px;
  color: var(--ea-muted);
}

/* ---------- כפתורי פעולה ---------- */

.ea-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ea-action,
.ea-secondary,
.ea-reset {
  appearance: none;
  border: 1px solid var(--ea-border);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--ea-text);
  min-height: 46px;
  padding: 8px 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.ea-action:hover,
.ea-secondary:hover {
  border-color: var(--ea-primary);
}

.ea-action[aria-pressed="true"] {
  background: var(--ea-primary);
  color: #fff;
  border-color: var(--ea-primary);
}

.ea-action-icon {
  font-size: 15px;
  line-height: 1;
  flex: 0 0 auto;
}

/* ---------- סריקה ---------- */

.ea-scan {
  border: 1px solid var(--ea-border);
  background: #f8fafc;
  border-radius: 14px;
  padding: 12px;
  margin-top: 12px;
}

.ea-scan p {
  margin: 0;
  color: var(--ea-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.ea-secondary {
  margin-top: 8px;
  width: 100%;
  background: #fff;
  min-height: 38px;
}

.ea-hint {
  margin: 10px 0 0;
  color: var(--ea-muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

/* ---------- פוטר ---------- */

.ea-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--ea-border);
  background: #fff;
}

.ea-statement-link {
  color: var(--ea-primary) !important;
  font-weight: 800;
  font-size: 13px;
  text-decoration: underline !important;
  text-underline-offset: 4px;
}

.ea-reset {
  background: #fff4e0;
  border-color: #fed7aa;
  color: #9a5200;
  min-height: 40px;
}

.ea-panel button:focus-visible,
.ea-panel a:focus-visible {
  outline: 3px solid #facc15 !important;
  outline-offset: 2px !important;
}

/* ---------- קישור דילוג ---------- */

.ea-skip-link {
  position: fixed;
  top: -80px;
  right: 16px;
  z-index: 2147483002;
  background: #0b1220;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
  transition: top .15s ease;
}

.ea-skip-link:focus,
.ea-skip-link:focus-visible {
  top: 16px;
  outline: 3px solid #facc15;
  outline-offset: 2px;
}

/* ---------- תוויות מוסתרות לקוראי מסך ---------- */

.ea-sr-only,
.ea-generated-label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- תיאורי תמונות ---------- */

.ea-img-alt-label {
  display: none;
  margin: 6px 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff7ed;
  color: #7c2d12;
  border: 1px solid #fed7aa;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
}

html.ea-show-image-alt .ea-img-alt-label {
  display: block;
}

/* ---------- פונט קריא ---------- */

html.ea-readable-font body,
html.ea-readable-font body *:not(svg):not(path):not(.ea-root):not(.ea-root *) {
  font-family: Arial, "Arial Hebrew", sans-serif !important;
}

/* ---------- מרווחי טקסט ---------- */

html.ea-line-spacing body,
html.ea-line-spacing body *:not(svg):not(path):not(.ea-root):not(.ea-root *) {
  line-height: 1.9 !important;
  letter-spacing: .02em !important;
  word-spacing: .08em !important;
}

/* ---------- הדגשת קישורים ---------- */

html.ea-highlight-links a:not(.ea-root a) {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 4px !important;
  color: #0f4c81 !important;
  font-weight: 800 !important;
  background: #fef9c3 !important;
}

/* ---------- הדגשת כותרות ---------- */

html.ea-highlight-titles h1,
html.ea-highlight-titles h2,
html.ea-highlight-titles h3,
html.ea-highlight-titles h4,
html.ea-highlight-titles h5,
html.ea-highlight-titles h6 {
  background: #fef08a !important;
  color: #111827 !important;
  outline: 2px dashed #ca8a04 !important;
  outline-offset: 2px !important;
}

html.ea-highlight-titles .ea-root h2,
html.ea-highlight-titles .ea-root h3 {
  background: none !important;
  outline: none !important;
}

html.ea-highlight-titles .ea-panel-header h2 {
  color: #fff !important;
}

/* ---------- פוקוס מקלדת ---------- */

html.ea-focus-visible a:focus,
html.ea-focus-visible button:focus,
html.ea-focus-visible input:focus,
html.ea-focus-visible select:focus,
html.ea-focus-visible textarea:focus,
html.ea-focus-visible [tabindex]:focus {
  outline: 3px solid #facc15 !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 6px rgba(250, 204, 21, .28) !important;
}

/* ---------- עצירת אנימציות ---------- */

html.ea-pause-motion *:not(.ea-root):not(.ea-root *),
html.ea-pause-motion *:not(.ea-root):not(.ea-root *)::before,
html.ea-pause-motion *:not(.ea-root):not(.ea-root *)::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}

/* ---------- גווני אפור ---------- */

html.ea-grayscale body > *:not(#ea-root) {
  filter: grayscale(1) !important;
}

/* ---------- ניגודיות הפוכה ---------- */

html.ea-contrast-invert body > *:not(#ea-root) {
  filter: invert(1) hue-rotate(180deg) !important;
}

html.ea-contrast-invert body img,
html.ea-contrast-invert body video,
html.ea-contrast-invert body iframe {
  filter: invert(1) hue-rotate(180deg) !important;
}

/* ---------- סמן גדול ---------- */

html.ea-big-cursor,
html.ea-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 3l20 14-9 2 5 9-4 2-5-9-7 7V3z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 3 3, auto !important;
}

/* ---------- ניגודיות כהה ---------- */

html.ea-contrast-dark body,
html.ea-contrast-dark main,
html.ea-contrast-dark section,
html.ea-contrast-dark article,
html.ea-contrast-dark aside,
html.ea-contrast-dark header,
html.ea-contrast-dark footer,
html.ea-contrast-dark nav,
html.ea-contrast-dark ul,
html.ea-contrast-dark ol,
html.ea-contrast-dark table,
html.ea-contrast-dark tr,
html.ea-contrast-dark td,
html.ea-contrast-dark th,
html.ea-contrast-dark div:not(#ea-root):not(#ea-root div),
html.ea-contrast-dark form:not(#ea-root form) {
  background: #000 !important;
  background-image: none !important;
  color: #fff !important;
  box-shadow: none !important;
  text-shadow: none !important;
  border-color: #444 !important;
}

html.ea-contrast-dark h1,
html.ea-contrast-dark h2:not(#ea-root h2),
html.ea-contrast-dark h3:not(#ea-root h3),
html.ea-contrast-dark h4,
html.ea-contrast-dark h5,
html.ea-contrast-dark h6,
html.ea-contrast-dark p:not(#ea-root p),
html.ea-contrast-dark span:not(#ea-root span),
html.ea-contrast-dark li,
html.ea-contrast-dark label:not(.ea-generated-label),
html.ea-contrast-dark strong,
html.ea-contrast-dark em,
html.ea-contrast-dark b {
  color: #fff !important;
  text-shadow: none !important;
}

html.ea-contrast-dark a:not(#ea-root a) {
  color: #facc15 !important;
  text-decoration: underline !important;
}

html.ea-contrast-dark button:not(#ea-root button),
html.ea-contrast-dark input,
html.ea-contrast-dark select,
html.ea-contrast-dark textarea {
  background: #000 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
}

/* ---------- ניגודיות בהירה ---------- */

html.ea-contrast-light body,
html.ea-contrast-light main,
html.ea-contrast-light section,
html.ea-contrast-light article,
html.ea-contrast-light aside,
html.ea-contrast-light header,
html.ea-contrast-light footer,
html.ea-contrast-light nav,
html.ea-contrast-light ul,
html.ea-contrast-light ol,
html.ea-contrast-light table,
html.ea-contrast-light tr,
html.ea-contrast-light td,
html.ea-contrast-light th,
html.ea-contrast-light div:not(#ea-root):not(#ea-root div),
html.ea-contrast-light form:not(#ea-root form) {
  background: #fff !important;
  background-image: none !important;
  color: #000 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  border-color: #999 !important;
}

html.ea-contrast-light h1,
html.ea-contrast-light h2:not(#ea-root h2),
html.ea-contrast-light h3:not(#ea-root h3),
html.ea-contrast-light h4,
html.ea-contrast-light h5,
html.ea-contrast-light h6,
html.ea-contrast-light p:not(#ea-root p),
html.ea-contrast-light span:not(#ea-root span),
html.ea-contrast-light li,
html.ea-contrast-light label:not(.ea-generated-label),
html.ea-contrast-light strong,
html.ea-contrast-light em,
html.ea-contrast-light b {
  color: #000 !important;
  text-shadow: none !important;
}

html.ea-contrast-light a:not(#ea-root a) {
  color: #003b73 !important;
  text-decoration: underline !important;
}

html.ea-contrast-light button:not(#ea-root button),
html.ea-contrast-light input,
html.ea-contrast-light select,
html.ea-contrast-light textarea {
  background: #fff !important;
  color: #000 !important;
  border: 2px solid #000 !important;
}

/* ---------- מדריך קריאה ---------- */

.ea-reading-guide-bar {
  position: fixed;
  left: 0;
  right: 0;
  height: 8px;
  background: #facc15;
  border-top: 2px solid #111827;
  border-bottom: 2px solid #111827;
  z-index: 2147482998;
  pointer-events: none;
}

/* ---------- מסכת קריאה ---------- */

.ea-reading-mask-part {
  position: fixed;
  left: 0;
  right: 0;
  background: rgba(2, 6, 23, .62);
  z-index: 2147482997;
  pointer-events: none;
}

.ea-reading-mask-top {
  top: 0;
  height: 0;
}

.ea-reading-mask-bottom {
  bottom: 0;
  top: 100vh;
}

/* ---------- טפסים ---------- */

.ea-form-status {
  color: #b91c1c !important;
  font-weight: 800 !important;
}

.ea-form-status:not(:empty) {
  margin: 6px 0 !important;
  padding: 8px 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

[aria-invalid="true"] {
  border-color: #b91c1c !important;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .18) !important;
}

/* ---------- העדפת מערכת להפחתת תנועה ---------- */

@media (prefers-reduced-motion: reduce) {
  .ea-toggle,
  .ea-skip-link {
    transition: none !important;
  }
}

/* ---------- מובייל ---------- */

@media (max-width: 600px) {
  .ea-root { --ea-btn-size: 52px; }

  .ea-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 100px);
    border-radius: 16px;
  }

  .ea-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html.ea-hide-mobile-widget .ea-root {
    display: none !important;
  }
}
