/* ============================================
   Accessibility Widget Styles
   Israeli Law Compliance (IS 5568 / WCAG 2.0 AA)
   ============================================ */

/* ---------- Skip to Content Link ---------- */
.a11y-skip-link {
  position: fixed;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100001;
  background: #1a73e8;
  color: #fff;
  padding: 12px 24px;
  border-radius: 0 0 8px 8px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.3s ease;
  font-family: Arial, sans-serif;
}

.a11y-skip-link:focus {
  top: 0;
  outline: 3px solid #ffcc00;
  outline-offset: 2px;
}

/* ---------- Toggle Button ---------- */
.a11y-toggle-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 99999;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  transition: all 0.3s ease;
}

.a11y-toggle-btn:hover {
  background: #1d4ed8;
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.a11y-toggle-btn:focus {
  outline: none;
}

.a11y-toggle-btn:focus-visible {
  outline: 2px solid #ffcc00;
  outline-offset: 2px;
}

.a11y-toggle-btn.open {
  background: #1d4ed8;
  color: #ffffff;
  border-color: rgba(37, 99, 235, 0.3);
}

.a11y-toggle-btn svg {
  pointer-events: none;
  width: 22px;
  height: 22px;
}

/* ---------- Panel ---------- */
.a11y-panel {
  position: fixed;
  bottom: 90px;
  left: 24px;
  z-index: 99998;
  width: 340px;
  max-height: 85vh;
  background: #1a1f3d;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: Arial, "Segoe UI", sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

/* ---------- Panel Header ---------- */
.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1a73e8, #00c9ff);
  color: #fff;
}

.a11y-panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

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

.a11y-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.a11y-close-btn:focus {
  outline: 2px solid #ffcc00;
  outline-offset: 2px;
}

/* ---------- Panel Body ---------- */
.a11y-panel-body {
  padding: 12px 16px;
  overflow-y: auto;
  max-height: calc(85vh - 56px);
}

/* ---------- Font Size Group ---------- */
.a11y-group h4 {
  color: #a8b2d1;
  font-size: 13px;
  margin-bottom: 10px;
  text-align: center;
}

.a11y-font-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.a11y-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #ccd6f6;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.a11y-btn:hover {
  background: rgba(26, 115, 232, 0.3);
  border-color: #1a73e8;
}

.a11y-btn:focus {
  outline: 2px solid #ffcc00;
  outline-offset: 2px;
}

/* ---------- Option Buttons ---------- */
.a11y-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.a11y-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #ccd6f6;
  cursor: pointer;
  font-size: 11px;
  text-align: center;
  transition: all 0.2s;
  font-family: inherit;
}

.a11y-option-btn:hover {
  background: rgba(26, 115, 232, 0.15);
  border-color: rgba(26, 115, 232, 0.4);
}

.a11y-option-btn:focus {
  outline: 2px solid #ffcc00;
  outline-offset: 2px;
}

.a11y-option-btn.active {
  background: rgba(26, 115, 232, 0.3);
  border-color: #1a73e8;
  color: #fff;
}

.a11y-option-icon {
  font-size: 18px;
  line-height: 1;
}

/* ---------- Panel Footer ---------- */
.a11y-panel-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.a11y-reset-all {
  width: 100%;
  padding: 10px;
  background: rgba(229, 57, 53, 0.15);
  border: 1px solid rgba(229, 57, 53, 0.3);
  color: #ef5350;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  font-family: inherit;
}

.a11y-reset-all:hover {
  background: rgba(229, 57, 53, 0.25);
}

.a11y-reset-all:focus {
  outline: 2px solid #ffcc00;
  outline-offset: 2px;
}

.a11y-statement-link {
  display: block;
  text-align: center;
  color: #a8b2d1;
  font-size: 12px;
  text-decoration: none;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.2s;
}

.a11y-statement-link:hover {
  color: #1a73e8;
}

.a11y-statement-link:focus {
  outline: 2px solid #ffcc00;
  outline-offset: 2px;
}

/* ---------- Reading Guide ---------- */
.a11y-reading-guide {
  position: fixed;
  left: 0;
  width: 100%;
  height: 30px;
  background: rgba(26, 115, 232, 0.12);
  border-top: 2px solid rgba(26, 115, 232, 0.4);
  border-bottom: 2px solid rgba(26, 115, 232, 0.4);
  pointer-events: none;
  z-index: 99997;
  transition: top 0.05s linear;
}

