/* Saudi Rehab Expo — Accessibility Toolbar v3.1.0 */
/* Brand: #f2b900 (gold) | #315926 (green) | #61ce70 (mint) | #0d0d0d (black) */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700;900&family=Bebas+Neue&display=swap');

/* ── Variables ── */
.rehab-accessibility {
  --sre-gold:      #f2b900;
  --sre-green:     #315926;
  --sre-mint:      #61ce70;
  --sre-black:     #0d0d0d;
  --sre-black2:    #111111;
  --sre-black3:    #1a1a1a;
  --sre-border:    #252525;
  --sre-muted:     #555555;
  --sre-font-body: 'Tajawal', sans-serif;
  --sre-font-title:'Bebas Neue', sans-serif;
}

/* ── Root container ── */
.rehab-accessibility {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999999;
  font-family: var(--sre-font-body);
  font-size: 14px;
  line-height: 1.4;
  box-sizing: border-box;
}

.rehab-accessibility *,
.rehab-accessibility *::before,
.rehab-accessibility *::after {
  box-sizing: border-box;
}

/* ── Trigger button ── */
.rehab-a11y__trigger {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--sre-black);
  border: 2px solid var(--sre-gold);
  border-radius: 50px;
  padding: 8px 10px;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, gap 0.25s ease, padding 0.25s ease;
  box-shadow: 0 4px 24px rgba(242,185,0,0.18);
}

.rehab-a11y__trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(242,185,0,0.28);
  gap: 10px;
  padding: 8px 16px 8px 10px;
}

.rehab-a11y__trigger::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50px;
  border: 1.5px solid var(--sre-gold);
  opacity: 0.3;
  animation: sre-pulse 2.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sre-pulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50%       { transform: scale(1.06); opacity: 0; }
}

.rehab-a11y__trigger-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sre-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rehab-a11y__trigger-icon svg {
  width: 24px;
  height: 24px;
  fill: var(--sre-black);
}

.rehab-a11y__trigger-name {
  font-family: var(--sre-font-title);
  font-size: 15px;
  letter-spacing: 1.5px;
  color: var(--sre-gold);
  line-height: 1;
  display: flex;
  flex-direction: column;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  transition: max-width 0.3s ease, opacity 0.25s ease;
}

.rehab-a11y__trigger:hover .rehab-a11y__trigger-name {
  max-width: 200px;
  opacity: 1;
}

.rehab-a11y__trigger-name small {
  font-family: var(--sre-font-body);
  font-size: 9px;
  color: var(--sre-mint);
  letter-spacing: 1px;
  font-weight: 700;
  margin-top: 2px;
}

/* Hide the SRE dot badge */
.rehab-a11y__trigger-badge {
  display: contents;
}

.rehab-a11y__trigger-dot {
  display: none;
}

/* ── Panel ── */
.rehab-a11y__panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 340px;
  max-height: min(520px, calc(100vh - 160px));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: var(--sre-black);
  border: 1.5px solid var(--sre-gold);
  border-radius: 20px;
  box-shadow: 0 16px 60px rgba(0,0,0,0.65), 0 0 0 1px rgba(242,185,0,0.08);
  animation: sre-panel-in 0.22s ease;
  /* Ensure scrollbar is visible when needed */
  scrollbar-width: thin;
  scrollbar-color: var(--sre-gold) transparent;
}

.rehab-a11y__panel::-webkit-scrollbar {
  width: 4px;
}

.rehab-a11y__panel::-webkit-scrollbar-track {
  background: transparent;
}

.rehab-a11y__panel::-webkit-scrollbar-thumb {
  background: var(--sre-gold);
  border-radius: 4px;
  opacity: 0.5;
}

/* WordPress admin bar compensation */
.admin-bar .rehab-a11y__panel {
  max-height: min(520px, calc(100vh - 192px));
}

.admin-bar .rehab-accessibility {
  bottom: 28px;
}

/* Panel in Arabic (RTL): open on LEFT side */
.rehab-a11y__panel[dir="rtl"] {
  right: auto;
  left: 28px;
}

