/* EmpowerHERment — Advanced Accessibility Toolkit CSS (WCAG 2.1 AAA Compliant) */

:root {
  --a11y-font-scale: 1;
  --a11y-line-height: inherit;
  --a11y-letter-spacing: normal;
  --a11y-word-spacing: normal;
}

body.a11y-scaled p, 
body.a11y-scaled li, 
body.a11y-scaled h1, 
body.a11y-scaled h2, 
body.a11y-scaled h3, 
body.a11y-scaled h4, 
body.a11y-scaled h5, 
body.a11y-scaled h6,
body.a11y-scaled span, 
body.a11y-scaled a, 
body.a11y-scaled td, 
body.a11y-scaled th, 
body.a11y-scaled label, 
body.a11y-scaled input, 
body.a11y-scaled textarea,
body.a11y-scaled button, 
body.a11y-scaled select,
body.a11y-scaled div {
  line-height: var(--a11y-line-height, inherit) !important;
  letter-spacing: var(--a11y-letter-spacing, normal) !important;
  word-spacing: var(--a11y-word-spacing, normal) !important;
}

/* Font Size Scales */
body.a11y-font-1 { font-size: 14px; }
body.a11y-font-2 { font-size: 16.5px; }
body.a11y-font-3 { font-size: 19px; }
body.a11y-font-4 { font-size: 22px; }

/* Dyslexic Font */
@import url('https://fonts.cdnfonts.com/css/opendyslexic');
body.a11y-dyslexic, body.a11y-dyslexic * {
  font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
}

/* High Contrast Mode */
body.a11y-high-contrast {
  background: #000000 !important;
  color: #FFFFFF !important;
}
body.a11y-high-contrast .card,
body.a11y-high-contrast .feed-card,
body.a11y-high-contrast .course-card,
body.a11y-high-contrast .product-card,
body.a11y-high-contrast .navbar,
body.a11y-high-contrast .admin-main,
body.a11y-high-contrast .sidebar {
  background: #0a0a0a !important;
  border: 2px solid #FFE600 !important;
  color: #FFFFFF !important;
  box-shadow: none !important;
}
body.a11y-high-contrast a,
body.a11y-high-contrast .gradient-text,
body.a11y-high-contrast h1,
body.a11y-high-contrast h2,
body.a11y-high-contrast h3,
body.a11y-high-contrast h4 {
  color: #FFE600 !important;
  -webkit-text-fill-color: #FFE600 !important;
}
body.a11y-high-contrast .btn-primary {
  background: #FFE600 !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border: 2px solid #FFE600 !important;
}
body.a11y-high-contrast .btn-outline {
  border: 2px solid #00FFFF !important;
  color: #00FFFF !important;
}
body.a11y-high-contrast p,
body.a11y-high-contrast span {
  color: #FFFFFF !important;
}

/* Peace Mode (Stop animations, calm colors) */
body.a11y-peace-mode * {
  animation: none !important;
  transition: none !important;
}
body.a11y-peace-mode .hero-orb,
body.a11y-peace-mode .hero-particles,
body.a11y-peace-mode .chat-btn-pulse {
  display: none !important;
}
body.a11y-peace-mode {
  background: #14161D !important;
  filter: saturate(80%);
}

/* Theme Filters */
body.a11y-theme-invert {
  filter: invert(100%) hue-rotate(180deg);
}
body.a11y-theme-invert img,
body.a11y-theme-invert video,
body.a11y-theme-invert .wk-a11y-fab,
body.a11y-theme-invert .wk-a11y-drawer,
body.a11y-theme-invert .ai-chat-panel,
body.a11y-theme-invert .ai-chat-btn {
  filter: invert(100%) hue-rotate(180deg);
}

body.a11y-theme-dark {
  background: #000000 !important;
  color: #E2E8F0 !important;
}
body.a11y-theme-light {
  background: #F8FAFC !important;
  color: #0F172A !important;
}
body.a11y-theme-light .card,
body.a11y-theme-light .course-card,
body.a11y-theme-light .product-card,
body.a11y-theme-light .feed-card {
  background: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  color: #0F172A !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06) !important;
}
body.a11y-theme-light h1,
body.a11y-theme-light h2,
body.a11y-theme-light h3,
body.a11y-theme-light h4,
body.a11y-theme-light p,
body.a11y-theme-light span {
  color: #1E293B !important;
}
body.a11y-theme-light .navbar {
  background: rgba(255,255,255,0.95) !important;
  border-bottom: 1px solid #E2E8F0 !important;
}
body.a11y-theme-light .nav-links a {
  color: #334155 !important;
}

body.a11y-theme-monochrome {
  filter: grayscale(100%);
}
body.a11y-theme-sepia {
  filter: sepia(70%) contrast(90%);
}

/* Color Blindness Filters */
body.a11y-cb-protanopia { filter: url('#a11y-filter-protanopia'); }
body.a11y-cb-deuteranopia { filter: url('#a11y-filter-deuteranopia'); }
body.a11y-cb-tritanopia { filter: url('#a11y-filter-tritanopia'); }
body.a11y-cb-achromatopsia { filter: grayscale(100%); }

/* Reading Line / Ruler */
#a11y-reading-ruler {
  position: fixed;
  left: 0;
  right: 0;
  height: 38px;
  background: rgba(245, 158, 11, 0.22);
  border-top: 2px solid #F59E0B;
  border-bottom: 2px solid #F59E0B;
  pointer-events: none;
  z-index: 99998;
  display: none;
  transform: translateY(-50%);
  box-shadow: 0 0 15px rgba(245,158,11,0.3);
}

