/* Accessibility Tools Widget Styling */
.accessibility-widget-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
}

.accessibility-widget-trigger {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.accessibility-widget-trigger:hover,
.accessibility-widget-trigger:focus-visible {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.6);
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

/* Panel Box */
.accessibility-panel {
    display: none;
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 320px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    pointer-events: none;
}

.accessibility-panel.active {
    display: block;
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.accessibility-panel-header {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(6, 182, 212, 0.1));
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accessibility-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #f8fafc;
}

.accessibility-panel-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease;
}

.accessibility-panel-close:hover {
    color: #f1f5f9;
}

.accessibility-panel-body {
    padding: 1.2rem;
    max-height: 380px;
    overflow-y: auto;
}

.accessibility-control-group {
    margin-bottom: 1.2rem;
}

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

.control-label {
    display: block;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.control-options {
    display: flex;
    gap: 0.5rem;
}

.accessibility-btn {
    flex: 1;
    padding: 0.5rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.accessibility-btn:hover,
.accessibility-btn:focus-visible {
    background: rgba(139, 92, 246, 0.15);
    border-color: #8b5cf6;
    color: #ffffff;
    outline: none;
}

.accessibility-btn.active {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.btn-toggle-wide {
    width: 100%;
    text-align: center;
}

.accessibility-panel-footer {
    padding: 1rem 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.5);
    text-align: center;
}

.accessibility-reset-all {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: #94a3b8;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.accessibility-reset-all:hover {
    border-color: #ef4444;
    color: #f87171;
}

/* High Contrast Mode overrides */
body.contrast-high {
    background-color: #000000 !important;
    color: #ffff00 !important;
}

body.contrast-high * {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
    text-shadow: none !important;
    box-shadow: none !important;
    background-image: none !important;
}

body.contrast-high a, 
body.contrast-high a * {
    color: #00ffff !important;
    text-decoration: underline !important;
}

body.contrast-high button,
body.contrast-high .accessibility-btn {
    border: 2px solid #ffff00 !important;
    background: #000000 !important;
}

body.contrast-high .accessibility-btn.active {
    background: #ffff00 !important;
    color: #000000 !important;
}

body.contrast-high .accessibility-btn.active * {
    color: #000000 !important;
}

/* Grayscale Mode */
body.contrast-grayscale {
    filter: grayscale(100%) !important;
}

/* Dyslexia Friendly Overrides */
body.accessibility-dyslexic,
body.accessibility-dyslexic * {
    font-family: 'Comic Sans MS', 'Comic Neue', cursive, sans-serif !important;
}

/* Spacing Enhancements */
body.accessibility-spacing,
body.accessibility-spacing p,
body.accessibility-spacing span,
body.accessibility-spacing li {
    letter-spacing: 0.12em !important;
    line-height: 2.0 !important;
    word-spacing: 0.16em !important;
}

/* Animation Stopper */
body.accessibility-stop-animations,
body.accessibility-stop-animations * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* Visually Hidden Skip Link Utility */
.visually-hidden {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

.skip-link:focus-visible {
    position: fixed !important;
    top: 10px;
    left: 10px;
    width: auto !important;
    height: auto !important;
    clip-path: none !important;
    padding: 1rem 1.5rem !important;
    background: #8b5cf6;
    color: #ffffff !important;
    border-radius: 8px;
    z-index: 10000;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    outline: 3px solid #ffffff;
}

/* Reading Guide - horizontal line following cursor */
.reading-guide-line {
    position: fixed;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(0, 212, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.4), 0 -20px 40px rgba(0, 212, 255, 0.03), 0 20px 40px rgba(0, 212, 255, 0.03);
    pointer-events: none;
    z-index: 9998;
    display: none;
    transition: top 0.05s linear;
}

body.accessibility-reading-guide .reading-guide-line {
    display: block;
}

/* Link Highlighting */
body.accessibility-highlight-links a {
    outline: 2px solid #00d4ff !important;
    outline-offset: 2px !important;
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
}

body.accessibility-highlight-links a:hover {
    outline-color: #ff6b35 !important;
    background: rgba(0, 212, 255, 0.1) !important;
}

/* Large Cursor */
body.accessibility-large-cursor,
body.accessibility-large-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M4 4l20 8-8 4-4 8z' fill='%2300d4ff' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E") 4 4, auto !important;
}

body.accessibility-large-cursor a,
body.accessibility-large-cursor button,
body.accessibility-large-cursor [role="button"] {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='12' fill='none' stroke='%2300d4ff' stroke-width='3'/%3E%3Ccircle cx='16' cy='16' r='4' fill='%2300d4ff'/%3E%3C/svg%3E") 16 16, pointer !important;
}
