/* ==========================================================================
   Satwik Research - Accessibility Engine & GIGW / IS 17802 Styles
   ========================================================================== */

/* High Contrast Mode: Yellow on Black (NVDA & Low Vision Preferred) */
body.theme-yellow-black {
  background-color: #000000 !important;
  color: #ffff00 !important;
}

body.theme-yellow-black *,
body.theme-yellow-black a,
body.theme-yellow-black button,
body.theme-yellow-black input,
body.theme-yellow-black select,
body.theme-yellow-black textarea,
body.theme-yellow-black h1,
body.theme-yellow-black h2,
body.theme-yellow-black h3,
body.theme-yellow-black h4,
body.theme-yellow-black p,
body.theme-yellow-black span {
  background-color: #000000 !important;
  color: #ffff00 !important;
  border-color: #ffff00 !important;
}

body.theme-yellow-black a {
  text-decoration: underline !important;
}

body.theme-yellow-black :focus-visible {
  outline: 4px solid #ffffff !important;
  outline-offset: 4px !important;
}

/* High Contrast Mode: Blue on White / Navy Theme */
body.theme-blue-white {
  background-color: #031b4e !important;
  color: #ffffff !important;
}

body.theme-blue-white *,
body.theme-blue-white a,
body.theme-blue-white button,
body.theme-blue-white input,
body.theme-blue-white h1,
body.theme-blue-white h2,
body.theme-blue-white h3,
body.theme-blue-white p {
  background-color: #031b4e !important;
  color: #ffffff !important;
  border-color: #ffffff !important;
}

/* Dark Theme */
body.theme-dark {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

body.theme-dark .main-header,
body.theme-dark .card,
body.theme-dark .table-responsive,
body.theme-dark .form-control {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

body.theme-dark .section-title,
body.theme-dark .card-title,
body.theme-dark .form-label,
body.theme-dark .nav-link {
  color: #ffffff !important;
}

body.theme-dark .nav-link:hover,
body.theme-dark .nav-link.active {
  background-color: #334155 !important;
  color: #60a5fa !important;
}

/* Grayscale Mode */
body.theme-grayscale {
  filter: grayscale(100%) !important;
}

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

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

/* OpenDyslexic / Dyslexia-Friendly Font Override */
body.font-dyslexic {
  font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
  letter-spacing: 0.05em !important;
  word-spacing: 0.1em !important;
  line-height: 1.8 !important;
}

/* Link Highlighting */
body.highlight-links a {
  background-color: #fef08a !important;
  color: #000000 !important;
  font-weight: bold !important;
  text-decoration: underline !important;
  padding: 0 4px !important;
  border-radius: 2px !important;
}

body.theme-dark.highlight-links a,
body.theme-yellow-black.highlight-links a {
  background-color: #ffff00 !important;
  color: #000000 !important;
}

/* Enhanced Focus Outline */
body.enhanced-focus :focus-visible {
  outline: 5px solid #ec4899 !important;
  outline-offset: 5px !important;
  box-shadow: 0 0 15px #ec4899 !important;
}

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

/* Reading Guide Line */
#reading-guide-line {
  position: fixed;
  left: 0;
  width: 100%;
  height: 6px;
  background-color: #dc2626;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.8);
  pointer-events: none;
  z-index: 999999;
  display: none;
}

body.show-reading-guide #reading-guide-line {
  display: block;
}

/* Floating Accessibility Widget Button */
.a11y-widget-trigger {
  position: fixed;
  bottom: max(1.5rem, env(safe-area-inset-bottom, 1.5rem));
  right: max(1.5rem, env(safe-area-inset-right, 1.5rem));
  z-index: 9999;
  background: var(--brand-blue);
  color: #ffffff;
  border: 3px solid #ffffff;
  border-radius: var(--radius-full);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, background-color 0.2s ease;
  touch-action: manipulation;
}

.a11y-widget-trigger:hover,
.a11y-widget-trigger:focus {
  transform: scale(1.08);
  background: #0f172a;
}

.a11y-widget-trigger svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

@media (max-width: 768px) {
  .a11y-widget-trigger {
    bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    right: max(1rem, env(safe-area-inset-right, 1rem));
    width: 48px;
    height: 48px;
    border-width: 2px;
  }
  .a11y-widget-trigger svg {
    width: 24px;
    height: 24px;
  }
}

/* Modal Overlay & Drawer */
.a11y-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  display: flex;
  justify-content: flex-end;
}

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

.a11y-modal-dialog {
  width: 100%;
  max-width: 440px;
  height: 100%;
  background: #ffffff;
  color: #0f172a;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
  .a11y-modal-dialog {
    max-width: 100vw;
    width: 100vw;
  }
}

.a11y-modal-backdrop.active .a11y-modal-dialog {
  transform: translateX(0);
}

.a11y-modal-header {
  background: #0f172a;
  color: #ffffff;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--accent-color);
}

.a11y-modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.a11y-modal-close {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast);
}

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

.a11y-modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (max-width: 480px) {
  .a11y-modal-body {
    padding: 1.25rem 1rem;
    gap: 1.25rem;
  }
}

.a11y-group-title {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-color);
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.a11y-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (max-width: 360px) {
  .a11y-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

.a11y-btn {
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  color: #0f172a;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 48px;
  touch-action: manipulation;
}

.a11y-btn:hover,
.a11y-btn:focus {
  background: #e2e8f0;
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.a11y-btn.active {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
}

.a11y-btn-reset {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
  margin-top: 1rem;
  width: 100%;
}

.a11y-btn-reset:hover,
.a11y-btn-reset:focus {
  background: #dc2626;
  color: #ffffff;
}
