/**
 * AccessWidget v1.0 - Standalone Accessibility Widget
 */

/* ─── Toggle Button ─── */
#aw-toggle { position: fixed; bottom: 20px; z-index: 2147483647; width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #1e40af, #3b82f6); color: #fff; border: 3px solid #fff; cursor: pointer; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); display: flex; align-items: center; justify-content: center; transition: transform 0.2s, box-shadow 0.2s; font-family: Arial, sans-serif; padding: 0; margin: 0; box-sizing: border-box; }
#aw-toggle[data-pos="right"] { right: 20px; }
#aw-toggle[data-pos="left"] { left: 20px; }
#aw-toggle:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(0, 0, 0, 0.4); }
#aw-toggle:focus { outline: 3px solid #fbbf24; outline-offset: 3px; }
#aw-toggle svg { width: 30px; height: 30px; fill: currentColor; pointer-events: none; }

/* ─── Panel ─── */
#aw-panel { position: fixed; bottom: 90px; z-index: 2147483646; width: 380px; max-height: 85vh; background: #fff; border-radius: 16px; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25); font-family: 'Segoe UI', Tahoma, Arial, sans-serif; overflow: hidden; display: none; border: 1px solid #e2e8f0; box-sizing: border-box; color: #1e293b; }
#aw-panel[data-pos="right"] { right: 20px; }
#aw-panel[data-pos="left"] { left: 20px; }
#aw-panel[data-dir="rtl"] { direction: rtl; text-align: right; }
#aw-panel[data-dir="ltr"] { direction: ltr; text-align: left; }
#aw-panel.aw-open { display: flex; flex-direction: column; }
#aw-panel * { box-sizing: border-box; }

