/* Custom CSS for AssetFlow Website */

/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --secondary: #10B981;
  --accent: #F59E0B;
  --background: #F9FAFB;
  --text: #111827;
  --text-light: #6B7280;
  --border: #E5E7EB;
}

/* Base styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Heebo', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* English font override */
html[lang="en"] body {
  font-family: 'Inter', sans-serif;
}

/* RTL support */
[dir="rtl"] {
  direction: rtl;
}

[dir="ltr"] {
  direction: ltr;
}

/* Prose styles for blog content */
.prose {
  max-width: 65ch;
  color: var(--text);
  line-height: 1.75;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 700;
  line-height: 1.25;
  margin-top: 2em;
  margin-bottom: 1em;
}

.prose h1 { font-size: 2.25em; }
.prose h2 { font-size: 1.875em; }
.prose h3 { font-size: 1.5em; }
.prose h4 { font-size: 1.25em; }

.prose p {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
}

.prose a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose a:hover {
  color: var(--primary-dark);
}

.prose ul, .prose ol {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-left: 1.625em;
}

[dir="rtl"] .prose ul, [dir="rtl"] .prose ol {
  padding-left: 0;
  padding-right: 1.625em;
}

.prose li {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.prose code {
  background-color: #F3F4F6;
  border-radius: 0.25rem;
  padding: 0.125rem 0.25rem;
  font-size: 0.875em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.prose pre {
  background-color: #1F2937;
  border-radius: 0.5rem;
  color: #F9FAFB;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
  overflow-x: auto;
  padding: 1rem;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

.prose pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

.prose blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1rem;
  font-style: italic;
  color: var(--text-light);
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

[dir="rtl"] .prose blockquote {
  border-left: none;
  border-right: 4px solid var(--primary);
  padding-left: 0;
  padding-right: 1rem;
}

.prose img {
  border-radius: 0.5rem;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
  max-width: 100%;
  height: auto;
}

/* Toast animations */
@keyframes slideIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

[dir="ltr"] @keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

[dir="ltr"] @keyframes slideOut {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

/* Mobile menu transition */
#mobile-menu {
  transition: max-height 0.3s ease-in-out;
  max-height: 0;
  overflow: hidden;
}

#mobile-menu.show {
  max-height: 500px;
}

/* Loading spinner */
.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  header, footer, #comments, #comment-form {
    display: none;
  }

  .prose {
    max-width: 100%;
  }
}

/* Toast notification animations */
@keyframes slideIn {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100px);
    opacity: 0;
  }
}

/* ========================================
   ACCESSIBILITY TOOLBAR STYLES
   WCAG 2.0 AA & IS 5568 Compliant
   ======================================== */

/* Accessibility Variables */
:root {
  --a11y-font-size: 100%;
  --a11y-line-height: 1.5;
  --a11y-letter-spacing: normal;
  --a11y-word-spacing: normal;
}

/* Skip to Main Content Link */
.a11y-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  font-weight: 600;
  transition: top 0.3s ease;
}

.a11y-skip-link:focus {
  top: 0;
}

/* Accessibility Toolbar Container - Draggable */
.a11y-toolbar {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
  touch-action: none;
}

/* Visual drag indicator - dotted border on hover */
.a11y-toolbar:hover {
  box-shadow: 0 -4px 16px rgba(79, 70, 229, 0.3);
  border-color: var(--primary-dark);
}

.a11y-toolbar.dragging {
  opacity: 0.8;
  cursor: move;
  user-select: none;
  transition: none;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  border-style: dashed;
}

/* Drag handle indicator on toggle button */
.a11y-toggle-btn {
  cursor: grab;
  position: relative;
}

.a11y-toggle-btn:active {
  cursor: grabbing;
}

/* Add a small drag handle hint */
.a11y-toggle-btn::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.a11y-toolbar:hover .a11y-toggle-btn::before {
  opacity: 1;
}