@keyframes sre-panel-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Accent line ── */
.rehab-a11y__accent-line {
  height: 3px;
  background: linear-gradient(90deg, var(--sre-green) 0%, var(--sre-gold) 50%, var(--sre-mint) 100%);
}

/* ── Header ── */
.rehab-a11y__header {
  background: var(--sre-gold);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rehab-a11y__header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rehab-a11y__header-icon {
  width: 38px;
  height: 38px;
  background: var(--sre-black);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rehab-a11y__header-icon svg {
  width: 20px;
  height: 20px;
  fill: var(--sre-gold);
}

.rehab-a11y__title {
  font-family: var(--sre-font-title);
  font-size: 19px;
  letter-spacing: 2px;
  color: var(--sre-black);
  line-height: 1;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

.rehab-a11y__subtitle {
  font-size: 11px;
  color: var(--sre-green);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 3px 0 0;
}

.rehab-a11y__close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sre-black);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sre-gold);
  font-size: 16px;
  line-height: 1;
  transition: opacity 0.2s;
}

.rehab-a11y__close:hover { opacity: 0.7; }

/* ── Language strip ── */
.rehab-a11y__lang-strip {
  display: flex;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--sre-black3);
}

.rehab-a11y__lang-btn {
  flex: 1;
  padding: 7px 0;
  border-radius: 10px;
  border: 1.5px solid var(--sre-border);
  background: transparent;
  color: var(--sre-muted);
  font-family: var(--sre-font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
}

.rehab-a11y__lang-btn[aria-pressed="true"],
.rehab-a11y__lang-btn.is-active {
  background: var(--sre-green);
  border-color: var(--sre-green);
  color: var(--sre-mint);
}

.rehab-a11y__lang-btn:hover:not([aria-pressed="true"]):not(.is-active) {
  border-color: var(--sre-muted);
  color: #999;
}

/* ── Tools grid ── */
.rehab-a11y__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 16px;
}

.rehab-a11y__grid button {
  background: var(--sre-black2);
  border: 1.5px solid var(--sre-border);
  border-radius: 12px;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.18s;
  color: var(--sre-muted);
  font-family: var(--sre-font-body);
  font-size: 10px;
  text-align: center;
  line-height: 1.25;
}

.rehab-a11y__grid button:hover {
  border-color: var(--sre-gold);
  background: #1a1500;
  color: #aaa;
}

.rehab-a11y__grid button[aria-pressed="true"] {
  background: #1a1200;
  border-color: var(--sre-gold);
  color: var(--sre-gold);
}

.rehab-a11y__tool-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1e1e1e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sre-font-title);
  font-size: 11px;
  color: var(--sre-muted);
  transition: all 0.18s;
  flex-shrink: 0;
}

.rehab-a11y__grid button:hover .rehab-a11y__tool-icon {
  background: #2a2000;
  color: var(--sre-gold);
}

.rehab-a11y__grid button[aria-pressed="true"] .rehab-a11y__tool-icon {
  background: var(--sre-gold);
  color: var(--sre-black);
}

/* ── Font size row ── */
.rehab-a11y__font-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 16px 14px;
}

.rehab-a11y__font-label {
  font-family: var(--sre-font-title);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--sre-muted);
  flex-shrink: 0;
}

.rehab-a11y__font-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--sre-black2);
  border: 1.5px solid var(--sre-border);
  color: var(--sre-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
}

.rehab-a11y__font-btn:hover {
  border-color: var(--sre-gold);
  color: var(--sre-gold);
  background: #1a1500;
}

.rehab-a11y__font-bar {
  flex: 1;
  height: 4px;
  background: #1e1e1e;
  border-radius: 4px;
  overflow: hidden;
}

.rehab-a11y__font-fill {
  height: 100%;
  background: var(--sre-gold);
  border-radius: 4px;
  width: 0%;
  transition: width 0.25s ease;
}

.rehab-a11y__font-val {
  font-family: var(--sre-font-title);
  font-size: 15px;
  color: var(--sre-gold);
  min-width: 42px;
  text-align: right;
}