/* ─── Header ─── */
.aw-hdr { background: linear-gradient(135deg, #1e40af, #2563eb); color: #fff; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.aw-hdr h2 { margin: 0; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: #fff; }
.aw-hdr-btns { display: flex; gap: 4px; }
.aw-hdr-btn { background: rgba(255, 255, 255, 0.15); border: none; color: #fff; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: background 0.15s; padding: 0; }
.aw-hdr-btn:hover { background: rgba(255, 255, 255, 0.3); }
.aw-hdr-btn:focus { outline: 2px solid #fbbf24; outline-offset: 1px; }
.aw-hdr-btn svg { width: 16px; height: 16px; }

/* ─── Search ─── */
.aw-search { padding: 8px 14px; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
.aw-search input { width: 100%; padding: 8px 12px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.15s; color: #1e293b; background: #fff; }
#aw-panel[data-dir="rtl"] .aw-search input { direction: rtl; text-align: right; }
.aw-search input:focus { border-color: #3b82f6; }
.aw-search input::placeholder { color: #94a3b8; }

/* ─── Body ─── */
.aw-body { padding: 8px 14px 14px; overflow-y: auto; flex: 1; scrollbar-width: thin; }
.aw-body::-webkit-scrollbar { width: 5px; }
.aw-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ─── Sections ─── */
.aw-sec { margin-bottom: 10px; }
.aw-sec-title { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 6px; padding: 0 2px; letter-spacing: 0.5px; display: flex; align-items: center; gap: 6px; }
.aw-sec-title svg { width: 14px; height: 14px; }

/* ─── Feature Buttons ─── */
.aw-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; margin-bottom: 4px; border: 2px solid #e2e8f0; border-radius: 10px; background: #f8fafc; color: #1e293b; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; font-family: inherit; min-height: 44px; }
#aw-panel[data-dir="rtl"] .aw-btn { text-align: right; direction: rtl; }
#aw-panel[data-dir="ltr"] .aw-btn { text-align: left; direction: ltr; }
.aw-btn:hover { border-color: #3b82f6; background: #eff6ff; }
.aw-btn:focus { outline: 3px solid #3b82f6; outline-offset: 1px; }
.aw-btn.aw-on { background: #1e40af; color: #fff; border-color: #1e40af; }
.aw-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.aw-btn .aw-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.08); font-weight: 600; }
#aw-panel[data-dir="rtl"] .aw-btn .aw-badge { margin-right: auto; }
#aw-panel[data-dir="ltr"] .aw-btn .aw-badge { margin-left: auto; }
.aw-btn.aw-on .aw-badge { background: rgba(255, 255, 255, 0.2); }
.aw-btn-label { flex: 1; }

/* ─── Slider Row ─── */
.aw-sld { display: flex; align-items: center; gap: 6px; padding: 8px 12px; margin-bottom: 4px; border: 2px solid #e2e8f0; border-radius: 10px; background: #f8fafc; min-height: 44px; }
#aw-panel[data-dir="rtl"] .aw-sld { direction: rtl; }
#aw-panel[data-dir="ltr"] .aw-sld { direction: ltr; }
.aw-sld label { font-size: 13px; font-weight: 500; color: #1e293b; flex: 1; display: flex; align-items: center; gap: 8px; }
.aw-sld label svg { width: 18px; height: 18px; flex-shrink: 0; }
.aw-sld button { width: 32px; height: 32px; min-width: 32px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; color: #1e293b; font-size: 18px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; padding: 0; font-family: inherit; }
.aw-sld button:hover { background: #1e40af; color: #fff; border-color: #1e40af; }
.aw-sld button:focus { outline: 2px solid #3b82f6; }
.aw-sld .aw-val { min-width: 50px; text-align: center; font-size: 13px; font-weight: 600; color: #1e40af; }

/* ─── Reset Button ─── */
.aw-rst { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px; margin-top: 6px; border: 2px solid #fecaca; border-radius: 10px; background: #fef2f2; color: #dc2626; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; font-family: inherit; min-height: 44px; }
.aw-rst:hover { background: #fee2e2; border-color: #f87171; }
.aw-rst:focus { outline: 3px solid #dc2626; outline-offset: 1px; }
.aw-rst svg { width: 16px; height: 16px; }

/* ─── Footer ─── */
.aw-ftr { padding: 10px 14px; text-align: center; border-top: 1px solid #e2e8f0; font-size: 11px; color: #94a3b8; display: flex; justify-content: center; gap: 8px; flex-shrink: 0; background: #fff; }
.aw-ftr a { color: #3b82f6; text-decoration: none; }
.aw-ftr a:hover { text-decoration: underline; }

/* ─── Applied Styles to Host Document ─── */
body.aw-contrast-high { filter: contrast(2) !important; }
body.aw-contrast-bw *:not(#aw-toggle):not(#aw-panel):not(#aw-panel *):not(#aw-struct):not(#aw-struct *) { background-color: #000 !important; color: #fff !important; border-color: #fff !important; }
body.aw-contrast-bw img { filter: grayscale(1) contrast(1.2) !important; }
body.aw-contrast-wb *:not(#aw-toggle):not(#aw-panel):not(#aw-panel *):not(#aw-struct):not(#aw-struct *) { background-color: #fff !important; color: #000 !important; border-color: #000 !important; }
body.aw-contrast-yb *:not(#aw-toggle):not(#aw-panel):not(#aw-panel *):not(#aw-struct):not(#aw-struct *) { background-color: #000 !important; color: #ffff00 !important; border-color: #ffff00 !important; }
body.aw-contrast-by *:not(#aw-toggle):not(#aw-panel):not(#aw-panel *):not(#aw-struct):not(#aw-struct *) { background-color: #ffff00 !important; color: #000 !important; border-color: #000 !important; }
body.aw-sat-low { filter: saturate(0.3) !important; }
body.aw-sat-gray { filter: grayscale(1) !important; }
body.aw-sat-high { filter: saturate(2) !important; }
body.aw-invert { filter: invert(1) hue-rotate(180deg) !important; }
body.aw-invert img, body.aw-invert video, body.aw-invert svg:not(#aw-toggle svg):not(#aw-panel svg):not(#aw-struct svg) { filter: invert(1) hue-rotate(180deg) !important; }
body.aw-hl-links a:not(#aw-panel a):not(#aw-toggle):not(.aw-struct-item), body.aw-hl-links button:not(.aw-btn):not(.aw-hdr-btn):not(#aw-toggle):not(.aw-rst):not(.aw-sld button):not(.aw-struct-item), body.aw-hl-links [role="button"]:not(.aw-btn), body.aw-hl-links input[type="submit"], body.aw-hl-links input[type="button"] { outline: 3px solid #fbbf24 !important; outline-offset: 2px !important; text-decoration: underline !important; text-underline-offset: 3px !important; }
body.aw-hl-heads h1:not(#aw-panel h1):not(#aw-struct h1), body.aw-hl-heads h2:not(#aw-panel h2):not(#aw-struct h2), body.aw-hl-heads h3:not(#aw-panel h3):not(#aw-struct h3), body.aw-hl-heads h4:not(#aw-panel h4):not(#aw-struct h4), body.aw-hl-heads h5:not(#aw-panel h5):not(#aw-struct h5), body.aw-hl-heads h6:not(#aw-panel h6):not(#aw-struct h6), body.aw-hl-heads [role="heading"] { outline: 3px solid #34d399 !important; outline-offset: 3px !important; background: rgba(52, 211, 153, 0.08) !important; }
body.aw-readable, body.aw-readable *:not(#aw-panel):not(#aw-panel *):not(#aw-struct):not(#aw-struct *) { font-family: Arial, Helvetica, 'Noto Sans Hebrew', sans-serif !important; }
body.aw-dyslexia, body.aw-dyslexia *:not(#aw-panel):not(#aw-panel *):not(#aw-struct):not(#aw-struct *) { font-family: 'Comic Sans MS', 'OpenDyslexic', Arial, sans-serif !important; letter-spacing: 0.05em !important; word-spacing: 0.12em !important; }
body.aw-align-center *:not(#aw-panel):not(#aw-panel *):not(#aw-struct):not(#aw-struct *) { text-align: center !important; }
body.aw-align-right *:not(#aw-panel):not(#aw-panel *):not(#aw-struct):not(#aw-struct *) { text-align: right !important; }
body.aw-align-left *:not(#aw-panel):not(#aw-panel *):not(#aw-struct):not(#aw-struct *) { text-align: left !important; }
body.aw-no-anim *, body.aw-no-anim *::before, body.aw-no-anim *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
body.aw-no-anim img[src$=".gif"] { visibility: hidden !important; }
body.aw-kbd-nav *:focus { outline: 4px solid #f59e0b !important; outline-offset: 4px !important; box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.25) !important; }
body.aw-focus-hl *:focus { outline: 5px solid #ef4444 !important; outline-offset: 4px !important; box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.3) !important; }
body.aw-big-cursor, body.aw-big-cursor * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1' d='M5 3l14 8-6 2 4 8-3 1-4-8-5 4z'/%3E%3C/svg%3E") 4 2, auto !important; }
#aw-rg { position: fixed; left: 0; width: 100%; height: 14px; background: rgba(59, 130, 246, 0.2); border-top: 2px solid #3b82f6; border-bottom: 2px solid #3b82f6; pointer-events: none; z-index: 2147483645; display: none; }
.aw-mask { position: fixed; left: 0; width: 100%; background: rgba(0, 0, 0, 0.7); pointer-events: none; z-index: 2147483644; display: none; }
#aw-mask-top { top: 0; }
#aw-mask-bottom { bottom: 0; }
body.aw-no-img img:not(#aw-panel img), body.aw-no-img video, body.aw-no-img picture { opacity: 0.05 !important; }
body.aw-tooltips [title]:hover::after { content: attr(title) !important; position: absolute !important; bottom: 100% !important; background: #1e293b !important; color: #fff !important; padding: 6px 10px !important; border-radius: 6px !important; font-size: 13px !important; white-space: nowrap !important; z-index: 999999 !important; pointer-events: none !important; }
#aw-struct { position: fixed; top: 50%; transform: translateY(-50%); z-index: 2147483643; background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); padding: 16px; max-height: 60vh; width: 280px; overflow-y: auto; font-family: 'Segoe UI', Tahoma, Arial, sans-serif; display: none; border: 1px solid #e2e8f0; color: #1e293b; box-sizing: border-box; }
#aw-struct[data-pos="right"] { right: 420px; }
#aw-struct[data-pos="left"] { left: 420px; }
#aw-struct[data-dir="rtl"] { direction: rtl; text-align: right; }
#aw-struct[data-dir="ltr"] { direction: ltr; text-align: left; }
#aw-struct.aw-vis { display: block; }
#aw-struct h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: #1e40af; display: flex; align-items: center; gap: 6px; }
.aw-struct-item { display: block; padding: 6px 10px; margin: 3px 0; border-radius: 6px; font-size: 12px; font-weight: 500; color: #334155; text-decoration: none; cursor: pointer; border: 1px solid transparent; background: none; width: 100%; font-family: inherit; transition: all 0.1s; }
#aw-struct[data-dir="rtl"] .aw-struct-item { text-align: right; }
#aw-struct[data-dir="ltr"] .aw-struct-item { text-align: left; }
.aw-struct-item:hover { background: #eff6ff; border-color: #bfdbfe; }
.aw-struct-item:focus { outline: 2px solid #3b82f6; }
#aw-struct[data-dir="rtl"] .aw-struct-h1 { padding-right: 4px; font-weight: 700; font-size: 13px; }
#aw-struct[data-dir="rtl"] .aw-struct-h2 { padding-right: 16px; font-weight: 600; }
#aw-struct[data-dir="rtl"] .aw-struct-h3 { padding-right: 28px; }
#aw-struct[data-dir="rtl"] .aw-struct-h4 { padding-right: 40px; font-size: 11px; }
#aw-struct[data-dir="rtl"] .aw-struct-h5 { padding-right: 52px; font-size: 11px; }
#aw-struct[data-dir="rtl"] .aw-struct-h6 { padding-right: 64px; font-size: 11px; }
#aw-struct[data-dir="ltr"] .aw-struct-h1 { padding-left: 4px; font-weight: 700; font-size: 13px; }
#aw-struct[data-dir="ltr"] .aw-struct-h2 { padding-left: 16px; font-weight: 600; }
#aw-struct[data-dir="ltr"] .aw-struct-h3 { padding-left: 28px; }
#aw-struct[data-dir="ltr"] .aw-struct-h4 { padding-left: 40px; font-size: 11px; }
#aw-struct[data-dir="ltr"] .aw-struct-h5 { padding-left: 52px; font-size: 11px; }
#aw-struct[data-dir="ltr"] .aw-struct-h6 { padding-left: 64px; font-size: 11px; }
.aw-struct-lm { margin-top: 8px; padding-top: 8px; border-top: 1px solid #e2e8f0; }
.aw-sr { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; border: 0 !important; padding: 0 !important; margin: -1px !important; }
@media (max-width: 440px) {
  #aw-panel { width: calc(100vw - 20px); bottom: 82px; }
  #aw-panel[data-pos="right"] { right: 10px; }
  #aw-panel[data-pos="left"] { left: 10px; }
  #aw-struct { width: calc(100vw - 20px); top: auto; bottom: 82px; transform: none; }
  #aw-struct[data-pos="right"] { right: 10px; }
  #aw-struct[data-pos="left"] { left: 10px; }
}