/* Quick Access Button */
.a11y-toggle-btn {
    position: fixed !important;
    right: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 99999 !important;
    transition: all 0.3s ease;
}

.a11y-toggle-btn:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.a11y-toggle-btn:focus {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

/* Accessibility Toolbar */
.accessibility-toolbar {
    position: fixed !important;
    right: 20px !important;
    top: auto !important;
    bottom: 90px !important;
    width: 400px;
    background: white;
    border-radius: 12px;
    z-index: 99999 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.accessibility-toolbar::-webkit-scrollbar {
    width: 6px;
}

.accessibility-toolbar::-webkit-scrollbar-track {
    background: transparent;
}

.accessibility-toolbar::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 3px;
}

.accessibility-toolbar.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Prevent panel from being affected by page scroll */
body.has-accessibility-panel {
    overflow-x: hidden;
}

/* Toolbar Header */
.toolbar-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 2;
    padding: 1rem;
    border-bottom: 1px solid var(--neutral-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--neutral-100);
    border-radius: 12px 12px 0 0;
}

.toolbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--neutral-800);
}

.toolbar-grid {
    padding: 1rem;
    display: grid;
    gap: 1rem;
    max-width: 400px;
}

.toolbar-group {
    background: var(--neutral-50);
    padding: 1rem;
    border-radius: 8px;
}

.toolbar-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--neutral-700);
}

.button-group {
    display: grid;
    gap: 0.5rem;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--neutral-200);
    border-radius: 6px;
    background: white;
    color: var(--neutral-800);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: var(--neutral-100);
    border-color: var(--primary);
}

.toolbar-btn i {
    color: var(--primary);
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.toolbar-reset {
    background: var(--neutral-200);
    color: var(--neutral-800);
    font-weight: 500;
}

.toolbar-reset:hover {
    background: var(--neutral-300);
}

/* Overlay */
.a11y-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 99998 !important;
}

.a11y-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .accessibility-toolbar,
    .high-contrast .accessibility-toolbar {
        right: 10px !important;
        left: 10px !important;
        width: auto;
    }
}