/* ── Footer ── */
.rehab-a11y__footer {
  padding: 0 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rehab-a11y__reset {
  background: transparent;
  border: 1.5px solid var(--sre-border);
  border-radius: 10px;
  padding: 7px 14px;
  color: var(--sre-muted);
  font-family: var(--sre-font-body);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s;
}

.rehab-a11y__reset:hover {
  border-color: #555;
  color: #888;
}

.rehab-a11y__by-tag {
  font-family: var(--sre-font-title);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--sre-gold);
  opacity: 0.55;
}

/* ── Reading guide ── */
.rehab-a11y__reading-guide {
  position: fixed;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--sre-gold);
  opacity: 0;
  pointer-events: none;
  z-index: 999998;
  top: -10px;
  transition: opacity 0.2s;
}

/* ── Font size — applied to <body> via JS to avoid WordPress overrides ── */
body.rehab-font-1,
body.rehab-font-1 p,
body.rehab-font-1 span,
body.rehab-font-1 li,
body.rehab-font-1 a,
body.rehab-font-1 div {
  font-size: 110% !important;
}

body.rehab-font-2,
body.rehab-font-2 p,
body.rehab-font-2 span,
body.rehab-font-2 li,
body.rehab-font-2 a,
body.rehab-font-2 div {
  font-size: 125% !important;
}

body.rehab-font-3,
body.rehab-font-3 p,
body.rehab-font-3 span,
body.rehab-font-3 li,
body.rehab-font-3 a,
body.rehab-font-3 div {
  font-size: 145% !important;
}

/* ── Protect the widget itself from font scaling ── */
body.rehab-font-1 #rehab-accessibility-root,
body.rehab-font-1 #rehab-accessibility-root p,
body.rehab-font-1 #rehab-accessibility-root span,
body.rehab-font-1 #rehab-accessibility-root li,
body.rehab-font-1 #rehab-accessibility-root a,
body.rehab-font-1 #rehab-accessibility-root div,
body.rehab-font-2 #rehab-accessibility-root,
body.rehab-font-2 #rehab-accessibility-root p,
body.rehab-font-2 #rehab-accessibility-root span,
body.rehab-font-2 #rehab-accessibility-root li,
body.rehab-font-2 #rehab-accessibility-root a,
body.rehab-font-2 #rehab-accessibility-root div,
body.rehab-font-3 #rehab-accessibility-root,
body.rehab-font-3 #rehab-accessibility-root p,
body.rehab-font-3 #rehab-accessibility-root span,
body.rehab-font-3 #rehab-accessibility-root li,
body.rehab-font-3 #rehab-accessibility-root a,
body.rehab-font-3 #rehab-accessibility-root div {
  font-size: revert !important;
}

/* Hard reset on ALL widget elements regardless of theme font overrides */
#rehab-accessibility-root,
#rehab-accessibility-root * {
  font-size: unset;
}

#rehab-accessibility-root .rehab-a11y__title    { font-size: 19px !important; }
#rehab-accessibility-root .rehab-a11y__subtitle { font-size: 11px !important; }
#rehab-accessibility-root .rehab-a11y__lang-btn { font-size: 13px !important; }
#rehab-accessibility-root .rehab-a11y__theme-btn { font-size: 18px !important; }
#rehab-accessibility-root .rehab-a11y__grid button { font-size: 10px !important; }
#rehab-accessibility-root .rehab-a11y__tool-icon { font-size: 11px !important; }
#rehab-accessibility-root .rehab-a11y__font-label { font-size: 11px !important; }
#rehab-accessibility-root .rehab-a11y__font-btn  { font-size: 18px !important; }
#rehab-accessibility-root .rehab-a11y__font-val  { font-size: 15px !important; }
#rehab-accessibility-root .rehab-a11y__reset     { font-size: 12px !important; }
#rehab-accessibility-root .rehab-a11y__by-tag    { font-size: 11px !important; }
#rehab-accessibility-root .rehab-a11y__trigger-name { font-size: 15px !important; }
#rehab-accessibility-root .rehab-a11y__trigger-name small { font-size: 9px !important; }
#rehab-accessibility-root .rehab-a11y__trigger-dot { display: none !important; }

/* ── Other features ── */
.rehab-line-height * { line-height: 2 !important; }