/* Dismissed state - completely hidden including toggle button */
.a11y-toolbar.a11y-dismissed {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

[dir="rtl"] .a11y-toolbar {
  left: auto;
  right: 20px;
}

/* Toggle Button */
.a11y-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  width: 100%;
  transition: background 0.3s ease;
}

.a11y-toggle-btn:hover,
.a11y-toggle-btn:focus {
  background: var(--primary-dark);
}

.a11y-toggle-btn[aria-expanded="true"] {
  border-radius: 8px 8px 0 0;
}

.a11y-icon {
  width: 18px;
  height: 18px;
}

/* Toolbar Panel */
.a11y-panel {
  padding: 18px;
  max-width: 320px;
  max-height: 70vh;
  overflow-y: auto;
  border-radius: 0 0 8px 8px;
  margin-top: -2px;
}

/* Hide panel when hidden attribute is present */
.a11y-panel[hidden] {
  display: none !important;
}

.a11y-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

/* Close Button */
.a11y-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  padding: 4px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
  z-index: 1;
}

[dir="rtl"] .a11y-close-btn {
  right: auto;
  left: 12px;
}

.a11y-close-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.a11y-close-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.a11y-close-btn svg {
  width: 20px;
  height: 20px;
}

/* Dismiss Controls */
.a11y-dismiss-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.a11y-dismiss-label {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
}

.a11y-dismiss-actions {
  display: flex;
  gap: 8px;
}

.a11y-dismiss-btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.a11y-dismiss-btn:hover {
  background: #e5e7eb;
}

/* Restore button (shown when toolbar is dismissed) */
.a11y-restore-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9998;
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: none;
  align-items: center;
  gap: 6px;
  animation: slideUp 0.3s ease;
}

[dir="rtl"] .a11y-restore-btn {
  left: auto;
  right: 20px;
}

.a11y-restore-btn:hover {
  background: var(--primary-dark);
}

.a11y-restore-btn.visible {
  display: flex;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Control Groups */
.a11y-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.a11y-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.a11y-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ================================
   NEW COMPACT LAYOUT (3 buttons per row)
   ================================ */

/* Section Labels - separate sections */
.a11y-section-label {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  padding: 12px 0 6px 0;
  margin-top: 8px;
}

.a11y-section-label:first-child {
  margin-top: 0;
  padding-top: 0;
}

/* Row Layout - 3 buttons per row */
.a11y-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.a11y-row:last-child {
  margin-bottom: 0;
}

/* Compact buttons for row layout */
.a11y-btn-compact {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px;
  justify-content: center;
}

.a11y-btn-compact svg {
  width: 22px;
  height: 22px;
}

.a11y-btn-compact .a11y-font-preview,
.a11y-btn-compact .a11y-dir-text {
  font-size: 14px;
  font-weight: 700;
}

/* Reset section */
.a11y-reset-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

/* ================================
   END NEW COMPACT LAYOUT
   ================================ */

/* Links controls - side by side smaller buttons */
.a11y-links-controls {
  gap: 6px;
}

/* Smaller buttons for links */
.a11y-btn-small {
  min-width: 36px;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
  flex: 1;
}

.a11y-btn-small svg {
  width: 16px;
  height: 16px;
}

/* Accessibility Buttons */
.a11y-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.2s ease;
}

