/**
 * Accessibility Styles
 * Act2Vision Survey System
 */

/* Accessibility Widget Button */
.accessibility-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #e0990a;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.accessibility-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

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

/* Accessibility Panel */
.accessibility-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 1001;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
}

.accessibility-panel.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.accessibility-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accessibility-panel-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #121c44;
}

.accessibility-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #6b7280;
    transition: color 0.2s;
}

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

.accessibility-panel-body {
    padding: 20px;
}

.accessibility-option {
    margin-bottom: 20px;
}

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

.accessibility-option-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.accessibility-option-description {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 8px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #e0990a;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Font Size Buttons */
.font-size-controls {
    display: flex;
    gap: 8px;
}

.font-size-btn {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    color: #374151;
}

.font-size-btn:hover {
    border-color: #e0990a;
    color: #e0990a;
}

.font-size-btn.active {
    background: #e0990a;
    border-color: #e0990a;
    color: white;
}

/* TTS Controls */
.tts-controls {
    display: flex;
    gap: 8px;
}

.tts-btn {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tts-btn:hover {
    border-color: #e0990a;
    color: #e0990a;
}

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

.tts-btn.speaking {
    background: #e0990a;
    border-color: #e0990a;
    color: white;
}

/* Font Size Classes */
body.font-size-small {
    font-size: 14px;
}

body.font-size-normal {
    font-size: 16px;
}

body.font-size-large {
    font-size: 18px;
}

body.font-size-xlarge {
    font-size: 22px;
}

/* High Contrast Mode - Common */
body.high-contrast .accessibility-toggle {
    border: 2px solid currentColor !important;
}

/* High Contrast Mode - Light Theme (Default) */
html:not(.dark) body.high-contrast {
    background: #ffffff !important;
    color: #000000 !important;
}

html:not(.dark) body.high-contrast * {
    border-color: #000000 !important;
}

html:not(.dark) body.high-contrast .card,
html:not(.dark) body.high-contrast .accessibility-panel {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    box-shadow: none !important;
}

html:not(.dark) body.high-contrast .btn-primary {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #000000 !important;
}

html:not(.dark) body.high-contrast .btn-outline {
    background: transparent !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    font-weight: bold !important;
}

html:not(.dark) body.high-contrast a {
    color: #0000ee !important;
    text-decoration: underline !important;
}

html:not(.dark) body.high-contrast .text-navy,
html:not(.dark) body.high-contrast .text-gray-600,
html:not(.dark) body.high-contrast .text-gray-700,
html:not(.dark) body.high-contrast .text-gray-800,
html:not(.dark) body.high-contrast .text-gray-900 {
    color: #000000 !important;
}

html:not(.dark) body.high-contrast .bg-gray-50,
html:not(.dark) body.high-contrast .bg-gray-100,
html:not(.dark) body.high-contrast .bg-gray-200 {
    background: #f0f0f0 !important;
}

html:not(.dark) body.high-contrast input,
html:not(.dark) body.high-contrast textarea,
html:not(.dark) body.high-contrast select {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
}

html:not(.dark) body.high-contrast .likert-label {
    color: #000000 !important;
    border: 2px solid #000000 !important;
}

html:not(.dark) body.high-contrast input[type="radio"]:checked + .likert-label {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

html:not(.dark) body.high-contrast .accessibility-toggle {
    background: #000000 !important;
    color: #ffffff !important;
}

html:not(.dark) body.high-contrast .accessibility-panel-title,
html:not(.dark) body.high-contrast .accessibility-option-label {
    color: #000000 !important;
}

html:not(.dark) body.high-contrast .accessibility-option-description {
    color: #444444 !important;
}

html:not(.dark) body.high-contrast .font-size-btn,
html:not(.dark) body.high-contrast .tts-btn {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
}

html:not(.dark) body.high-contrast .font-size-btn.active,
html:not(.dark) body.high-contrast .tts-btn.speaking {
    background: #000000 !important;
    color: #ffffff !important;
}

/* High Contrast Mode - Dark Theme */
html.dark body.high-contrast {
    background: #000000 !important;
    color: #ffffff !important;
}

html.dark body.high-contrast * {
    border-color: #ffffff !important;
}

html.dark body.high-contrast .card,
html.dark body.high-contrast .accessibility-panel {
    background: #1a1a1a !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

html.dark body.high-contrast .btn-primary {
    background: #ffff00 !important;
    color: #000000 !important;
    border: 2px solid #ffff00 !important;
}

html.dark body.high-contrast .btn-outline {
    background: transparent !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
}

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

html.dark body.high-contrast .text-navy,
html.dark body.high-contrast .text-gray-600,
html.dark body.high-contrast .text-gray-700,
html.dark body.high-contrast .text-gray-800,
html.dark body.high-contrast .text-gray-900 {
    color: #ffffff !important;
}

html.dark body.high-contrast .bg-gray-50,
html.dark body.high-contrast .bg-gray-100,
html.dark body.high-contrast .bg-gray-200 {
    background: #2a2a2a !important;
}

html.dark body.high-contrast input,
html.dark body.high-contrast textarea,
html.dark body.high-contrast select {
    background: #1a1a1a !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

html.dark body.high-contrast .likert-label {
    color: #ffffff !important;
}

html.dark body.high-contrast input[type="radio"]:checked + .likert-label {
    background: #ffff00 !important;
    color: #000000 !important;
    border-color: #ffff00 !important;
}

html.dark body.high-contrast .accessibility-toggle {
    background: #ffff00 !important;
    color: #000000 !important;
}

html.dark body.high-contrast .accessibility-panel-title {
    color: #ffffff !important;
}

html.dark body.high-contrast .accessibility-option-label {
    color: #ffffff !important;
}

html.dark body.high-contrast .accessibility-option-description {
    color: #cccccc !important;
}

html.dark body.high-contrast .font-size-btn,
html.dark body.high-contrast .tts-btn {
    background: #1a1a1a !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

html.dark body.high-contrast .font-size-btn.active,
html.dark body.high-contrast .tts-btn.speaking {
    background: #ffff00 !important;
    color: #000000 !important;
    border-color: #ffff00 !important;
}

/* Dark Mode Compatibility */
.dark .accessibility-panel {
    background: #1f2937;
    border: 1px solid #374151;
}

.dark .accessibility-panel-header {
    border-bottom-color: #374151;
}

.dark .accessibility-panel-title {
    color: #f3f4f6;
}

.dark .accessibility-panel-close {
    color: #9ca3af;
}

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

.dark .accessibility-option-label {
    color: #e5e7eb;
}

.dark .accessibility-option-description {
    color: #9ca3af;
}

.dark .font-size-btn,
.dark .tts-btn {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.dark .font-size-btn:hover,
.dark .tts-btn:hover {
    border-color: #e0990a;
}

.dark .font-size-btn.active,
.dark .tts-btn.speaking {
    background: #e0990a;
    border-color: #e0990a;
    color: white;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .accessibility-toggle {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }

    .accessibility-panel {
        bottom: 75px;
        right: 15px;
        left: 15px;
        width: auto;
    }
}

/* Reading Highlight for TTS */
.tts-highlight {
    background-color: #fef3c7 !important;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.3s;
}

/* Dark Mode TTS Highlight */
.dark .tts-highlight {
    background-color: #78350f !important;
    color: #ffffff !important;
}

body.high-contrast .tts-highlight {
    background-color: #ffff00 !important;
    color: #000000 !important;
}

/* Skip to Content Link (keyboard navigation) */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1em;
    background-color: #e0990a;
    color: white;
    text-decoration: none;
    font-weight: bold;
}

/* TTS Active State */
body.tts-active h1, 
body.tts-active h2, 
body.tts-active h3, 
body.tts-active h4, 
body.tts-active p, 
body.tts-active li, 
body.tts-active label,
body.tts-active .question-text {
    cursor: help !important;
}

body.tts-active .tts-highlight {
    background-color: rgba(224, 153, 10, 0.2);
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(224, 153, 10, 0.4);
}

.skip-to-content:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
}

/* Accessibility Modal */
.accessibility-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0.6s;
}

.accessibility-modal.active {
    pointer-events: all;
    visibility: visible;
}

.accessibility-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: 
        background 0.6s ease,
        backdrop-filter 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        -webkit-backdrop-filter 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.accessibility-modal.active .accessibility-modal-backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.accessibility-modal-content {
    position: relative;
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    transition: 
        opacity 0.4s ease 0.1s, 
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.accessibility-modal.active .accessibility-modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.accessibility-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.accessibility-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.accessibility-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    transition: color 0.2s;
}

.accessibility-modal-close:hover {
    color: #111827;
}

.accessibility-modal-body {
    padding: 20px;
    color: #374151;
    font-size: 1rem;
    line-height: 1.5;
}

.accessibility-modal-footer {
    padding: 16px 20px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.accessibility-modal .btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Modal Dark Mode */
.dark .accessibility-modal-content {
    background: #1f2937;
    border-color: #374151;
}

.dark .accessibility-modal-header,
.dark .accessibility-modal-footer {
    background: #111827;
    border-color: #374151;
}

.dark .accessibility-modal-title {
    color: #f3f4f6;
}

.dark .accessibility-modal-close {
    color: #9ca3af;
}

.dark .accessibility-modal-close:hover {
    color: #f3f4f6;
}

.dark .accessibility-modal-body {
    color: #d1d5db;
}

/* Modal High Contrast - Light */
html:not(.dark) body.high-contrast .accessibility-modal-backdrop {
    background: rgba(255, 255, 255, 0.8);
}

html:not(.dark) body.high-contrast .accessibility-modal-content {
    border: 4px solid #000000 !important;
    box-shadow: none !important;
    background: #ffffff !important;
}

html:not(.dark) body.high-contrast .accessibility-modal-header,
html:not(.dark) body.high-contrast .accessibility-modal-footer {
    background: #ffffff !important;
    border-color: #000000 !important;
}

html:not(.dark) body.high-contrast .accessibility-modal-title,
html:not(.dark) body.high-contrast .accessibility-modal-body,
html:not(.dark) body.high-contrast .accessibility-modal-close {
    color: #000000 !important;
}

/* Modal High Contrast - Dark */
html.dark body.high-contrast .accessibility-modal-backdrop {
    background: rgba(0, 0, 0, 0.8);
}

html.dark body.high-contrast .accessibility-modal-content {
    border: 4px solid #ffffff !important;
    box-shadow: none !important;
    background: #000000 !important;
}

html.dark body.high-contrast .accessibility-modal-header,
html.dark body.high-contrast .accessibility-modal-footer {
    background: #000000 !important;
    border-color: #ffffff !important;
}

html.dark body.high-contrast .accessibility-modal-title,
html.dark body.high-contrast .accessibility-modal-body,
html.dark body.high-contrast .accessibility-modal-close {
    color: #ffffff !important;
}