/* Active States */
.toolbar-btn[aria-pressed="true"] {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.toolbar-btn[aria-pressed="true"] i {
    color: white;
}

/* High Contrast Mode - Specific styles */
.high-contrast {
    --text-color: #000000;
    --bg-color: #FFFFFF;
    --link-color: #0000EE;
    --visited-color: #551A8B;
    filter: contrast(150%);
}

.high-contrast body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.high-contrast a {
    color: var(--link-color);
}

.high-contrast a:visited {
    color: var(--visited-color);
}

/* Keep toolbar visible in high contrast mode */
.high-contrast .accessibility-toolbar {
    background-color: var(--high-contrast-bg, #FFFFFF) !important;
    border: 2px solid var(--high-contrast-text, #000000) !important;
}

.high-contrast .toolbar-btn {
    background-color: var(--high-contrast-bg, #FFFFFF) !important;
    color: var(--high-contrast-text, #000000) !important;
    border: 1px solid var(--high-contrast-text, #000000) !important;
}

.high-contrast .toolbar-btn.active {
    background-color: var(--high-contrast-text, #000000) !important;
    color: var(--high-contrast-bg, #FFFFFF) !important;
}

/* Dyslexic Font */
.dyslexic-font {
    font-family: 'OpenDyslexic', sans-serif !important;
    line-height: 1.5;
    letter-spacing: 0.5px;
    word-spacing: 1px;
}

/* Link Highlighting */
.highlight-links a {
    background-color: #FFEB3B;
    color: #000000;
    text-decoration: underline;
    padding: 2px 4px;
    border-radius: 2px;
}

/* Reading Guide */
.reading-guide {
    position: fixed;
    left: 0;
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 0, 0.2);
    pointer-events: none;
    z-index: 9999;
    transition: top 0.1s ease;
}

/* Ensure reading guide stays above other elements */
body {
    position: relative;
}

/* Prevent reading guide from interfering with clicks */
.reading-guide * {
    pointer-events: none;
}

/* Active state for toolbar buttons */
.toolbar-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.toolbar-btn.active i {
    color: white;
}

/* Button states */
.toolbar-btn[aria-pressed="true"] {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.toolbar-btn[aria-pressed="true"] i {
    color: white;
}

/* Hover states */
.toolbar-btn:hover:not(.active) {
    background-color: var(--neutral-100);
    border-color: var(--primary);
}

/* Focus states */
.toolbar-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Animation for state changes */
.toolbar-btn {
    transition: all 0.3s ease;
}

/* Reset Notification */
.a11y-notification {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1002;
    animation: slideIn 0.3s ease, slideOut 0.3s ease 2.7s;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Reset Button Specific Styles */
.toolbar-reset {
    background-color: var(--neutral-200);
    color: var(--neutral-800);
    font-weight: 500;
    width: 100%;
    margin-top: 1rem;
    border: 1px solid var(--neutral-300);
}

.toolbar-reset:hover {
    background-color: var(--neutral-300);
    border-color: var(--neutral-400);
}

.toolbar-reset i {
    color: var(--neutral-600);
}

/* Image Brightness Controls */
:root {
    --image-brightness: 100%;
}

/* Apply brightness to all images */
img {
    filter: brightness(var(--image-brightness));
    transition: filter 0.3s ease;
}

/* Brightness control buttons */
.toolbar-group[data-control="brightness"] .toolbar-btn {
    min-width: 60px;
}

.brightness-value {
    font-size: 0.9em;
    font-weight: 500;
}

/* High contrast compatibility */
.high-contrast img {
    border: 2px solid var(--high-contrast-border, #000000) !important;
    filter: brightness(var(--image-brightness)) contrast(150%) !important;
}

/* Toolbar arrangement */
.toolbar-group {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--neutral-50);
    border-radius: 8px;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.toolbar-label {
    font-weight: 500;
    color: var(--neutral-700);
    display: block;
    margin-bottom: 0.5rem;
}

/* Button styles */
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--neutral-200);
    border-radius: 4px;
    background: white;
    color: var(--neutral-700);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: var(--neutral-100);
    border-color: var(--neutral-300);
}

.toolbar-btn i {
    font-size: 1.1em;
    color: var(--neutral-600);
}

/* Styles for the GIGW mandatory links section */
.gigw-mandatory-links {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.gigw-links-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gigw-links-list li {
    position: relative;
    margin: 0;
    padding: 0;
}

.gigw-links-list li:not(:last-child):after {
    content: "|";
    position: absolute;
    right: -9px;
    color: rgba(255, 255, 255, 0.3);
}

.gigw-links-list a {
    color: #fff;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.3s ease;
}

.gigw-links-list a:hover,
.gigw-links-list a:focus {
    color: #ffc107;
    text-decoration: underline;
}

/* Last Updated Information - GIGW 3.0 Compliant */
.last-updated-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin: 15px 0;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 14px;
    justify-content: center;
}

.last-updated-label {
    font-weight: 600;
    margin-right: 8px;
    color: #ffc107;
}

.last-updated-date {
    margin-right: 8px;
}

.last-updated-time {
    color: rgba(255, 255, 255, 0.8);
}

/* For pages with a white background */
.white-bg .last-updated-info {
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
}

.white-bg .last-updated-label {
    color: #005cbf;
}

.white-bg .last-updated-time {
    color: #666;
}

/* Responsive adjustments for GIGW links */
@media (max-width: 768px) {
    .gigw-links-list {
        gap: 10px 15px;
    }
    
    .gigw-links-list li {
        margin-bottom: 5px;
    }
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .last-updated-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .last-updated-label {
        margin-right: 0;
        margin-bottom: 4px;
    }
    
    .gigw-links-list {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .gigw-links-list li:not(:last-child):after {
        display: none;
    }
}