/* Focus Mode Spotlight */
#a11y-focus-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99997;
  display: none;
  background: rgba(0, 0, 0, 0.75);
  mask: radial-gradient(circle 180px at var(--mouse-x, 50%) var(--mouse-y, 50%), transparent 0%, rgba(0,0,0,0.95) 100%);
  -webkit-mask: radial-gradient(circle 180px at var(--mouse-x, 50%) var(--mouse-y, 50%), transparent 0%, rgba(0,0,0,0.95) 100%);
}

/* Glossary Tooltips */
.a11y-glossary-term {
  border-bottom: 2px dashed #F59E0B;
  cursor: help;
  position: relative;
  font-weight: 600;
  color: #FCD34D !important;
}
.a11y-glossary-term:hover::after {
  content: attr(data-definition);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #181028;
  color: #F8F5FF;
  border: 1px solid #7C3AED;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-size: 0.78rem;
  white-space: normal;
  width: 220px;
  z-index: 10000;
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
  pointer-events: none;
  line-height: 1.4;
}

/* Floating Magnifier */
#a11y-magnifier-lens {
  position: fixed;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px solid #7C3AED;
  box-shadow: 0 0 25px rgba(0,0,0,0.8), inset 0 0 15px rgba(124,58,237,0.3);
  pointer-events: none;
  z-index: 99998;
  display: none;
  transform: translate(-50%, -50%);
  overflow: hidden;
  background: rgba(19, 11, 36, 0.95);
  backdrop-filter: blur(1px);
}

/* TTS Floating Controller */
#a11y-tts-bar {
  position: fixed;
  top: 80px;
  right: 24px;
  background: #130B24;
  border: 1px solid #7C3AED;
  border-radius: 50px;
  padding: 0.5rem 1rem;
  display: none;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  z-index: 99999;
}
#a11y-tts-bar button {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
}
#a11y-tts-bar button:hover {
  background: #7C3AED;
}
.a11y-tts-highlight {
  background: rgba(245, 158, 11, 0.35) !important;
  outline: 2px solid #F59E0B !important;
  border-radius: 4px;
}

/* ===== ACCESSIBILITY FAB BUTTON ===== */
.wk-a11y-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
  color: #FFFFFF;
  border: 2px solid #F59E0B;
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  z-index: 99995;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
}
.wk-a11y-fab:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 35px rgba(124, 58, 237, 0.65);
}
.wk-a11y-fab:focus-visible {
  outline: 3px solid #FFE600;
  outline-offset: 3px;
}

/* Navbar Accessibility Button */
.btn-nav-a11y {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(124, 58, 237, 0.15);
  color: #C4B5FD;
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-nav-a11y:hover {
  background: linear-gradient(135deg, #7C3AED, #EC4899);
  color: #FFFFFF;
  border-color: transparent;
  transform: translateY(-1px);
}

/* ===== ACCESSIBILITY DRAWER ===== */
.wk-a11y-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.wk-a11y-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.wk-a11y-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 375px;
  max-width: 90vw;
  background: #0E0818;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -10px 0 50px rgba(0, 0, 0, 0.8);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  color: #F8F5FF;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.wk-a11y-drawer.open {
  transform: translateX(0);
}

/* Drawer Header */
.wk-a11y-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #180D30 0%, #0F0920 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wk-a11y-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.wk-a11y-header-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7C3AED, #3B82F6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  box-shadow: 0 4px 15px rgba(124,58,237,0.4);
}
.wk-a11y-header-text h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
  color: #F8F5FF;
}
.wk-a11y-header-text span {
  font-size: 0.72rem;
  font-weight: 700;
  color: #F59E0B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.wk-a11y-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #F8F5FF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}
.wk-a11y-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #EF4444;
  color: #FCA5A5;
}

/* Drawer Body */
.wk-a11y-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.wk-a11y-body::-webkit-scrollbar {
  width: 6px;
}
.wk-a11y-body::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.3);
  border-radius: 3px;
}

/* Section Groups */
.wk-a11y-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #F59E0B;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Segmented Buttons for Font Size */
.wk-a11y-font-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.wk-a11y-font-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.6rem 0.2rem;
  color: #F8F5FF;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  font-family: inherit;
}
.wk-a11y-font-btn .letter-preview {
  font-weight: 800;
  display: block;
  margin-bottom: 0.2rem;
}
.wk-a11y-font-btn .size-label {
  font-size: 0.68rem;
  color: rgba(248, 245, 255, 0.55);
}
.wk-a11y-font-btn:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.4);
}
.wk-a11y-font-btn.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(236,72,153,0.3));
  border-color: #7C3AED;
  box-shadow: 0 0 15px rgba(124,58,237,0.3);
}
.wk-a11y-font-btn.active .letter-preview {
  color: #F59E0B;
}

/* Item Action Rows */
.wk-a11y-item-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #F8F5FF;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.wk-a11y-item-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(124, 58, 237, 0.3);
}
.wk-a11y-item-btn.active {
  background: rgba(124, 58, 237, 0.16);
  border-color: #7C3AED;
}
.wk-a11y-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.wk-a11y-item-icon {
  font-size: 1.05rem;
  color: #A78BFA;
  width: 24px;
  text-align: center;
}
.wk-a11y-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 245, 255, 0.65);
}
.wk-a11y-item-btn.active .wk-a11y-badge {
  background: #7C3AED;
  color: #FFFFFF;
}

/* Drawer Footer */
.wk-a11y-footer {
  padding: 1rem 1.5rem;
  background: rgba(13, 8, 21, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.wk-a11y-reset-btn {
  width: 100%;
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #FCA5A5;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
  font-family: inherit;
}
.wk-a11y-reset-btn:hover {
  background: #EF4444;
  color: #FFFFFF;
}
