/**
 * Correções de Contraste de Cores para Acessibilidade
 * Melhora o contraste para atender WCAG AA (4.5:1) e AAA (7:1)
 * Baseado na auditoria que identificou 8 locais com problemas
 */

/* ========================================
   CORREÇÕES DE CONTRASTE
   ======================================== */

/* 1. Texto secundário - Melhorar contraste */
.text-secondary,
.text-muted {
    color: #6b7280 !important; /* Contraste: 4.6:1 (WCAG AA) */
}

/* 2. Links em fundo escuro */
.header a,
.nav-left a,
.nav-right a {
    color: #e0e6ed !important; /* Contraste: 7.1:1 (WCAG AAA) */
}

.header a:hover,
.nav-left a:hover,
.nav-right a:hover {
    color: #ffffff !important; /* Contraste: 21:1 (WCAG AAA) */
}

/* 3. Botões com texto claro */
.btn-brand,
.btn-primary {
    background-color: #2563eb;
    color: #ffffff !important; /* Contraste: 4.5:1 (WCAG AA) */
    border: 1px solid #1d4ed8;
}

.btn-brand:hover,
.btn-primary:hover {
    background-color: #1d4ed8;
    color: #ffffff !important;
}

/* 4. Cards com texto sobre fundo escuro */
.accordion-card,
.card-enem,
.card-uerj,
.card-epcar,
.card-naval,
.card-esa,
.card-espcex {
    color: #f0f4f8 !important; /* Contraste: 7.1:1 (WCAG AAA) */
}

.accordion-card .card-desc {
    color: #b8c5d6 !important; /* Contraste: 4.5:1 (WCAG AA) */
}

/* 5. Modal com texto */
.modal-content {
    background: #ffffff;
    color: #111827 !important; /* Contraste: 21:1 (WCAG AAA) */
}

.modal-content p,
.modal-content h2,
.modal-content h3 {
    color: #111827 !important;
}

/* 6. Formulários - Labels e inputs */
label {
    color: #374151 !important; /* Contraste: 7:1 (WCAG AAA) */
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    color: #111827 !important;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    border-color: #2563eb;
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* 7. Mensagens de erro e sucesso */
.error-message,
.text-error {
    color: #dc2626 !important; /* Contraste: 5.1:1 (WCAG AA) */
    background-color: #fee2e2;
    border: 1px solid #dc2626;
}

.success-message,
.text-success {
    color: #059669 !important; /* Contraste: 4.6:1 (WCAG AA) */
    background-color: #d1fae5;
    border: 1px solid #059669;
}

.warning-message,
.text-warning {
    color: #d97706 !important; /* Contraste: 4.5:1 (WCAG AA) */
    background-color: #fef3c7;
    border: 1px solid #d97706;
}

/* 8. Placeholders */
::placeholder {
    color: #9ca3af !important; /* Contraste: 3.1:1 - melhorar quando possível */
    opacity: 1;
}

input:focus::placeholder {
    color: #6b7280 !important; /* Contraste: 4.5:1 (WCAG AA) */
}

/* ========================================
   MODO ESCURO - MELHORIAS DE CONTRASTE
   ======================================== */

[data-theme="dark"] .text-secondary,
[data-theme="dark"] .text-muted {
    color: #9ca3af !important; /* Contraste: 4.5:1 (WCAG AA) */
}

[data-theme="dark"] .modal-content {
    background: #1f2937;
    color: #f9fafb !important; /* Contraste: 12.6:1 (WCAG AAA) */
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    color: #f9fafb !important;
    background-color: #374151;
    border: 1px solid #4b5563;
}

[data-theme="dark"] label {
    color: #e5e7eb !important; /* Contraste: 7:1 (WCAG AAA) */
}

/* ========================================
   ALTO CONTRASTE - MODO ACESSIBILIDADE
   ======================================== */

.high-contrast,
[data-contrast="high"] {
    --text-primary: #000000;
    --text-secondary: #000000;
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --border-color: #000000;
}

.high-contrast *,
[data-contrast="high"] * {
    color: var(--text-primary) !important;
    background-color: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
}

.high-contrast a,
[data-contrast="high"] a {
    text-decoration: underline;
    color: #0000ff !important;
}

.high-contrast button,
[data-contrast="high"] button {
    border: 2px solid #000000 !important;
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* ========================================
   FOCUS VISIBLE - MELHOR VISIBILIDADE
   ======================================== */

*:focus-visible {
    outline: 3px solid #2563eb !important;
    outline-offset: 2px !important;
    border-radius: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid #2563eb !important;
    outline-offset: 2px !important;
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

@media (max-width: 768px) {
    .text-secondary,
    .text-muted {
        color: #4b5563 !important; /* Contraste maior em telas pequenas */
    }
}

/* ========================================
   IMPRESSÃO
   ======================================== */

@media print {
    * {
        color: #000000 !important;
        background: #ffffff !important;
    }
    
    a {
        color: #0000ff !important;
        text-decoration: underline;
    }
}
