/* Accessibility Tools Styles */

/* --- Variables --- */
:root {
  --a11y-bg-color: #000000;
  --a11y-text-color: #ffff00;
  --a11y-link-color: #00ffff;
  --a11y-btn-color: #ffff00;
  --a11y-border-color: #ffffff;
}

/* --- High Contrast Mode --- */
body.a11y-high-contrast {
  background-color: var(--a11y-bg-color) !important;
  color: var(--a11y-text-color) !important;
}

body.a11y-high-contrast * {
  background-color: var(--a11y-bg-color) !important;
  color: var(--a11y-text-color) !important;
  border-color: var(--a11y-border-color) !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

body.a11y-high-contrast a,
body.a11y-high-contrast a:hover,
body.a11y-high-contrast a:visited {
  color: var(--a11y-link-color) !important;
  text-decoration: underline !important;
}

body.a11y-high-contrast img {
  filter: grayscale(100%) contrast(120%);
}

body.a11y-high-contrast .btn,
body.a11y-high-contrast button {
  background-color: #333 !important;
  color: var(--a11y-btn-color) !important;
  border: 2px solid var(--a11y-btn-color) !important;
}

/* --- Font Size Adjustment --- */
/* Base font size increase on root */
html.a11y-font-increase-1 {
  font-size: 110% !important;
}

html.a11y-font-increase-2 {
  font-size: 125% !important;
}

html.a11y-font-increase-3 {
  font-size: 140% !important;
}

/* --- Spacing Adjustment --- */
body.a11y-spacing * {
  line-height: 1.8 !important;
  letter-spacing: 0.1em !important;
  word-spacing: 0.2em !important;
}

body.a11y-spacing p {
  margin-bottom: 2em !important;
}

/* --- Accessibility Focus Indicators --- */
body.a11y-focus-visible *:focus {
  outline: 3px solid #ffd700 !important;
  outline-offset: 3px !important;
}

/* --- Accessibility Widget UI --- */
#a11y-widget-trigger {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background-color: #0d6efd; /* Bootstrap Primary Default - can override */
  color: #fff;
  border: none;
  border-radius: 5px 0 0 5px;
  padding: 10px 15px;
  font-size: 24px;
  z-index: 9999;
  cursor: pointer;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.2);
  transition: right 0.3s ease;
}

#a11y-widget-trigger:hover {
  right: -5px; /* Subtle bounce */
}

#a11y-toolbar {
  position: fixed;
  top: 50%;
  right: -320px; /* Hidden by default */
  transform: translateY(-50%);
  width: 300px;
  background-color: #fff;
  border-left: 5px solid #0d6efd;
  box-shadow: -5px 5px 20px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  padding: 20px;
  transition: right 0.3s ease;
  border-radius: 10px 0 0 10px;
  color: #333;
}

#a11y-toolbar.open {
  right: 0;
}

#a11y-toolbar .a11y-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

#a11y-toolbar h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #333;
}

#a11y-toolbar .close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

#a11y-toolbar .a11y-section {
  margin-bottom: 20px;
}

#a11y-toolbar h4 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: #555;
  font-weight: 600;
}

#a11y-toolbar .a11y-btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#a11y-toolbar .a11y-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  background-color: #f8f9fa;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s;
}

#a11y-toolbar .a11y-btn:hover {
  background-color: #e9ecef;
}

#a11y-toolbar .a11y-btn.active {
  background-color: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

#a11y-toolbar .a11y-btn i {
  font-size: 1.2rem;
}

/* High Contrast Adjustments for Widget */
body.a11y-high-contrast #a11y-toolbar {
  background-color: #000;
  border-color: #fff;
  border-left: 5px solid #ffff00;
}

body.a11y-high-contrast #a11y-toolbar h3,
body.a11y-high-contrast #a11y-toolbar h4,
body.a11y-high-contrast #a11y-toolbar .close-btn {
  color: #ffff00;
}

body.a11y-high-contrast #a11y-toolbar .a11y-btn {
  background-color: #333;
  color: #ffff00;
  border-color: #fff;
}

body.a11y-high-contrast #a11y-toolbar .a11y-btn.active {
  background-color: #ffff00;
  color: #000;
  border-color: #fff;
}
