/**
 * Accessibility Toolbar Styles
 * Power of Knowledge - Theme-Matched Design
 */

/* Toolbar Container */
.a11y-toolbar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

/* Toggle Button */
.a11y-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-navy, #1a3c5e) 0%, #2d5a8c 100%);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(26, 60, 94, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a11y-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(26, 60, 94, 0.5);
}

.a11y-toggle:focus {
    outline: 3px solid var(--accent-gold, #b8860b);
    outline-offset: 3px;
}

/* Panel */
.a11y-panel {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%) translateX(20px);
    width: 320px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(26, 60, 94, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.a11y-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* Panel Header */
.a11y-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--primary-navy, #1a3c5e) 0%, #2d5a8c 100%);
    color: white;
}

.a11y-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.a11y-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.a11y-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Panel Content */
.a11y-panel-content {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Control Groups */
.a11y-control {
    margin-bottom: 18px;
}

.a11y-control label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Button Groups */
.a11y-btn-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.a11y-btn {
    flex: 1;
    padding: 10px 12px;
    background: #f1f5f9;
    border: 2px solid transparent;
    border-radius: 10px;
    color: #1e293b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.a11y-btn:hover {
    background: #e2e8f0;
}

.a11y-btn.active {
    background: linear-gradient(135deg, var(--primary-navy, #1a3c5e) 0%, #2d5a8c 100%);
    color: white;
    border-color: transparent;
}

.a11y-btn:focus {
    outline: 2px solid var(--accent-gold, #b8860b);
    outline-offset: 2px;
}

.a11y-value {
    min-width: 50px;
    text-align: center;
    font-weight: 700;
    color: var(--primary-navy, #1a3c5e);
    font-size: 14px;
}

/* Toggle Controls */
.a11y-toggle-control label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 15px;
    background: #f8fafc;
    border-radius: 10px;
    transition: background 0.2s ease;
    margin-bottom: 0;
    text-transform: none;
}

.a11y-toggle-control label:hover {
    background: #f1f5f9;
}

.a11y-toggle-control input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-navy, #1a3c5e);
}

.a11y-toggle-control span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1e293b;
    font-weight: 500;
}

/* Reset Button */
.a11y-reset {
    width: 100%;
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.a11y-reset:hover {
    background: #fee2e2;
}

/* Reading Guide */
.a11y-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(26, 60, 94, 0.1);
    border-top: 2px solid var(--primary-navy, #1a3c5e);
    border-bottom: 2px solid var(--primary-navy, #1a3c5e);
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.a11y-reading-guide.active {
    opacity: 1;
}

/* Global A11y Styles */
html.a11y-high-contrast {
    filter: contrast(1.4);
}

html.a11y-dark-mode {
    filter: invert(1) hue-rotate(180deg);
}

html.a11y-dark-mode img,
html.a11y-dark-mode video,
html.a11y-dark-mode iframe {
    filter: invert(1) hue-rotate(180deg);
}

html.a11y-line-large {
    line-height: 1.8 !important;
}

html.a11y-line-large * {
    line-height: 1.8 !important;
}

html.a11y-line-xlarge {
    line-height: 2.2 !important;
}

html.a11y-line-xlarge * {
    line-height: 2.2 !important;
}

html.a11y-letter-wide {
    letter-spacing: 0.1em !important;
}

html.a11y-letter-wide * {
    letter-spacing: 0.1em !important;
}

html.a11y-highlight-links a {
    background: yellow !important;
    color: black !important;
    text-decoration: underline !important;
    padding: 2px 4px !important;
}

html.a11y-dyslexia-font,
html.a11y-dyslexia-font * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', cursive !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .a11y-toolbar {
        right: 15px;
        bottom: 80px;
        top: auto;
        transform: none;
    }

    .a11y-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .a11y-panel {
        position: fixed;
        right: 10px;
        left: 10px;
        bottom: 140px;
        top: auto;
        width: auto;
        max-width: none;
        transform: translateY(20px);
    }

    .a11y-panel.open {
        transform: translateY(0);
    }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-right)) {
    .a11y-toolbar {
        right: calc(20px + env(safe-area-inset-right));
    }
}

/* Scrollbar for panel */
.a11y-panel-content::-webkit-scrollbar {
    width: 6px;
}

.a11y-panel-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.a11y-panel-content::-webkit-scrollbar-thumb {
    background: var(--primary-navy, #1a3c5e);
    border-radius: 3px;
}

/* Print - hide toolbar */
@media print {

    .a11y-toolbar,
    .a11y-reading-guide {
        display: none !important;
    }
}