/**
 * WCAG 2.1 AA Accessibility Toolbar Styles
 * SP ZOZ Lubartów
 */

/* ============================================
   Screen Reader Only (for announcements)
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Accessibility Toggle Button (Fixed)
   ============================================ */
.accessibility-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f766e;
    color: #ffffff;
    border: 3px solid #ffffff;
    padding: 10px 18px 10px 12px;
    cursor: pointer;
    z-index: 9999;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}

.accessibility-toggle:hover {
    background: #0d9488;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.accessibility-toggle:focus {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
}

.accessibility-toggle svg {
    display: block;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    pointer-events: none;
}

.accessibility-toggle .a11y-label {
    white-space: nowrap;
    pointer-events: none;
}

/* ============================================
   Accessibility Panel (Slide-in from right)
   ============================================ */
.accessibility-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: 350px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

.accessibility-panel.open {
    right: 0;
}

/* ============================================
   Panel Header
   ============================================ */
.accessibility-panel-header {
    background: #0f766e;
    color: white;
    padding: 24px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.accessibility-panel-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

#accessibility-close {
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

#accessibility-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

#accessibility-close:focus {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
}

/* ============================================
   Panel Content
   ============================================ */
.accessibility-panel-content {
    padding: 24px 20px;
}

.accessibility-section {
    margin-bottom: 32px;
}

.accessibility-section:last-of-type {
    margin-bottom: 24px;
}

.accessibility-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #333;
}

/* ============================================
   Button Groups (for font size controls)
   ============================================ */
.button-group {
    display: flex;
    gap: 12px;
}

.button-group button {
    flex: 1;
}

/* ============================================
   Accessibility Option Buttons
   ============================================ */
.accessibility-panel-content button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px;
    margin-bottom: 12px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.accessibility-panel-content button:hover {
    background: #e9ecef;
    border-color: #0f766e;
    transform: translateX(-2px);
}

.accessibility-panel-content button:focus {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
}

.accessibility-panel-content button:active {
    transform: translateX(-2px) scale(0.98);
}

/* Active state for toggle buttons */
.accessibility-panel-content button.active,
.accessibility-panel-content button[aria-pressed="true"] {
    background: #f0fdfa;
    border-color: #0f766e;
    font-weight: 600;
}

.accessibility-panel-content button .icon {
    margin-right: 12px;
    font-size: 22px;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.accessibility-panel-content button .label {
    flex: 1;
}

/* ============================================
   Reset Button
   ============================================ */
.reset-btn {
    background: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
    margin-top: 24px !important;
    font-weight: 600 !important;
}

.reset-btn:hover {
    background: #c82333 !important;
    border-color: #c82333 !important;
}

.reset-btn .icon {
    color: white;
}

/* ============================================
   ACCESSIBILITY MODES
   ============================================ */

/* High Contrast Mode */
html.high-contrast {
    filter: contrast(1.5) brightness(1.1);
}

html.high-contrast img {
    filter: contrast(1.2);
}

/* Grayscale Mode */
html.grayscale {
    filter: grayscale(100%);
}

html.grayscale img {
    filter: grayscale(100%);
}

/* Yellow on Black Mode (Dyslexia Friendly) */
html.yellow-black {
    background: #000000 !important;
    color: #ffff00 !important;
}

html.yellow-black * {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

html.yellow-black a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

html.yellow-black button,
html.yellow-black input,
html.yellow-black select,
html.yellow-black textarea {
    background-color: #1a1a1a !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
}

html.yellow-black img {
    opacity: 0.8;
    filter: brightness(0.9);
}

/* Preserve accessibility toolbar in yellow-black mode */
html.yellow-black .accessibility-toggle {
    background-color: #333333 !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
}

html.yellow-black .accessibility-panel {
    background: #1a1a1a !important;
    border-left: 2px solid #ffff00 !important;
}

html.yellow-black .accessibility-panel-header {
    background: #000000 !important;
    border-bottom: 2px solid #ffff00 !important;
}

/* Underline Links Mode */
html.underline-links a {
    text-decoration: underline !important;
}

html.underline-links a:hover {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
}

/* Readable Font Mode */
html.readable-font,
html.readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.02em;
}

/* Preserve monospace for code */
html.readable-font code,
html.readable-font pre,
html.readable-font kbd,
html.readable-font samp {
    font-family: 'Courier New', Courier, monospace !important;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Mobile devices */
@media (max-width: 480px) {
    .accessibility-panel {
        width: 100%;
        right: -100%;
    }
    
    .accessibility-toggle {
        padding: 12px;
        border-radius: 50%;
    }

    .accessibility-toggle .a11y-label {
        display: none;
    }

    .accessibility-toggle svg {
        width: 28px;
        height: 28px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .accessibility-panel {
        width: 320px;
    }
    
    .accessibility-panel-content {
        padding: 20px 16px;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .accessibility-toggle,
    .accessibility-panel {
        display: none !important;
    }
}

/* ============================================
   Animation for panel open/close
   ============================================ */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.accessibility-panel.open .accessibility-section {
    animation: slideIn 0.3s ease-out;
}

.accessibility-panel.open .accessibility-section:nth-child(1) {
    animation-delay: 0.1s;
}

.accessibility-panel.open .accessibility-section:nth-child(2) {
    animation-delay: 0.2s;
}

.accessibility-panel.open .accessibility-section:nth-child(3) {
    animation-delay: 0.3s;
}

/* ============================================
   Focus Management
   ============================================ */

/* Ensure focus is always visible in all modes */
html.high-contrast *:focus,
html.grayscale *:focus,
html.yellow-black *:focus {
    outline: 3px solid #ffbf00 !important;
    outline-offset: 2px !important;
}

/* ============================================
   Reduced Motion Support
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .accessibility-panel,
    .accessibility-toggle,
    .accessibility-panel-content button {
        transition: none !important;
        animation: none !important;
    }
}
