/* Optional: self-hosted dyslexia font
@font-face {
  font-family: "OpenDyslexicLocal";
  src: url("/assets/fonts/OpenDyslexic-Regular.woff2") format("woff2");
  font-display: swap;
}
*/

:root {
  --acc-z: 2147483000;
  --acc-radius: 16px;
  --acc-shadow: 0 10px 40px rgba(0,0,0,.12);
  --acc-bg: #DBE5EA;
  --acc-fg: #1f2937;
  --acc-muted: #6b7280;
  --acc-primary: #6366f1;
  --acc-primary-hover: #4f46e5;
  --acc-border: #e5e7eb;
  --acc-section-bg: #f9fafb;
  
  --acc-font-step: 0;
  --acc-base-font: 16px;
  
  /* Dyslexia mode variables */
  --acc-letter-spacing: 0.01em;
  --acc-line-height: 1.6;
  --acc-dys-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html.acc-font-1 { font-size: calc(var(--acc-base-font) * 1.05); }
html.acc-font-2 { font-size: calc(var(--acc-base-font) * 1.12); }
html.acc-font-3 { font-size: calc(var(--acc-base-font) * 1.20); }
html.acc-font-4 { font-size: calc(var(--acc-base-font) * 1.32); }
html.acc-font-5 { font-size: calc(var(--acc-base-font) * 1.45); }

html.acc-theme-default body {
  background: #DBE5EA !important;
  color: #1f2937 !important;
}

html.acc-theme-high-contrast {
  filter: contrast(135%) saturate(120%);
}
html.acc-theme-high-contrast body {
  background: #1a237e !important;
  color: #ffffff !important;
}
html.acc-theme-high-contrast a {
  color: #82b1ff !important;
  text-decoration: underline !important;
}
html.acc-theme-high-contrast nav,
html.acc-theme-high-contrast header {
  background: #0d1642 !important;
}

/* Dark Mode - σκούρο φόντο με φωτεινά χρώματα */
html.acc-theme-dark body {
  background: #121212 !important;
  color: #ffffff !important;
}
html.acc-theme-dark nav,
html.acc-theme-dark header {
  background: #1e1e1e !important;
}
html.acc-theme-dark * {
  border-color: #333333 !important;
}
html.acc-theme-dark a {
  color: #90caf9 !important;
}
/* Dark Mode - χρωματική παλέτα */
html.acc-theme-dark .text-primary,
html.acc-theme-dark [style*="#090839"] {
  color: #aab4ff !important;
}
html.acc-theme-dark .text-accent,
html.acc-theme-dark [style*="#fa7268"] {
  color: #ffb4a5 !important;
}
html.acc-theme-dark .text-light,
html.acc-theme-dark [style*="#dbe5ea"] {
  color: #ffffff !important;
}

/* Sepia Mode - θερμοί τόνοι */
html.acc-theme-sepia body {
  background: #f4ecd8 !important;
  color: #5d4e37 !important;
}
html.acc-theme-sepia body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(112, 66, 20, 0.1);
  pointer-events: none;
  z-index: 1;
}
html.acc-theme-sepia a {
  color: #8b4513 !important;
}
/* Sepia Mode - χρωματική παλέτα */
html.acc-theme-sepia .text-primary,
html.acc-theme-sepia [style*="#090839"] {
  color: #2d1f00 !important;
}
html.acc-theme-sepia .text-accent,
html.acc-theme-sepia [style*="#fa7268"] {
  color: #8b3d2c !important;
}
html.acc-theme-sepia .text-light,
html.acc-theme-sepia [style*="#dbe5ea"] {
  color: #fffaf0 !important;
}

html.acc-dyslexia * {
  letter-spacing: var(--acc-letter-spacing) !important;
  line-height: var(--acc-line-height) !important;
  word-spacing: 0.02em !important;
}
html.acc-dyslexia {
  font-family: var(--acc-dys-font);
}

/* Floating button - Centered vertically on right side */
.acc-root {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2147483647;
}

