/* ==========================================================================
   ACCESSIBILITY WIDGET STYLES (ISRAELI STANDARD 5568 / WCAG 2.1 AA)
   ========================================================================== */

/* Accessibility Trigger Button (Floating on Left above WhatsApp) */
.a11y-trigger-btn {
  position: fixed;
  bottom: 98px;
  left: 28px;
  z-index: 99999;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 24px rgba(30, 58, 138, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.a11y-trigger-btn:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 30px rgba(30, 58, 138, 0.6), 0 0 0 3px rgba(59, 130, 246, 0.4);
}

.a11y-trigger-btn:focus-visible {
  outline: 3px solid #e2b774;
  outline-offset: 4px;
}

.a11y-trigger-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #e2b774;
  color: #0b0f19;
  font-size: 0.65rem;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

.a11y-trigger-btn.has-active-features .a11y-trigger-badge {
  display: flex;
}

/* Accessibility Modal / Overlay */
.a11y-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.a11y-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.a11y-panel {
  position: fixed;
  bottom: 168px;
  left: 28px;
  width: 380px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  background: #ffffff;
  color: #0f172a;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
  z-index: 100001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  direction: rtl;
  text-align: right;
  font-family: 'Assistant', 'Heebo', sans-serif;
}

[data-theme="dark"] .a11y-panel {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(226, 183, 116, 0.2);
}

.a11y-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Panel Header */
.a11y-header {
  padding: 18px 22px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.a11y-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.a11y-header-icon {
  font-size: 1.5rem;
  color: #e2b774;
}

.a11y-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
}

.a11y-subtitle {
  font-size: 0.78rem;
  opacity: 0.85;
  margin: 2px 0 0 0;
}

.a11y-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.a11y-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Panel Content */
.a11y-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Square Blocks Grid */
.a11y-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Square Feature Block */
.a11y-block-btn {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  aspect-ratio: 1 / 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  text-align: center;
  outline: none;
  user-select: none;
}

[data-theme="dark"] .a11y-block-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

.a11y-block-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .a11y-block-btn:hover {
  background: #273549;
  border-color: #60a5fa;
}

.a11y-block-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Active State */
.a11y-block-btn.is-active {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(30, 58, 138, 0.35);
}

[data-theme="dark"] .a11y-block-btn.is-active {
  background: #2563eb;
  border-color: #60a5fa;
  color: #ffffff;
}

.a11y-block-btn.is-active .a11y-block-icon {
  color: #e2b774;
}

.a11y-block-btn.is-active .a11y-block-label {
  color: #ffffff;
  font-weight: 700;
}

.a11y-block-icon {
  font-size: 1.5rem;
  color: #2563eb;
  transition: transform 0.2s ease;
}

[data-theme="dark"] .a11y-block-icon {
  color: #60a5fa;
}

.a11y-block-btn:hover .a11y-block-icon {
  transform: scale(1.12);
}

.a11y-block-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.25;
}

[data-theme="dark"] .a11y-block-label {
  color: #cbd5e1;
}

/* Checkmark indicator for active block */
.a11y-block-status {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 0.65rem;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
  color: #4ade80;
}

.a11y-block-btn.is-active .a11y-block-status {
  opacity: 1;
  transform: scale(1);
}

/* Reset and Statement Footer */
.a11y-footer {
  padding: 14px 20px;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

[data-theme="dark"] .a11y-footer {
  background: #0b1120;
  border-top-color: #1e293b;
}

.a11y-reset-btn {
  background: transparent;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

[data-theme="dark"] .a11y-reset-btn {
  border-color: #475569;
  color: #cbd5e1;
}

.a11y-reset-btn:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
}

[data-theme="dark"] .a11y-reset-btn:hover {
  background: #450a0a;
  border-color: #f87171;
  color: #fca5a5;
}

.a11y-statement-link {
  font-size: 0.78rem;
  color: #2563eb;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

[data-theme="dark"] .a11y-statement-link {
  color: #93c5fd;
}

/* ==========================================================================
   APPLIED ACCESSIBILITY MODES (HTML / BODY CLASS TARGETS)
   ========================================================================== */

/* 1. Font Sizes */
html.a11y-text-lg {
  font-size: 115% !important;
}

html.a11y-text-xl {
  font-size: 130% !important;
}

/* 2. High Contrast (Dark High Contrast) */
body.a11y-high-contrast {
  background: #000000 !important;
  color: #ffffff !important;
}

body.a11y-high-contrast * {
  border-color: #ffffff !important;
}

body.a11y-high-contrast a,
body.a11y-high-contrast button {
  text-decoration: underline !important;
}

/* 3. Inverted Colors */
body.a11y-invert {
  filter: invert(100%) hue-rotate(180deg) !important;
}

body.a11y-invert img,
body.a11y-invert video,
body.a11y-invert .a11y-panel,
body.a11y-invert .a11y-trigger-btn {
  filter: invert(100%) hue-rotate(180deg) !important;
}

/* 4. Grayscale / Monochrome */
body.a11y-grayscale {
  filter: grayscale(100%) !important;
}

body.a11y-grayscale .a11y-panel,
body.a11y-grayscale .a11y-trigger-btn {
  filter: none !important;
}

/* 5. Highlight Links */
body.a11y-highlight-links a {
  background-color: #fef08a !important;
  color: #854d0e !important;
  text-decoration: underline !important;
  padding: 2px 4px !important;
  border-radius: 4px !important;
  font-weight: 800 !important;
}

/* 6. Highlight Headings */
body.a11y-highlight-headings h1,
body.a11y-highlight-headings h2,
body.a11y-highlight-headings h3,
body.a11y-highlight-headings h4,
body.a11y-highlight-headings h5,
body.a11y-highlight-headings h6 {
  outline: 3px dashed #2563eb !important;
  outline-offset: 4px !important;
  background: rgba(37, 99, 235, 0.08) !important;
}

/* 7. Readable Font (Clean System Sans) */
body.a11y-readable-font,
body.a11y-readable-font * {
  font-family: Arial, Helvetica, sans-serif !important;
  letter-spacing: 0.5px !important;
}

/* 8. Stop Animations */
body.a11y-stop-animations * {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* 9. Big Cursor */
body.a11y-big-cursor,
body.a11y-big-cursor * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="%23000000" stroke="%23ffffff" stroke-width="2"><path d="M3 3l7 18 3-7 7-3L3 3z"/></svg>'), auto !important;
}

/* 10. Reading Guide Line */
#a11yReadingGuide {
  position: fixed;
  left: 0;
  right: 0;
  height: 6px;
  background: #e11d48;
  box-shadow: 0 0 12px rgba(225, 29, 72, 0.8);
  pointer-events: none;
  z-index: 999999;
  display: none;
  transform: translateY(-50%);
}

body.a11y-reading-guide #a11yReadingGuide {
  display: block;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .a11y-panel {
    bottom: 145px;
    left: 15px;
    right: 15px;
    width: auto;
    max-width: none;
  }
  
  .a11y-trigger-btn {
    bottom: 85px;
    left: 20px;
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }
}