.rehab-letter-spacing p,
.rehab-letter-spacing span,
.rehab-letter-spacing li,
.rehab-letter-spacing a {
  letter-spacing: 0.12em !important;
}

.rehab-high-contrast  { filter: contrast(1.6) brightness(0.9); }
.rehab-light-contrast { filter: contrast(0.8) brightness(1.15); }
.rehab-grayscale      { filter: grayscale(1); }

.rehab-underline-links a {
  text-decoration: underline !important;
  text-decoration-color: var(--sre-gold) !important;
}

.rehab-big-cursor,
.rehab-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24'%3E%3Cpath fill='%23f2b900' stroke='%230d0d0d' stroke-width='1.5' d='M4 4l7.07 17 2.51-7.39L21 11.07z'/%3E%3C/svg%3E") 4 4, auto !important;
}

.rehab-pause-animations *,
.rehab-pause-animations *::before,
.rehab-pause-animations *::after {
  animation-play-state: paused !important;
  transition: none !important;
}

.rehab-hide-images img,
.rehab-hide-images video,
.rehab-hide-images figure {
  visibility: hidden !important;
}

.rehab-dyslexia-font,
.rehab-dyslexia-font * {
  font-family: 'Comic Sans MS', 'Comic Sans', cursive !important;
  letter-spacing: 0.05em;
  word-spacing: 0.1em;
}

.rehab-reading-guide .rehab-a11y__reading-guide {
  opacity: 1;
}

/* ── Screen reader ── */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Dark / Light mode toggle ── */
.rehab-a11y__theme-strip {
  display: flex;
  gap: 8px;
  padding: 0 16px 11px;
  border-bottom: 1px solid var(--sre-black3);
}

.rehab-a11y__theme-btn {
  width: 40px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--sre-border);
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.rehab-a11y__theme-btn[aria-pressed="true"],
.rehab-a11y__theme-btn.is-active {
  background: var(--sre-green);
  border-color: var(--sre-green);
}

.rehab-a11y__theme-btn:hover:not([aria-pressed="true"]):not(.is-active) {
  border-color: var(--sre-muted);
}

/* ── RTL: trigger aligns to LEFT to match panel ── */
html[data-rehab-language="ar"] .rehab-accessibility {
  right: auto;
  left: 28px;
}

html[data-rehab-language="ar"] .rehab-a11y__panel {
  right: auto;
  left: 28px;
}

/* ── Light mode (panel) ── */
.rehab-a11y__panel.sre-light-mode {
  --sre-black:   #ffffff;
  --sre-black2:  #f5f5f5;
  --sre-black3:  #e8e8e8;
  --sre-border:  #d0d0d0;
  --sre-muted:   #666666;
  background: var(--sre-black);
  border-color: var(--sre-gold);
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__lang-btn {
  color: var(--sre-muted);
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__lang-btn[aria-pressed="true"],
.rehab-a11y__panel.sre-light-mode .rehab-a11y__lang-btn.is-active {
  background: var(--sre-green);
  color: #fff;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__grid button {
  background: var(--sre-black2);
  border-color: var(--sre-border);
  color: #555;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__grid button:hover {
  background: #fffbe6;
  border-color: var(--sre-gold);
  color: #333;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__grid button[aria-pressed="true"] {
  background: #fff8cc;
  border-color: var(--sre-gold);
  color: #6a4a00;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__tool-icon {
  background: #e8e8e8;
  color: #555;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__grid button:hover .rehab-a11y__tool-icon {
  background: #ffe566;
  color: #333;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__grid button[aria-pressed="true"] .rehab-a11y__tool-icon {
  background: var(--sre-gold);
  color: var(--sre-black);
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__font-bar {
  background: #ddd;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__font-btn {
  background: var(--sre-black2);
  border-color: var(--sre-border);
  color: #555;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__font-btn:hover {
  background: #fffbe6;
  border-color: var(--sre-gold);
  color: #6a4a00;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__reset {
  background: var(--sre-black2);
  border-color: var(--sre-border);
  color: #555;
}

.rehab-a11y__panel.sre-light-mode .rehab-a11y__reset:hover {
  border-color: #999;
  color: #333;
}
