/**
 * Government Accessibility Toolbar
 * WCAG 2.1 AA Compliant - Required for Sri Lankan Government Websites
 * ICTA Guidelines v4.0
 */

/* Accessibility Toolbar - Fixed Bottom Right */
.accessibility-toolbar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    background: white;
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.accessibility-toolbar.collapsed {
    width: 56px;
    height: 56px;
}

.accessibility-toolbar.collapsed .accessibility-content {
    display: none;
}

/* Toggle Button */
.accessibility-toggle {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.accessibility-toggle:hover {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    transform: scale(1.05);
}

.accessibility-toolbar.collapsed .accessibility-toggle {
    border-radius: 50%;
}

/* First-time Popup */
.accessibility-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: white;
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    padding: 20px;
    max-width: 300px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 99998;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accessibility-popup.hidden {
    display: none;
}

.popup-title {
    font-size: 16px;
    font-weight: 700;
    color: #0c4a6e;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-title::before {
    content: '♿';
    font-size: 20px;
}

.popup-text {
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 16px;
}

.popup-buttons {
    display: flex;
    gap: 8px;
}

.popup-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #0ea5e9;
}

.popup-btn-primary {
    background: #0ea5e9;
    color: white;
}

.popup-btn-primary:hover {
    background: #0284c7;
}

.popup-btn-secondary {
    background: white;
    color: #0ea5e9;
}

.popup-btn-secondary:hover {
    background: #f0f9ff;
}

/* Toolbar Content */
.accessibility-content {
    padding: 16px;
    min-width: 280px;
}

.accessibility-title {
    font-size: 16px;
    font-weight: 700;
    color: #0c4a6e;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0f2fe;
    display: flex;
    align-items: center;
    gap: 8px;
}

.accessibility-title::before {
    content: '♿';
    font-size: 20px;
}

/* Control Groups */
.accessibility-group {
    margin-bottom: 16px;
}

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

.accessibility-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    display: block;
}

/* Button Controls */
.accessibility-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.accessibility-btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e0f2fe;
    border-radius: 8px;
    color: #0c4a6e;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.accessibility-btn:hover {
    background: #f0f9ff;
    border-color: #0ea5e9;
    color: #0284c7;
}

.accessibility-btn.active {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: white;
}

.accessibility-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Range Slider */
.accessibility-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0f2fe;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.accessibility-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0ea5e9;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.accessibility-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0ea5e9;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.accessibility-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
}

/* Value Display */
.slider-value {
    text-align: center;
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    font-weight: 600;
}

/* Reset Button */
.accessibility-reset {
    width: 100%;
    padding: 10px;
    background: white;
    border: 2px solid #ef4444;
    border-radius: 8px;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
}

.accessibility-reset:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

/* High Contrast Mode */
body.high-contrast {
    background: #000 !important;
    color: #fff !important;
}

body.high-contrast * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

body.high-contrast a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

body.high-contrast button,
body.high-contrast .btn {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #fff !important;
}

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

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

/* Readable Font */
body.readable-font * {
    font-family: 'Arial', 'Helvetica', sans-serif !important;
}

/* Text Spacing */
body.text-spacing * {
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
    line-height: 1.8 !important;
}

/* Large Cursor */
body.large-cursor,
body.large-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M2 2 L2 28 L12 18 L18 26 L22 24 L16 16 L28 16 Z" fill="black" stroke="white" stroke-width="2"/></svg>') 0 0, auto !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .accessibility-toolbar {
        bottom: 10px;
        right: 10px;
    }
    
    .accessibility-toolbar.collapsed {
        width: 50px;
        height: 50px;
    }
    
    .accessibility-content {
        min-width: 260px;
        padding: 12px;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .accessibility-toggle {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .accessibility-popup {
        bottom: 70px;
        right: 10px;
        max-width: calc(100vw - 40px);
    }
}

/* Keyboard Focus */
.accessibility-btn:focus,
.accessibility-toggle:focus,
.accessibility-slider:focus {
    outline: 3px solid #0ea5e9;
    outline-offset: 2px;
}

/* Print - Hide Toolbar */
@media print {
    .accessibility-toolbar {
        display: none !important;
    }
}

/* Compliance Badge */
.wcag-badge {
    margin-top: 12px;
    padding: 8px;
    background: #f0f9ff;
    border-radius: 6px;
    text-align: center;
    font-size: 10px;
    color: #0369a1;
    font-weight: 600;
}

.wcag-badge::before {
    content: '✓ ';
    color: #10b981;
}


