/**
 * Sistema de Acessibilidade - Portal do Artista
 * Estilos para melhorar a acessibilidade do site
 */

/* ============================================
   SKIP LINKS - Links para pular conteúdo
   ============================================ */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary-color, #6366f1);
    color: white;
    padding: 1rem 2rem;
    text-decoration: none;
    z-index: 10000;
    font-weight: 600;
    border-radius: 0 0 8px 0;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* ============================================
   FOCO VISÍVEL - Indicadores de foco
   ============================================ */
*:focus {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* ============================================
   ALTO CONTRASTE
   ============================================ */
body.high-contrast {
    background: #000000 !important;
    color: #ffffff !important;
}

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

body.high-contrast .navbar,
body.high-contrast .card,
body.high-contrast .modal-content {
    background: #000000 !important;
    border: 2px solid #ffffff !important;
}

body.high-contrast .btn-primary,
body.high-contrast .btn-outline-primary {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
}

body.high-contrast .btn-primary:hover,
body.high-contrast .btn-outline-primary:hover {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

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

body.high-contrast a:visited {
    color: #ffaa00 !important;
}

body.high-contrast a:focus {
    outline: 3px solid #ffff00 !important;
    background: #ffff00 !important;
    color: #000000 !important;
}

/* ============================================
   TAMANHO DE FONTE
   ============================================ */
body.font-small {
    font-size: 0.875rem;
}

body.font-normal {
    font-size: 1rem;
}

body.font-large {
    font-size: 1.125rem;
}

body.font-extra-large {
    font-size: 1.25rem;
}

body.font-extra-large * {
    line-height: 1.8;
}

/* ============================================
   BOTÃO FLUTUANTE DE ACESSIBILIDADE
   ============================================ */
.accessibility-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color, #6366f1), var(--secondary-color, #8b5cf6));
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    padding: 0;
}

.accessibility-toggle-btn:hover,
.accessibility-toggle-btn:focus {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.accessibility-toggle-btn:active {
    transform: scale(0.95);
}

.accessibility-toggle-btn[aria-expanded="true"] {
    background: linear-gradient(135deg, var(--secondary-color, #8b5cf6), var(--primary-color, #6366f1));
}

.accessibility-toggle-btn[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.accessibility-toggle-btn i {
    transition: transform 0.3s ease;
}

/* ============================================
   BARRA DE ACESSIBILIDADE
   ============================================ */
.accessibility-bar {
    background: var(--dark-color, #1f2937);
    color: white;
    padding: 0.75rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

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

.accessibility-bar[aria-hidden="false"],
.accessibility-bar:not([aria-hidden="true"]) {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.accessibility-bar[aria-hidden="true"] {
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
}

body.accessibility-bar-visible {
    padding-top: 60px;
}

.accessibility-bar button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.accessibility-bar button:hover,
.accessibility-bar button:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
    outline: 2px solid white;
    outline-offset: 2px;
}

.accessibility-bar button.active {
    background: var(--primary-color, #6366f1);
    border-color: var(--primary-color, #6366f1);
}

.accessibility-close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 35px;
    height: 35px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.accessibility-close-btn:hover,
.accessibility-close-btn:focus {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.accessibility-bar .separator {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   ANÚNCIOS PARA LEITORES DE TELA
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================
   REGIÃO DE ANÚNCIOS (LIVE REGION)
   ============================================ */
.live-region {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ============================================
   NAVEGAÇÃO POR TECLADO
   ============================================ */
.keyboard-navigation * {
    outline: none;
}

.keyboard-navigation *:focus {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
}

/* ============================================
   CONTRASTE DE CORES
   ============================================ */
.low-contrast-warning {
    border: 2px dashed #f59e0b;
    padding: 0.5rem;
    background: #fef3c7;
    color: #92400e;
}

/* ============================================
   ANIMAÇÕES REDUZIDAS
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* ============================================
   ESTRUTURA SEMÂNTICA
   ============================================ */
main {
    min-height: 60vh;
}

section[aria-labelledby],
section[aria-label] {
    padding: 2rem 0;
}

/* ============================================
   FORMULÁRIOS ACESSÍVEIS
   ============================================ */
.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.form-control:invalid {
    border-color: var(--danger-color, #ef4444);
}

.form-control:invalid:focus {
    outline-color: var(--danger-color, #ef4444);
}

.error-message {
    color: var(--danger-color, #ef4444);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.error-message[role="alert"] {
    font-weight: 600;
}

/* ============================================
   BOTÕES E LINKS ACESSÍVEIS
   ============================================ */
button:disabled,
a[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

button:not(:disabled):hover,
a:not([aria-disabled="true"]):hover {
    opacity: 0.9;
}

/* ============================================
   IMAGENS E MÍDIA
   ============================================ */
img[alt=""] {
    border: 2px dashed #f59e0b;
}

img:not([alt]) {
    border: 2px dashed var(--danger-color, #ef4444);
}

/* ============================================
   MODAIS ACESSÍVEIS
   ============================================ */
.modal[aria-hidden="true"] {
    display: none;
}

.modal[aria-hidden="false"] {
    display: block;
}

/* ============================================
   NAVEGAÇÃO ACESSÍVEL
   ============================================ */
nav[role="navigation"] ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

nav[role="navigation"] a[aria-current="page"] {
    font-weight: 700;
    text-decoration: underline;
}

/* ============================================
   RESPONSIVIDADE PARA ACESSIBILIDADE
   ============================================ */
@media (max-width: 768px) {
    .accessibility-toggle-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .accessibility-bar {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .accessibility-bar button {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    body.accessibility-bar-visible {
        padding-top: 80px;
    }
}

/* ============================================
   INDICADORES DE CARREGAMENTO
   ============================================ */
.loading-spinner[aria-busy="true"] {
    position: relative;
}

.loading-spinner[aria-busy="true"]::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color, #6366f1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   TABS ACESSÍVEIS
   ============================================ */
[role="tablist"] {
    display: flex;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
}

[role="tab"] {
    padding: 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
}

[role="tab"][aria-selected="true"] {
    border-bottom-color: var(--primary-color, #6366f1);
    color: var(--primary-color, #6366f1);
    font-weight: 700;
}

[role="tab"]:focus {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: -3px;
}

[role="tabpanel"][aria-hidden="true"] {
    display: none;
}

[role="tabpanel"][aria-hidden="false"] {
    display: block;
}

/* ============================================
   LANDMARKS (PONTOS DE REFERÊNCIA)
   ============================================ */
[role="banner"],
[role="navigation"],
[role="main"],
[role="contentinfo"],
[role="complementary"] {
    position: relative;
}

/* ============================================
   TEXTO ALTERNATIVO VISÍVEL
   ============================================ */
.alt-text-visible {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem;
    font-size: 0.875rem;
}

