/* ================================================
   BARRIEREFREIHEIT MOBILE OPTIMIERUNG
   ================================================ */

/* ============================================
   MOBILE TRIGGER BUTTON - 768px
   ============================================ */
@media (max-width: 768px) {
  .a11y-trigger {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 6px 0 0 6px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: var(--glass-shadow, 0 8px 32px rgba(0, 0, 0, 0.4)) !important;
  }
  
  .a11y-trigger:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
  }
  
  .a11y-trigger svg {
    width: 18px !important;
    height: 18px !important;
    fill: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
}

/* ============================================
   MOBILE TRIGGER BUTTON - 480px
   ============================================ */
@media (max-width: 480px) {
  .a11y-trigger {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    padding: 0 !important;
    border-radius: 6px 0 0 6px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: var(--glass-shadow, 0 8px 32px rgba(0, 0, 0, 0.4)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .a11y-trigger:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
  }
  
  .a11y-trigger svg {
    width: 14px !important;
    height: 14px !important;
    fill: #ffffff !important;
  }
}

/* ============================================
   MOBILE PANEL - 768px
   ============================================ */
@media (max-width: 768px) {
  .a11y-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 180px;
    width: auto;
    max-width: calc(100vw - 24px);
    max-height: 55vh;
    z-index: 100001; /* Höher als Navigation (100000) */
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .a11y-body {
    padding: 14px 16px;
    max-height: calc(55vh - 60px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
  }

  /* Scrollbar Styling für Mobile */
  .a11y-body::-webkit-scrollbar {
    width: 4px;
  }

  .a11y-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
  }

  .a11y-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
  }

  .a11y-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
  }

  .a11y-toggle {
    padding: 10px 12px;
  }

  .a11y-toggle-icon {
    width: 32px;
    height: 32px;
  }

  .a11y-toggle-icon svg {
    width: 18px;
    height: 18px;
  }

  .a11y-toggle-label {
    font-size: 13px;
  }
}

/* ============================================
   MOBILE PANEL - 480px (Kompakt)
   ============================================ */
/* Mobile Ansicht (480px) - Kompakt und optimiert */
@media (max-width: 480px) {
  /* Panel - Schmaler mit verbesserter Scroll-Funktion */
  .a11y-panel {
    position: fixed;
    left: auto;
    right: 10px;
    top: auto;
    bottom: 80px;
    width: 280px;
    max-width: calc(100vw - 20px);
    max-height: 60vh;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(40px) saturate(180%) brightness(0.9);
    -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(0.9);
    border-radius: 10px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
                inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    z-index: 100001;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* Header - Kompakt, ohne Logo, mit Close Button */
  .a11y-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 36px;
    position: relative;
  }

  .a11y-header h3 {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-fg-default);
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
  }

  /* AAA Logo ausblenden */
  .a11y-header h3 svg {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
  }

  /* Close Button - SICHTBAR und gut positioniert */
  .a11y-close {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 1.5px solid rgba(255, 255, 255, 0.5) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    pointer-events: auto !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
  }

  .a11y-close:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.7) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3) !important;
  }

  .a11y-close:active {
    transform: scale(0.95) !important;
  }

  .a11y-close svg {
    width: 14px !important;
    height: 14px !important;
    stroke: #ffffff !important;
    stroke-width: 2.5 !important;
    fill: none !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .a11y-close svg line,
  .a11y-close svg path,
  .a11y-close svg polyline {
    stroke: #ffffff !important;
    stroke-width: 2.5 !important;
    stroke-linecap: round !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Body - Kompakt mit verbesserter Scroll-Funktion */
  .a11y-body {
    padding: 10px 12px;
    max-height: calc(60vh - 50px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
  }

  /* Scrollbar Styling für Mobile */
  .a11y-body::-webkit-scrollbar {
    width: 4px;
  }

  .a11y-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
  }

  .a11y-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
  }

  .a11y-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
  }

  /* Groups - Kompakt */
  .a11y-group {
    margin-bottom: 12px;
  }

  .a11y-group:last-child {
    margin-bottom: 0;
  }

  .a11y-group-title {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-fg-subtle);
    margin-bottom: 8px;
  }

  /* Font Size Slider - Kompakt */
  .a11y-font-size {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .a11y-font-size span {
    font-size: 10px;
    color: var(--color-fg-muted);
    min-width: 16px;
    text-align: center;
  }

  .a11y-font-size span:first-child {
    font-size: 9px;
  }

  .a11y-font-size span:last-child {
    font-size: 12px;
  }

  .a11y-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
  }

  .a11y-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
  }

  .a11y-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
  }

  .a11y-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
  }

  .a11y-font-value {
    min-width: 32px;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--color-fg-default);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 5px;
    border-radius: 3px;
  }

  /* Toggles - Kompakt */
  .a11y-toggles {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .a11y-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .a11y-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
  }

  .a11y-toggle.active {
    background: rgba(var(--color-primary-rgb, 88, 166, 255), 0.15);
    border-color: var(--color-primary);
  }

  .a11y-toggle-info {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .a11y-toggle-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    flex-shrink: 0;
  }

  .a11y-toggle-icon svg {
    width: 14px;
    height: 14px;
    stroke: var(--color-fg-muted);
  }

  .a11y-toggle.active .a11y-toggle-icon {
    background: var(--color-primary);
  }

  .a11y-toggle.active .a11y-toggle-icon svg {
    stroke: var(--color-fg-inverse);
  }

  :root[data-theme="hud"] .a11y-toggle.active .a11y-toggle-icon svg {
    stroke: #020305;
  }

  .a11y-toggle-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
  }

  .a11y-toggle-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-fg-default);
    line-height: 1.3;
  }

  .a11y-toggle-desc {
    font-size: 8px;
    color: var(--color-fg-subtle);
    margin-top: 1px;
    line-height: 1.2;
  }

  /* Toggle Switch - Kompakt */
  .a11y-switch {
    width: 32px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 9px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
  }

  .a11y-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
  }

  .a11y-toggle.active .a11y-switch {
    background: var(--color-primary);
  }

  .a11y-toggle.active .a11y-switch::after {
    left: 16px;
  }

  /* Text-to-Speech Controls - Kompakt */
  .a11y-tts-controls {
    display: flex;
    gap: 5px;
    margin-top: 6px;
  }

  .a11y-tts-btn {
    flex: 1;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 9px;
    color: var(--color-fg-muted);
    transition: all 0.2s ease;
  }

  .a11y-tts-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-fg-default);
  }

  .a11y-tts-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-fg-inverse);
  }

  :root[data-theme="hud"] .a11y-tts-btn.active {
    color: #020305;
  }

  .a11y-tts-btn svg {
    width: 10px;
    height: 10px;
    stroke: currentColor;
  }

  /* Reset Button - Kompakt */
  .a11y-reset {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    border-radius: 5px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
    color: var(--color-fg-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }

  .a11y-reset:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-fg-default);
  }

  .a11y-reset svg {
    width: 10px;
    height: 10px;
    stroke: currentColor;
  }
}

/* ================================================
   FINALE OVERRIDES - 481px-768px
   A11y Button gleiche Größe wie Contact Buttons (32px)
   ================================================ */
@media (min-width: 481px) and (max-width: 768px) {
  .a11y-trigger {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    border-radius: 4px 0 0 4px !important;
    background: rgba(22, 27, 34, 0.95) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    right: 0 !important;
  }
  
  .a11y-trigger svg {
    width: 14px !important;
    height: 14px !important;
    fill: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
  }
}