.a11y-btn:hover,
.a11y-btn:focus {
  background: #f1f5f9;
  border-color: #cbd5e1;
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.a11y-btn:active {
  transform: translateY(0);
}

.a11y-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Toggle button active state */
.a11y-btn[aria-pressed="true"] {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary-dark) !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.a11y-btn[aria-pressed="true"]:hover,
.a11y-btn[aria-pressed="true"]:focus {
  background: var(--primary-dark) !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}

.a11y-btn svg {
  width: 20px;
  height: 20px;
}

.a11y-font-preview {
  font-size: 16px;
  font-weight: 600;
}

.a11y-dir-text {
  font-size: 13px;
  font-weight: 600;
}

/* Active/Toggled States */
.a11y-toggle-btn-contrast[aria-pressed="true"],
.a11y-toggle-btn-sr[aria-pressed="true"],
.a11y-dir-btn[aria-pressed="true"] {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
}

.a11y-toggle-btn-contrast[aria-pressed="true"]:hover,
.a11y-toggle-btn-sr[aria-pressed="true"]:hover,
.a11y-dir-btn[aria-pressed="true"]:hover {
  background: var(--primary-dark);
}

/* Reset Button */
.a11y-reset-group {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.a11y-reset-btn {
  width: 100%;
  background: #fee2e2;
  color: #dc2626;
  font-weight: 600;
}

.a11y-reset-btn:hover,
.a11y-reset-btn:focus {
  background: #fecaca;
}

.a11y-reset-icon {
  width: 18px;
  height: 18px;
}

/* ========================================
   ACCESSIBILITY MODES
   ======================================== */

/* Font Size Adjustments */
body.a11y-font-smallest {
  font-size: 85%;
}

body.a11y-font-small {
  font-size: 92%;
}

body.a11y-font-normal {
  font-size: 100%;
}

body.a11y-font-large {
  font-size: 120%;
}

body.a11y-font-largest {
  font-size: 150%;
}

/* Line Spacing Adjustments */
body.a11y-spacing-tight {
  --a11y-line-height: 1.25;
}

body.a11y-spacing-normal {
  --a11y-line-height: 1.5;
}

body.a11y-spacing-relaxed {
  --a11y-line-height: 1.75;
}

body.a11y-spacing-loose {
  --a11y-line-height: 2;
}

/* Apply line spacing to page content - EXCLUDE toolbar and restore button */
body.a11y-spacing-tight main,
body.a11y-spacing-tight article,
body.a11y-spacing-tight section,
body.a11y-spacing-tight .prose,
body.a11y-spacing-tight .prose *,
body.a11y-spacing-relaxed main,
body.a11y-spacing-relaxed article,
body.a11y-spacing-relaxed section,
body.a11y-spacing-relaxed .prose,
body.a11y-spacing-relaxed .prose *,
body.a11y-spacing-loose main,
body.a11y-spacing-loose article,
body.a11y-spacing-loose section,
body.a11y-spacing-loose .prose,
body.a11y-spacing-loose .prose * {
  line-height: var(--a11y-line-height) !important;
}

/* Apply letter spacing to page content */
body.a11y-spacing-tight main,
body.a11y-spacing-tight article,
body.a11y-spacing-tight section,
body.a11y-spacing-tight .prose {
  letter-spacing: -0.02em;
}

body.a11y-spacing-relaxed main,
body.a11y-spacing-relaxed article,
body.a11y-spacing-relaxed section,
body.a11y-spacing-relaxed .prose {
  letter-spacing: 0.04em;
}

body.a11y-spacing-loose main,
body.a11y-spacing-loose article,
body.a11y-spacing-loose section,
body.a11y-spacing-loose .prose {
  letter-spacing: 0.08em;
}

/* Ensure accessibility toolbar and restore button maintain consistent line height */
.a11y-toolbar,
.a11y-toolbar *,
.a11y-restore-btn,
.a11y-restore-btn * {
  line-height: 1.5 !important;
  letter-spacing: normal !important;
}

/* Keep toolbar at consistent size */
body.a11y-font-smallest .a11y-toolbar,
body.a11y-font-small .a11y-toolbar,
body.a11y-font-normal .a11y-toolbar,
body.a11y-font-large .a11y-toolbar,
body.a11y-font-largest .a11y-toolbar {
  font-size: 14px;
}

/* High Contrast Mode */
body.a11y-high-contrast {
  --primary: #FFFF00;
  --primary-dark: #E6E600;
  --secondary: #00FF00;
  --accent: #00FFFF;
  --background: #000000;
  --text: #FFFFFF;
  --text-light: #FFFF00;
  --border: #FFFFFF;
}

body.a11y-high-contrast,
body.a11y-high-contrast * {
  background-color: #000000 !important;
  color: #FFFFFF !important;
}

body.a11y-high-contrast a,
body.a11y-high-contrast a * {
  color: #FFFF00 !important;
  text-decoration: underline;
}

body.a11y-high-contrast a:focus,
body.a11y-high-contrast button:focus,
body.a11y-high-contrast input:focus,
body.a11y-high-contrast textarea:focus,
body.a11y-high-contrast select:focus {
  outline: 3px solid #FFFF00 !important;
  outline-offset: 2px;
}

body.a11y-high-contrast img {
  filter: contrast(1.5) brightness(1.2);
}

body.a11y-high-contrast .a11y-toolbar {
  background: #000000;
  border-color: #FFFFFF;
}

body.a11y-high-contrast .a11y-toggle-btn {
  background: #FFFFFF;
  color: #000000;
}

body.a11y-high-contrast .a11y-btn {
  background: #333333;
  color: #FFFFFF;
  border-color: #666666;
}

body.a11y-high-contrast .a11y-btn:hover,
body.a11y-high-contrast .a11y-btn:focus {
  background: #666666;
  border-color: #FFFF00;
}

/* Screen Reader Friendly Mode - Keep toolbar in fixed position */
body.a11y-sr-mode .a11y-toolbar {
  position: fixed;
}

body.a11y-sr-mode .a11y-toggle-text:after {
  content: " - Mode Active";
}

/* Ensure toolbar toggle and restore button are visible in screen reader mode */
body.a11y-sr-mode .a11y-toolbar,
body.a11y-sr-mode .a11y-toggle-btn,
body.a11y-sr-mode .a11y-toggle-btn *,
body.a11y-sr-mode #a11y-restore-btn,
body.a11y-sr-mode #a11y-restore-btn * {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Panel respects hidden attribute even in screen reader mode */
body.a11y-sr-mode .a11y-panel[hidden] {
  display: none !important;
}

/* Hide decorative elements in SR mode, but NOT in accessibility toolbar */
body.a11y-sr-mode :not(.a11y-toolbar):not(.a11y-toolbar *) [aria-hidden="true"] {
  display: none !important;
}

/* ========================================
   NEW ACCESSIBILITY FEATURES (WCAG 2.0 AA)
   ======================================== */

/* Stop Animations */
body.a11y-stop-animations,
body.a11y-stop-animations *,
body.a11y-stop-animations *::before,
body.a11y-stop-animations *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* Underline Links */
body.a11y-underline-links a,
body.a11y-underline-links [role="link"] {
  text-decoration: underline !important;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

/* Highlight Links */
body.a11y-highlight-links a,
body.a11y-highlight-links [role="link"] {
  outline: 2px dashed #FF00FF !important;
  outline-offset: 2px;
  background-color: rgba(255, 0, 255, 0.1) !important;
}

body.a11y-highlight-links a:focus,
body.a11y-highlight-links [role="link"]:focus {
  outline: 3px solid #FF00FF !important;
  background-color: rgba(255, 0, 255, 0.2) !important;
}

/* Readable Font (Dyslexia-Friendly) */
body.a11y-readable-font {
  font-family: 'OpenDyslexic', 'Comic Sans MS', 'Arial', sans-serif !important;
}

/* Apply readable font to all elements, then override for toolbar */
body.a11y-readable-font *,
body.a11y-readable-font *::before,
body.a11y-readable-font *::after {
  font-family: 'OpenDyslexic', 'Comic Sans MS', 'Arial', sans-serif !important;
  letter-spacing: 0.05em !important;
  word-spacing: 0.1em !important;
}

/* Keep toolbar at consistent font */
body.a11y-readable-font .a11y-toolbar,
body.a11y-readable-font .a11y-toolbar *,
body.a11y-readable-font #a11y-restore-btn,
body.a11y-readable-font #a11y-restore-btn * {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
}

/* Grayscale Mode */
body.a11y-grayscale {
  filter: grayscale(100%);
}

body.a11y-grayscale *,
body.a11y-grayscale *::before,
body.a11y-grayscale *::after {
  filter: grayscale(100%);
}

body.a11y-grayscale canvas,
body.a11y-grayscale img {
  filter: grayscale(100%);
}

/* Combined modes - Grayscale with High Contrast */
body.a11y-grayscale.a11y-high-contrast * {
  color: #FFFFFF !important;
  background-color: #000000 !important;
  border-color: #FFFFFF !important;
}

body.a11y-grayscale.a11y-high-contrast a,
body.a11y-grayscale.a11y-high-contrast button,
body.a11y-grayscale.a11y-high-contrast [role="button"] {
  color: #FFFF00 !important;
}

/* Combined modes - Grayscale with Highlight Links */
body.a11y-grayscale.a11y-highlight-links a,
body.a11y-grayscale.a11y-highlight-links [role="link"] {
  outline: 2px dashed #FFFFFF !important;
  background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
  .a11y-panel {
    max-width: 100vw;
  }

  .a11y-controls {
    justify-content: space-between;
  }

  .a11y-btn {
    flex: 1;
  }
}

/* ========================================
   FOCUS INDICATORS (WCAG 2.0 AA)
   ======================================== */

/* Strong focus indicators for all interactive elements */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Ensure focus indicators are visible in high contrast mode */
body.a11y-high-contrast a:focus,
body.a11y-high-contrast button:focus,
body.a11y-high-contrast input:focus,
body.a11y-high-contrast textarea:focus,
body.a11y-high-contrast select:focus {
  outline: 3px solid #FFFF00 !important;
  outline-offset: 2px;
}

/* ========================================
   DEBUG/STATUS PANEL
   ======================================== */

/* Debug Group */
.a11y-debug-group {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.a11y-debug-toggle-btn {
  width: 100%;
  background: #dbeafe;
  color: #1e40af;
  font-size: 13px;
}

.a11y-debug-toggle-btn:hover,
.a11y-debug-toggle-btn:focus {
  background: #bfdbfe;
}

.a11y-debug-toggle-btn[aria-pressed="true"] {
  background: #1e40af;
  color: white;
}

/* Debug Panel */
.a11y-debug-panel {
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.a11y-debug-panel:not([hidden]) {
  display: block;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 300px;
  }
}

.a11y-debug-header {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.a11y-debug-content {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  align-items: center;
}

.a11y-debug-label {
  font-weight: 500;
  color: var(--text-light);
  text-align: right;
}

.a11y-debug-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  padding: 2px 6px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
}

.a11y-debug-value.active {
  background: #dcfce7;
  border-color: #22c55e;
  color: #15803d;
}

.a11y-debug-value.inactive {
  background: #f3f4f6;
  color: var(--text-light);
}

.a11y-debug-section {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-weight: 600;
  color: var(--text-light);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* High contrast mode debug panel */
body.a11y-high-contrast .a11y-debug-panel {
  background: #1a1a1a;
  border-color: #FFFFFF;
  color: #FFFFFF;
}

body.a11y-high-contrast .a11y-debug-header {
  color: #FFFF00;
  border-color: #FFFFFF;
}

body.a11y-high-contrast .a11y-debug-value {
  background: #000000;
  border-color: #FFFFFF;
  color: #FFFFFF;
}

body.a11y-high-contrast .a11y-debug-value.active {
  background: #003300;
  border-color: #00FF00;
  color: #00FF00;
}

body.a11y-high-contrast .a11y-debug-section {
  border-color: #666666;
  color: #FFFF00;
}