.acc-fab {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 28px;
  background: var(--acc-primary);
  color: #fff;
  box-shadow: var(--acc-shadow);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.acc-fab span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.acc-fab img {
  width: 100%;
  height: 100%;
  max-width: 36px;
  max-height: 36px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  transition: transform 0.3s ease;
}

.acc-fab:hover img {
  transform: scale(1.1);
}

.acc-fab:hover {
  background: var(--acc-primary-hover);
  transform: scale(1.05);
  box-shadow: 0 12px 48px rgba(99,102,241,.25);
}

.acc-fab:focus {
  outline: 3px solid #a5b4fc;
  outline-offset: 2px;
}

/* Panel - Centered vertically next to button */
.acc-panel {
  position: fixed;
  right: 90px;
  top: 50%;
  transform: translateY(-50%);
  width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--acc-bg);
  color: var(--acc-fg);
  border: 1px solid var(--acc-border);
  border-radius: var(--acc-radius);
  box-shadow: var(--acc-shadow);
  padding: 0;
  display: none;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

.acc-panel.open {
  display: block;
}

/* Custom scrollbar */
.acc-panel::-webkit-scrollbar {
  width: 8px;
}

.acc-panel::-webkit-scrollbar-track {
  background: var(--acc-section-bg);
}

.acc-panel::-webkit-scrollbar-thumb {
  background: var(--acc-border);
  border-radius: 4px;
}

.acc-panel::-webkit-scrollbar-thumb:hover {
  background: var(--acc-muted);
}

/* Header */
.acc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--acc-border);
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: var(--acc-radius) var(--acc-radius) 0 0;
}

.acc-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.acc-close {
  border: none;
  background: rgba(255,255,255,0.2);
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.acc-close:hover {
  background: rgba(255,255,255,0.3);
  transform: rotate(90deg);
}

/* Sections */
.acc-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--acc-border);
}

.acc-section:last-of-type {
  border-bottom: none;
}

.acc-section h3 {
  margin: 0 0 14px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--acc-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.acc-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.acc-inline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  color: var(--acc-fg);
}

/* Buttons */
.acc-btn {
  background: var(--acc-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}

.acc-btn:hover {
  background: var(--acc-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.acc-btn:active {
  transform: translateY(0);
}

.acc-btn.ghost {
  background: var(--acc-section-bg);
  color: var(--acc-fg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.acc-btn.ghost:hover {
  background: #e5e7eb;
}

.acc-btn.danger {
  background: #ef4444;
  box-shadow: 0 2px 8px rgba(239,68,68,0.2);
}

.acc-btn.danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

.acc-btn.theme {
  background: #f3f4f6;
  color: #374151;
  border: 2px solid var(--acc-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  flex: 1;
  min-width: 80px;
}

.acc-btn.theme:hover {
  background: #e5e7eb;
  border-color: var(--acc-primary);
}

/* Input elements */
input[type="color"] {
  width: 48px;
  height: 48px;
  border: 2px solid var(--acc-border);
  border-radius: 10px;
  cursor: pointer;
  padding: 4px;
}

input[type="range"] {
  flex: 1;
  min-width: 100px;
  height: 6px;
  border-radius: 3px;
  background: var(--acc-border);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--acc-primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(99,102,241,0.3);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--acc-primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(99,102,241,0.3);
}

/* Hint text */
.acc-hint {
  margin: 12px 0 0 0;
  font-size: 13px;
  color: var(--acc-muted);
  line-height: 1.5;
  font-style: italic;
}

/* Footer */
.acc-footer {
  padding: 20px 24px;
  display: flex;
  justify-content: center;
  background: var(--acc-section-bg);
  border-radius: 0 0 var(--acc-radius) var(--acc-radius);
}

.acc-footer .acc-btn {
  width: 100%;
  max-width: 200px;
}

/* Overlay layer - MUST cover entire viewport */
.acc-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  z-index: 999999;
  transition: opacity 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .acc-panel {
    right: 50%;
    transform: translate(50%, -50%);
    width: calc(100vw - 40px);
    max-width: 380px;
  }
  
  .acc-root {
    right: 50%;
    transform: translate(50%, -50%);
  }
  
  .acc-fab {
    margin-right: -28px;
  }
}

@media (max-height: 700px) {
  .acc-panel {
    max-height: 90vh;
  }
  
  .acc-section {
    padding: 16px 20px;
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}