/* ========================================
   Estilos Personalizados para o VLibras
   ======================================== */

/* ---- Estilo do Container Principal ---- */
[vw] {
    z-index: 1000;
    font-family: 'Poppins', sans-serif;
    position: fixed;
    pointer-events: auto !important;
}

/* Bloqueia cliques no container quando nenhum elemento visível está ativo */
[vw] > *:not([vw-plugin-wrapper]) {
    pointer-events: none !important;
}

[vw].vlibras-no-animations * {
    animation: none !important;
    transition: none !important;
}

/* ---- Estilo do Botão de Acesso ---- */
/* Escondido completamente sem remover do DOM */
[vw-access-button] {
    position: fixed !important;
    left: -99999px !important;
    top: -99999px !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -99999 !important;
    clip-path: polygon(0 0) !important;
    opacity: 0 !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

[vw-access-button]:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

[vw-access-button]:active {
    transform: scale(0.95);
    border: 1px solid red;
}

[vw-access-button] img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    display: block;
}

/* ---- Estilo do Plugin Wrapper ---- */
[vw-plugin-wrapper] {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    background: #ffffff;
    max-height: 600px;
    animation: vlibrasSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[vw-plugin-wrapper].active {
    display: block !important;
    opacity: 1 !important;
}

/* ---- Animações ---- */
@keyframes vlibrasSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

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

/* ---- Top Wrapper Customização ---- */
[vw-plugin-wrapper] .vw-plugin-top-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* ---- Botões de Header ---- */
[vw-plugin-wrapper] .vpw-header-btn-close,
[vw-plugin-wrapper] .vpw-header-btn-dictionary,
[vw-plugin-wrapper] .vpw-header-btn-settings {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    font-size: 18px;
}

[vw-plugin-wrapper] .vpw-header-btn-close:hover,
[vw-plugin-wrapper] .vpw-header-btn-dictionary:hover,
[vw-plugin-wrapper] .vpw-header-btn-settings:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

[vw-plugin-wrapper] .vpw-header-btn-close:active,
[vw-plugin-wrapper] .vpw-header-btn-dictionary:active,
[vw-plugin-wrapper] .vpw-header-btn-settings:active {
    transform: scale(0.95);
}

/* ---- Inputs e Controles ---- */
[vw-plugin-wrapper] input[type='range'] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

[vw-plugin-wrapper] input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease-in-out;
}

[vw-plugin-wrapper] input[type='range']::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

[vw-plugin-wrapper] input[type='range']::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease-in-out;
}

[vw-plugin-wrapper] input[type='range']::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

/* ---- Checkboxes ---- */
[vw-plugin-wrapper] input[type='checkbox'] {
    cursor: pointer;
    accent-color: #667eea;
    width: 18px;
    height: 18px;
}

[vw-plugin-wrapper] label {
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s ease-in-out;
}

[vw-plugin-wrapper] label:hover {
    color: #667eea;
}

/* ---- Botões Genéricos ---- */
[vw-plugin-wrapper] button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

[vw-plugin-wrapper]
    button:hover:not(.vpw-header-btn-close):not(.vpw-header-btn-dictionary):not(
        .vpw-header-btn-settings
    ) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

[vw-plugin-wrapper]
    button:active:not(.vpw-header-btn-close):not(
        .vpw-header-btn-dictionary
    ):not(.vpw-header-btn-settings) {
    transform: translateY(0);
}

/* ---- Scroll Customizado ---- */
[vw-plugin-wrapper]::-webkit-scrollbar {
    width: 8px;
}

[vw-plugin-wrapper]::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

[vw-plugin-wrapper]::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

[vw-plugin-wrapper]::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653890 100%);
}

/* ---- Responsividade ---- */
@media (max-width: 768px) {
    [vw-access-button] {
        left: -10000px !important;
        top: -10000px !important;
    }

    [vw-access-button] img {
        width: 0 !important;
        height: 0 !important;
    }

    [vw-plugin-wrapper] {
        max-height: 500px;
        border-radius: 8px;
    }

    [vw-plugin-wrapper] .vw-plugin-top-wrapper {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    [vw-access-button] {
        left: -10000px !important;
        top: -10000px !important;
    }

    [vw-access-button] img {
        width: 0 !important;
        height: 0 !important;
    }

    [vw-plugin-wrapper] {
        max-height: 400px;
        max-width: 90vw;
    }
}

/* ---- Modo Escuro ---- */
@media (prefers-color-scheme: dark) {
    [vw-plugin-wrapper] {
        background: #1e1e1e;
        color: #ffffff;
    }

    [vw-plugin-wrapper] .vw-plugin-top-wrapper {
        background: linear-gradient(135deg, #5568d3 0%, #653890 100%);
    }

    [vw-plugin-wrapper] input[type='range'] {
        background: #333;
    }

    [vw-plugin-wrapper] label {
        color: #e0e0e0;
    }

    [vw-plugin-wrapper]::-webkit-scrollbar-track {
        background: #2a2a2a;
    }
}

/* ---- Acessibilidade ---- */
[vw-access-button]:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

[vw-plugin-wrapper] button:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 1px;
}

[vw-plugin-wrapper] input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 1px;
}

/* ---- Classes Utilitárias ---- */
.vlibras-hidden {
    display: none !important;
}

.vlibras-visible {
    display: block !important;
}

.vlibras-opacity-full {
    opacity: 1 !important;
}

.vlibras-opacity-half {
    opacity: 0.5 !important;
}

.vlibras-opacity-low {
    opacity: 0.3 !important;
}
