/**
 * Widget de Acessibilidade OnCabo
 * Controles de acessibilidade conforme WCAG 2.1
 */

/* ===================================
   BOTÃO DE ACESSIBILIDADE
   =================================== */
.accessibility-button {
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 9999;
    background: var(--oncabo-primary, #0c3c6c);
    color: #0F172A;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(26, 58, 92, 0.4);
    transition: all 0.3s ease;
    border: none;
}

.accessibility-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(26, 58, 92, 0.6);
}

.accessibility-button svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

/* ===================================
   PAINEL DE ACESSIBILIDADE
   =================================== */
.accessibility-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 360px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transition: right 0.4s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.accessibility-panel.open {
    right: 0;
}

.accessibility-panel-header {
    background: var(--oncabo-navy, #0c3c6c);
    color: #fff;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accessibility-panel-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.accessibility-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.accessibility-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.accessibility-panel-content {
    padding: 1.5rem;
    flex: 1;
}

.accessibility-section {
    margin-bottom: 2rem;
}

.accessibility-section h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--oncabo-navy, #0c3c6c);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.accessibility-section svg {
    width: 20px;
    height: 20px;
}

/* ===================================
   CONTROLES
   =================================== */
.accessibility-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.accessibility-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #F8F9FA;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.accessibility-control:hover {
    background: #E9ECEF;
    transform: translateX(-2px);
}

.accessibility-control.active {
    background: rgba(0, 255, 0, 0.1);
    border-color: var(--oncabo-primary, #0c3c6c);
}

.control-info {
    flex: 1;
}

.control-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

.control-description {
    font-size: 0.875rem;
    color: #6B7280;
}

.control-toggle {
    width: 50px;
    height: 26px;
    background: #CBD5E1;
    border-radius: 13px;
    position: relative;
    transition: background 0.3s ease;
}

.accessibility-control.active .control-toggle {
    background: var(--oncabo-primary, #0c3c6c);
}

.control-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.accessibility-control.active .control-toggle::after {
    left: 27px;
}

/* ===================================
   CONTROLE DE TAMANHO DE FONTE
   =================================== */
.font-size-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.font-size-btn {
    flex: 1;
    min-width: 100px;
    padding: 0.75rem 1rem;
    background: #F8F9FA;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s ease;
}

.font-size-btn:hover {
    background: #E9ECEF;
    border-color: #D1D5DB;
}

.font-size-btn.active {
    background: var(--oncabo-primary, #0c3c6c);
    border-color: var(--oncabo-primary, #0c3c6c);
    color: #0F172A;
}

/* ===================================
   BOTÃO DE RESET
   =================================== */
.accessibility-reset {
    width: 100%;
    padding: 1rem;
    background: #6B7280;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.accessibility-reset:hover {
    background: #4B5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===================================
   OVERLAY
   =================================== */
.accessibility-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.accessibility-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ===================================
   MODOS DE ACESSIBILIDADE APLICADOS
   =================================== */

/* Alto Contraste */
body.high-contrast {
    filter: contrast(150%) brightness(90%);
}

body.high-contrast * {
    text-shadow: none !important;
}

/* Escala de Cinza */
body.grayscale {
    filter: grayscale(100%);
}

/* Destacar Links */
body.highlight-links a {
    background-color: rgba(0, 255, 0, 0.2) !important;
    outline: 2px solid var(--oncabo-green, var(--oncabo-primary, #0c3c6c)) !important;
    outline-offset: 2px;
}

/* Destacar Títulos */
body.highlight-titles h1,
body.highlight-titles h2,
body.highlight-titles h3,
body.highlight-titles h4,
body.highlight-titles h5,
body.highlight-titles h6 {
    background-color: rgba(0, 255, 0, 0.15) !important;
    padding: 0.25rem 0.5rem !important;
    border-left: 4px solid var(--oncabo-green, var(--oncabo-primary, #0c3c6c)) !important;
}

/* Esconder Imagens */
body.hide-images img:not(.accessibility-button img) {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Cursor Grande */
body.big-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 fill="%2300FF00" d="M4 4 L4 28 L12 20 L16 28 L20 26 L16 18 L24 18 Z"/><path fill="%23000" d="M6 6 L6 24 L12 18 L14 24 L16 23 L14 17 L20 17 Z"/></svg>'), auto !important;
}

/* Linha de Leitura */
body.reading-guide::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--oncabo-primary, #0c3c6c);
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.4);
    z-index: 9997;
    pointer-events: none;
}

/* Tamanhos de Fonte */
body.font-size-small {
    font-size: 14px !important;
}

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

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

body.font-size-xlarge {
    font-size: 20px !important;
}

/* ===================================
   RESPONSIVIDADE
   =================================== */
@media (max-width: 768px) {
    .accessibility-panel {
        width: 100%;
        right: -100%;
    }

    .accessibility-button {
        bottom: 80px;
        right: 15px;
        width: 50px;
        height: 50px;
    }

    .accessibility-button svg {
        width: 24px;
        height: 24px;
    }
}

/* ===================================
   ANIMAÇÕES
   =================================== */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.accessibility-panel.open .accessibility-section {
    animation: fadeInRight 0.4s ease forwards;
}

.accessibility-panel.open .accessibility-section:nth-child(1) { animation-delay: 0.1s; }
.accessibility-panel.open .accessibility-section:nth-child(2) { animation-delay: 0.2s; }
.accessibility-panel.open .accessibility-section:nth-child(3) { animation-delay: 0.3s; }

/* ===================================
   MODO DE IMPRESSÃO
   =================================== */
@media print {
    .accessibility-button,
    .accessibility-panel,
    .accessibility-overlay {
        display: none !important;
    }
}
