/* ============================================
   ADA Accessibility Widget
   Holiday Motor Coach
   ============================================ */

/* ---------- Widget Toggle Button (Vertical Tab) ---------- */
.ada-widget-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 36px;
  height: auto;
  padding: 12px 8px;
  background: var(--hmc-blue-primary);
  color: white;
  border: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  z-index: 9998;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.ada-widget-toggle:hover {
  background: var(--hmc-blue-dark);
  width: 42px;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.3);
}

.ada-widget-toggle:focus {
  outline: none;
}

.ada-widget-toggle:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: -4px;
}

.ada-widget-toggle svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.ada-widget-toggle-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ada-widget-toggle[aria-expanded="true"] {
  background: var(--hmc-slate);
}

/* ---------- Widget Panel ---------- */
.ada-widget-panel {
  position: fixed;
  top: 50%;
  right: 46px;
  transform: translateY(-50%) translateX(20px);
  width: 320px;
  max-height: 90vh;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.ada-widget-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* ---------- Panel Header ---------- */
.ada-widget-header {
  background: linear-gradient(135deg, var(--hmc-blue-primary) 0%, var(--hmc-blue-dark) 100%);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ada-widget-header h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ada-widget-header h3 svg {
  width: 20px;
  height: 20px;
}

.ada-widget-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.ada-widget-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ada-widget-close:focus {
  outline: none;
}

.ada-widget-close:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.ada-widget-close svg {
  width: 20px;
  height: 20px;
}

/* ---------- Panel Body ---------- */
.ada-widget-body {
  padding: 1rem 1.25rem;
}

/* ---------- Control Groups ---------- */
.ada-control-group {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}

.ada-control-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.ada-control-label {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ada-control-label svg {
  width: 18px;
  height: 18px;
  color: var(--hmc-blue-primary);
}

/* ---------- Font Size Control ---------- */
.ada-font-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ada-font-btn {
  width: 40px;
  height: 40px;
  border: 2px solid var(--gray-200);
  background: var(--white);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--gray-700);
  transition: all 0.2s ease;
}

.ada-font-btn:hover {
  border-color: var(--hmc-blue-primary);
  color: var(--hmc-blue-primary);
}

.ada-font-btn:focus {
  outline: none;
}

.ada-font-btn:focus-visible {
  outline: 2px solid var(--hmc-blue-primary);
  outline-offset: 2px;
}

.ada-font-btn--decrease {
  font-size: 1rem;
}

.ada-font-btn--increase {
  font-size: 1.25rem;
}

.ada-font-display {
  flex: 1;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-50);
  padding: 0.5rem;
  border-radius: 6px;
}

/* ---------- Toggle Switches ---------- */
.ada-toggle-group {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.ada-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ada-toggle-text {
  font-size: 0.875rem;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ada-toggle-text svg {
  width: 16px;
  height: 16px;
  color: var(--gray-400);
}

/* Custom Toggle Switch */
.ada-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.ada-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ada-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--gray-300);
  border-radius: 26px;
  transition: all 0.3s ease;
}

.ada-switch-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ada-switch input:checked + .ada-switch-slider {
  background-color: var(--hmc-blue-primary);
}

.ada-switch input:checked + .ada-switch-slider::before {
  transform: translateX(22px);
}

.ada-switch input:focus + .ada-switch-slider {
  box-shadow: none;
}

.ada-switch input:focus-visible + .ada-switch-slider {
  box-shadow: 0 0 0 3px rgba(41, 82, 163, 0.3);
}

/* ---------- Reset Button ---------- */
.ada-reset-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.ada-reset-btn:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.ada-reset-btn:focus {
  outline: none;
}

.ada-reset-btn:focus-visible {
  outline: 2px solid var(--hmc-blue-primary);
  outline-offset: 2px;
}

.ada-reset-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- Panel Footer ---------- */
.ada-widget-footer {
  padding: 0.75rem 1.25rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
}

.ada-widget-footer a {
  font-size: 0.75rem;
  color: var(--hmc-blue-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ada-widget-footer a:hover {
  text-decoration: underline;
}

/* ---------- Accessibility Styles Applied to Body ---------- */

/* High Contrast Mode */
body.ada-high-contrast {
  background: #ffffff !important;
}

/* Light sections - dark text */
body.ada-high-contrast p,
body.ada-high-contrast span,
body.ada-high-contrast li,
body.ada-high-contrast td,
body.ada-high-contrast th,
body.ada-high-contrast h1,
body.ada-high-contrast h2,
body.ada-high-contrast h3,
body.ada-high-contrast h4,
body.ada-high-contrast h5,
body.ada-high-contrast h6 {
  color: #000000 !important;
}

/* Links in light sections */
body.ada-high-contrast a {
  color: #0000cc !important;
  text-decoration: underline !important;
}

body.ada-high-contrast a:hover {
  color: #0000ff !important;
}

/* Dark sections - header */
body.ada-high-contrast .header {
  background: #000000 !important;
}

body.ada-high-contrast .header .nav-link {
  color: #ffffff !important;
  text-decoration: none !important;
}

body.ada-high-contrast .header .nav-link:hover {
  color: #ffff00 !important;
}

/* Dark sections - footer */
body.ada-high-contrast .footer {
  background: #000000 !important;
}

body.ada-high-contrast .footer,
body.ada-high-contrast .footer p,
body.ada-high-contrast .footer span,
body.ada-high-contrast .footer li,
body.ada-high-contrast .footer h4,
body.ada-high-contrast .footer-heading,
body.ada-high-contrast .contact-label {
  color: #ffffff !important;
}

body.ada-high-contrast .footer a {
  color: #ffff00 !important;
  text-decoration: underline !important;
}

body.ada-high-contrast .footer a:hover {
  color: #ffffff !important;
}

/* Hero section */
body.ada-high-contrast .hero-overlay {
  background: rgba(0, 0, 0, 0.85) !important;
}

body.ada-high-contrast .hero h1,
body.ada-high-contrast .hero p,
body.ada-high-contrast .hero-subtitle {
  color: #ffffff !important;
}

/* Buttons */
body.ada-high-contrast .btn-primary {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

body.ada-high-contrast .btn-primary:hover {
  background: #ffffff !important;
  color: #000000 !important;
}

body.ada-high-contrast .btn-outline {
  border: 2px solid #000000 !important;
  color: #000000 !important;
}

/* Cards and sections */
body.ada-high-contrast .section {
  background: #ffffff !important;
}

body.ada-high-contrast .action-card,
body.ada-high-contrast .card {
  border: 2px solid #000000 !important;
}

/* Modals */
body.ada-high-contrast .modal {
  background: #ffffff !important;
  border: 2px solid #000000 !important;
}

body.ada-high-contrast .modal-header-content h2,
body.ada-high-contrast .modal-header-content p,
body.ada-high-contrast .carousel-content h2,
body.ada-high-contrast .carousel-content p {
  color: #ffffff !important;
}

/* Form inputs */
body.ada-high-contrast input,
body.ada-high-contrast select,
body.ada-high-contrast textarea {
  background: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
}

/* Highlight Links */
body.ada-highlight-links a {
  background: linear-gradient(to bottom, transparent 60%, #ffeb3b 60%) !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
}

body.ada-highlight-links a:hover {
  background: #ffeb3b !important;
}

/* Don't highlight links in dark sections - use yellow text instead */
body.ada-highlight-links .header a,
body.ada-highlight-links .footer a {
  background: transparent !important;
  color: #ffff00 !important;
}

body.ada-highlight-links .header a:hover,
body.ada-highlight-links .footer a:hover {
  background: #ffff00 !important;
  color: #000000 !important;
}

/* Increased Text Spacing */
body.ada-text-spacing {
  letter-spacing: 0.05em;
  word-spacing: 0.15em;
  line-height: 1.9;
}

body.ada-text-spacing p,
body.ada-text-spacing li,
body.ada-text-spacing span {
  letter-spacing: 0.05em;
  word-spacing: 0.15em;
  line-height: 1.9;
}

/* Large Cursor */
body.ada-large-cursor,
body.ada-large-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='black' stroke='white' stroke-width='1' d='M5 2 L5 28 L12 21 L18 30 L22 28 L16 19 L26 19 Z'/%3E%3C/svg%3E") 0 0, auto !important;
}

/* Focus Indicator Enhancement */
body.ada-focus-indicator *:focus {
  outline: 3px solid #0000cc !important;
  outline-offset: 3px !important;
}

/* ---------- Protect ADA Widget from Accessibility Modes ---------- */
/* Widget should always look the same regardless of accessibility settings */
.ada-widget-toggle,
.ada-widget-panel,
body.ada-high-contrast .ada-widget-toggle,
body.ada-high-contrast .ada-widget-panel {
  filter: none !important;
}

body.ada-high-contrast .ada-widget-panel,
body.ada-high-contrast .ada-widget-body {
  background: #ffffff !important;
}

body.ada-high-contrast .ada-widget-header {
  background: linear-gradient(135deg, #2952a3 0%, #1a3a6e 100%) !important;
}

body.ada-high-contrast .ada-widget-header h3,
body.ada-high-contrast .ada-widget-close {
  color: #ffffff !important;
}

body.ada-high-contrast .ada-control-label {
  color: #1e293b !important;
}

body.ada-high-contrast .ada-toggle-text {
  color: #334155 !important;
}

body.ada-high-contrast .ada-widget-footer a {
  color: #2952a3 !important;
  text-decoration: none !important;
}

body.ada-highlight-links .ada-widget-panel a {
  background: transparent !important;
  text-decoration: none !important;
}

body.ada-focus-indicator .ada-widget-panel *:focus,
body.ada-focus-indicator .ada-widget-toggle:focus {
  outline: none !important;
}

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 768px) {
  /* Hide vertical tab on mobile - header button replaces it */
  .ada-widget-toggle {
    display: none !important;
  }
  
  /* Reposition panel for mobile - drop down from top right */
  /* !important needed to override inline styles set by createWidget() */
  .ada-widget-panel {
    top: 70px !important;
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
    max-height: calc(100vh - 90px) !important;
    transform: translateY(-20px) !important;
  }
  
  .ada-widget-panel.active {
    transform: translateY(0) !important;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .ada-widget-toggle,
  .ada-widget-panel,
  .ada-switch-slider,
  .ada-switch-slider::before {
    transition: none;
  }
}