/* ============================================
   Accessibility Modes (applied to body)
   ============================================ */

/* ---------- High Contrast ---------- */
body.a11y-high-contrast {
  filter: contrast(1.5) !important;
}

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

/* ---------- Invert Colors ---------- */
body.a11y-invert-colors {
  filter: invert(1) hue-rotate(180deg) !important;
}

body.a11y-invert-colors img,
body.a11y-invert-colors video,
body.a11y-invert-colors svg,
body.a11y-invert-colors .a11y-toggle-btn,
body.a11y-invert-colors .a11y-panel {
  filter: invert(1) hue-rotate(180deg) !important;
}

/* ---------- Grayscale ---------- */
body.a11y-grayscale {
  filter: grayscale(1) !important;
}

/* ---------- Highlight Links ---------- */
body.a11y-highlight-links a {
  outline: 3px solid #ffcc00 !important;
  outline-offset: 2px !important;
  text-decoration: underline !important;
  color: #ffcc00 !important;
}

body.a11y-highlight-links a:focus {
  outline-width: 4px !important;
}

/* ---------- Readable Font ---------- */
body.a11y-readable-font,
body.a11y-readable-font * {
  font-family: Arial, Helvetica, "Segoe UI", sans-serif !important;
  letter-spacing: 0.5px !important;
  word-spacing: 2px !important;
}

/* ---------- Big Cursor ---------- */
body.a11y-big-cursor,
body.a11y-big-cursor * {
  cursor:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4l28 20H20l8 16-4 2-8-16-8 12z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E")
      4 4,
    auto !important;
}

/* ---------- Text Spacing ---------- */
body.a11y-text-spacing {
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}

body.a11y-text-spacing p,
body.a11y-text-spacing li,
body.a11y-text-spacing span,
body.a11y-text-spacing div {
  line-height: 1.8 !important;
}

/* ---------- Disable Animations ---------- */
body.a11y-disable-animations *,
body.a11y-disable-animations *::before,
body.a11y-disable-animations *::after {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition-duration: 0s !important;
  transition-delay: 0s !important;
  scroll-behavior: auto !important;
}

/* ---------- Accessibility Statement Section ---------- */
.a11y-statement {
  direction: rtl;
  text-align: right;
}

.a11y-statement h3 {
  color: var(--text-light, #fff);
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.a11y-statement p,
.a11y-statement li {
  color: var(--text-body, #ccd6f6);
  line-height: 1.8;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.a11y-statement ul {
  padding-right: 20px;
  margin-bottom: 16px;
}

.a11y-statement a {
  color: var(--primary, #1a73e8);
  text-decoration: underline;
}

/* ---------- Accessibility Statement Modal ---------- */
.a11y-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

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

.a11y-modal {
  background: #1a1f3d;
  border-radius: 16px;
  width: 90%;
  max-width: 750px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.a11y-modal-overlay.open .a11y-modal {
  transform: translateY(0);
}

.a11y-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1a73e8, #00c9ff);
  color: #fff;
}

.a11y-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  font-family: Arial, "Segoe UI", sans-serif;
}

.a11y-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
}

.a11y-modal-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.a11y-modal-close:focus {
  outline: 2px solid #ffcc00;
  outline-offset: 2px;
}

.a11y-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
  font-family: Arial, "Segoe UI", sans-serif;
}

.a11y-modal-body h3 {
  color: #fff;
  margin: 12px 0 6px;
  font-size: 1.05rem;
}

.a11y-modal-body h3:first-child {
  margin-top: 0;
}

.a11y-modal-body p {
  color: #ccd6f6;
  line-height: 1.6;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.a11y-modal-body ul {
  padding-right: 20px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

.a11y-modal-body li {
  color: #ccd6f6;
  line-height: 1.5;
  margin-bottom: 2px;
  font-size: 0.9rem;
}

.a11y-modal-body a {
  color: #4a93f0;
  text-decoration: underline;
}

/* ---------- Responsive ---------- */
@media (max-width: 400px) {
  .a11y-panel {
    width: calc(100vw - 32px);
    left: 16px;
    bottom: 86px;
  }

  .a11y-toggle-btn {
    left: 16px;
    bottom: 16px;
    width: 48px;
    height: 48px;
  }
}
