@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Cores principais */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    
    /* Cores de fundo */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    
    /* Cores de texto */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    /* Cores de status */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    
    /* Bordas */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transições */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1f3a 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   PROTEÇÕES ANTI-CÓPIA (quando ativado)
   ============================================ */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Enunciado e alternativas da prova: texto não copiável */
#provaColQuestoes .questao-enunciado,
#provaColQuestoes #questao-enunciado,
#provaColQuestoes .alternativas-list,
#provaColQuestoes .alternativa-item,
#provaColQuestoes .alternativa-content,
#provaColQuestoes .alternativa-letra {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Tabelas de dados no enunciado: único conteúdo copiável */
#provaColQuestoes .dados-copiaveis,
#provaColQuestoes .tabela-copiavel,
#provaColQuestoes .dados-copiaveis table,
#provaColQuestoes .dados-copiaveis th,
#provaColQuestoes .dados-copiaveis td {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    cursor: text;
}

#provaColQuestoes .dados-copiaveis {
    margin: 1rem 0;
    padding: 0.5rem;
    border: 1px dashed rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.05);
}

#realizandoProva.no-select #provaColQuestoes .dados-copiaveis,
#realizandoProva.no-select #provaColQuestoes .dados-copiaveis * {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.03);
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5rem;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    background: var(--bg-card);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   NAVEGAÇÃO
   ============================================ */
nav {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    display: inline-flex;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: var(--shadow-md);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   BOTÕES
   ============================================ */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-file {
    display: none;
}

.file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.image-preview {
    margin-top: 1rem;
    max-width: 300px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   GRID
   ============================================ */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ============================================
   TABELAS
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-tertiary);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-facil {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-medio {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-dificil {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.3s ease-out;
}

/* Mantem scrollbar vertical sempre visivel nos modais */
.modal .modal-content {
    overflow-y: scroll;
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: rgba(129, 140, 248, 0.75) rgba(255, 255, 255, 0.08);
}

.modal .modal-content::-webkit-scrollbar {
    width: 12px;
}

.modal .modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.modal .modal-content::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.75);
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.08);
}

.modal .modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.95);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   ALTERNATIVAS (para questões)
   ============================================ */
.alternativas-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alternativa-item {
    display: flex;
    gap: 1rem;
    align-items: start;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    transition: var(--transition);
}

.alternativa-item.correta {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.alternativa-letra {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 600;
}

.alternativa-content {
    flex: 1;
}

/* ============================================
   TIMER (para provas)
   ============================================ */
.timer {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 2px solid var(--primary);
    z-index: 100;
}

.timer-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
    font-variant-numeric: tabular-nums;
}

.timer.warning .timer-value {
    color: var(--warning);
    animation: pulse 1s infinite;
}

.timer.danger .timer-value {
    color: var(--error);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   LOADING
   ============================================ */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   UTILITIES
   ============================================ */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    nav {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .timer {
        top: auto;
        bottom: 1rem;
        right: 1rem;
    }
}

/* ============================================
   MODAL DE LOGIN
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
}

.modal-overlay .modal-content {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--border-color);
}

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

.w-100 {
    width: 100%;
}

.text-danger {
    color: var(--error);
    font-size: 0.9rem;
    display: none;
}

/* ============================================
   TOPICOS MULTIPLOS (SIMPLEBAR + CHECKBOXES)
   ============================================ */
.multi-topic-check-wrap {
    max-height: 185px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}

.multi-topic-check-list {
    padding: 0.35rem;
}

.multi-topic-check-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: max-content;
}

.multi-topic-check-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.multi-topic-check-item input {
    cursor: pointer;
}

/* Barra sempre aparente (independe do auto-hide do SO) */
#gerarProvaTopicosListaWrap .simplebar-track.simplebar-vertical {
    width: 12px;
    opacity: 1 !important;
    right: 2px;
}

#gerarProvaTopicosListaWrap .simplebar-track.simplebar-horizontal {
    height: 12px;
    opacity: 1 !important;
    bottom: 2px;
}

#gerarProvaTopicosListaWrap .simplebar-track.simplebar-vertical .simplebar-scrollbar,
#gerarProvaTopicosListaWrap .simplebar-track.simplebar-horizontal .simplebar-scrollbar {
    opacity: 1 !important;
}

#gerarProvaTopicosListaWrap .simplebar-track.simplebar-vertical .simplebar-scrollbar::before,
#gerarProvaTopicosListaWrap .simplebar-track.simplebar-horizontal .simplebar-scrollbar::before {
    background: rgba(129, 140, 248, 0.9);
    opacity: 1 !important;
}

/* ============================================
   PROVA COM PLANILHA INTEGRADA
   ============================================ */
.prova-layout {
    display: grid;
    grid-template-columns: minmax(280px, 7fr) minmax(280px, 3fr);
    gap: 1rem;
    align-items: start;
    min-height: calc(100vh - 2rem);
}

.prova-col-questoes {
    min-width: 0;
}

.prova-col-planilha {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 70vh;
    background: var(--bg-card);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    box-shadow: var(--shadow-md);
}

.prova-col-planilha.planilha-colapsada {
    min-height: auto;
}

.prova-col-planilha.planilha-colapsada .planilha-frame,
.prova-col-planilha.planilha-colapsada #painelPlanilhaSetup {
    display: none !important;
}

.planilha-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.planilha-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.planilha-setup h4 {
    margin-bottom: 0.35rem;
}

.planilha-upload-btn {
    width: 100%;
    max-width: 100%;
}

.planilha-botoes-provedor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-planilha {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-start;
    width: 100%;
    padding: 0.75rem 1rem;
    font-weight: 600;
}

.btn-google {
    background: #fff;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.btn-google:hover {
    background: #f9fafb;
}

.btn-microsoft {
    background: #0078d4;
    color: #fff;
    border: 1px solid #006cbd;
}

.btn-microsoft:hover {
    background: #106ebe;
}

.planilha-icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.08);
}

.btn-microsoft .planilha-icone {
    background: rgba(255, 255, 255, 0.2);
}

.planilha-status {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.planilha-status-success {
    color: var(--success);
}

.planilha-status-error {
    color: var(--error);
}

.planilha-acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.planilha-escolha-titulo {
    width: 100%;
    font-size: 0.9rem;
}

.planilha-travada {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    font-size: 0.9rem;
}

.planilha-aviso-inicio {
    font-size: 0.9rem;
}

.planilha-lista-arquivos {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 200px;
    overflow-y: auto;
}

.planilha-arquivo-item {
    text-align: left;
    width: 100%;
}

.planilha-frame {
    flex: 1;
    width: 100%;
    min-height: 60vh;
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: #fff;
}

.planilha-painel-ativo {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.planilha-ativa-card {
    padding: 1rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: var(--radius-md);
}

.planilha-ativa-card h4 {
    margin-bottom: 0.5rem;
    color: var(--success);
}

.planilha-botoes-acao {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-voltar-prova {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border: 1px solid #047857;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.btn-voltar-prova-grande {
    font-size: 1rem;
    padding: 0.75rem 1.25rem;
    letter-spacing: 0.02em;
    animation: pulse-voltar-prova 2.5s ease-in-out infinite;
}

@keyframes pulse-voltar-prova {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); transform: scale(1); }
    50% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); transform: scale(1.02); }
}

.btn-voltar-prova:hover {
    background: linear-gradient(135deg, #047857, #059669);
    color: #fff;
}

.barra-voltar-prova {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, #064e3b, #065f46);
    border-bottom: 3px solid #10b981;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.barra-voltar-prova-pulse {
    animation: barra-voltar-flash 0.6s ease-in-out 3;
}

@keyframes barra-voltar-flash {
    0%, 100% { border-bottom-color: #10b981; }
    50% { border-bottom-color: #fbbf24; background: linear-gradient(90deg, #065f46, #047857); }
}

.barra-voltar-prova.hidden {
    display: none !important;
}

.barra-voltar-prova-texto {
    color: #d1fae5;
    font-size: 0.95rem;
    font-weight: 600;
}

body.prova-excel-aberto {
    padding-top: 3.5rem;
}

body.prova-excel-aberto .prova-col-planilha {
    top: 3.75rem;
}

.fab-voltar-prova {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 99998;
    padding: 1rem 1.35rem;
    border-radius: 999px;
    border: 2px solid #047857;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.5);
    animation: pulse-voltar-prova 2.5s ease-in-out infinite;
}

.fab-voltar-prova.hidden {
    display: none !important;
}

.fab-voltar-prova:hover {
    background: linear-gradient(135deg, #047857, #059669);
}

.fab-voltar-prova-pulse {
    animation: fab-voltar-bounce 0.5s ease-in-out 4;
}

@keyframes fab-voltar-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.planilha-botoes-acao-destaque {
    flex-direction: column;
    align-items: stretch;
}

.planilha-botoes-acao-destaque .btn-voltar-prova-grande {
    width: 100%;
    text-align: center;
}

.planilha-aviso-nao-maximizar {
    padding: 0.5rem 0.75rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: var(--radius-md);
    color: #fcd34d;
    font-size: 0.85rem;
}

.modal-instrucao-excel {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(15, 23, 42, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-instrucao-excel.hidden {
    display: none !important;
}

.modal-instrucao-excel-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 480px;
    text-align: center;
    border: 2px solid #10b981;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-instrucao-excel-icone {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.modal-instrucao-excel-content h2 {
    color: var(--success);
    margin-bottom: 1rem;
}

.modal-instrucao-excel-acoes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

#realizandoProva.no-select .prova-col-planilha {
    user-select: auto;
    -webkit-user-select: auto;
}

@media (max-width: 1024px) {
    .prova-layout {
        grid-template-columns: 1fr;
    }

    .prova-col-planilha {
        position: static;
        min-height: 50vh;
    }

    .planilha-frame {
        min-height: 45vh;
    }
}

/* ============================================
   MATERIAIS DE CONSULTA NA PROVA
   ============================================ */
.materiais-prova-wrap {
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.materiais-prova-card {
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.06);
    padding: 0.75rem;
}

.materiais-prova-header h4 {
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
    color: var(--primary-light);
}

.materiais-prova-aviso {
    font-size: 0.8rem;
    margin-bottom: 0.65rem;
    line-height: 1.4;
}

.materiais-pastas {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.materiais-pasta {
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    overflow: hidden;
}

.materiais-pasta-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
}

.materiais-pasta-header::-webkit-details-marker {
    display: none;
}

.materiais-pasta-header::after {
    content: '▸';
    margin-left: auto;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.materiais-pasta[open] .materiais-pasta-header::after {
    transform: rotate(90deg);
}

.materiais-pasta-header:hover {
    background: rgba(99, 102, 241, 0.1);
}

.materiais-pasta-icone {
    font-size: 1.1rem;
}

.materiais-pasta-titulo {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.materiais-pasta-contagem {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    margin-right: 0.25rem;
}

.materiais-pasta-conteudo {
    padding: 0 0.75rem 0.75rem;
    border-top: 1px solid var(--bg-tertiary);
}

.materiais-secao {
    margin-top: 0.65rem;
}

.materiais-secao-titulo {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.materiais-lista {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.materiais-item-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.825rem;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.materiais-item-btn:hover {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.12);
    color: var(--text-primary);
}

.materiais-item-icone {
    flex-shrink: 0;
}

.materiais-item-nome {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.materiais-vazio {
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.prova-col-planilha.planilha-colapsada .materiais-prova-wrap {
    display: none;
}

#realizandoProva.no-select .materiais-prova-wrap,
#realizandoProva.no-select #modalMaterialViewer {
    user-select: auto;
    -webkit-user-select: auto;
}

/* Modal viewer de material */
.materiais-modal {
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
}

.materiais-modal:not(.hidden) {
    display: flex;
}

.materiais-modal-content {
    max-width: min(960px, 95vw);
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.materiais-modal-acoes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.materiais-modal-corpo {
    flex: 1;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.materiais-viewer-frame {
    flex: 1;
    width: 100%;
    min-height: 55vh;
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: #fff;
}

.materiais-viewer-imagem {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    min-height: 50vh;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
}

.materiais-viewer-imagem img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.materiais-erro-arquivo {
    margin-top: 0.75rem;
    padding: 0.75rem;
    font-size: 0.875rem;
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-md);
}

.materiais-erro-arquivo code {
    font-size: 0.8rem;
    color: var(--primary-light);
}

/* ============================================
   PROVA BLOQUEADA (troca de aba)
   ============================================ */

.prova-bloqueada-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1rem;
    padding: 0.65rem 1rem;
    background: #7f1d1d;
    color: #fecaca;
    font-size: 0.9rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.prova-bloqueada-banner strong {
    color: #fff;
}

.prova-bloqueada-alerta {
    padding: 0.75rem 1rem;
    background: rgba(185, 28, 28, 0.12);
    border: 1px solid rgba(185, 28, 28, 0.45);
    border-radius: var(--radius-md);
    color: #fca5a5;
    font-size: 0.9rem;
    font-weight: 600;
}

.modal-prova-bloqueada {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    padding: 1rem;
}

.modal-prova-bloqueada.hidden {
    display: none;
}

.modal-prova-bloqueada-content {
    background: var(--bg-card);
    border: 2px solid #b91c1c;
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.modal-prova-bloqueada-icone {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.modal-prova-bloqueada-content h2 {
    color: #fca5a5;
    margin: 0 0 1rem 0;
}

.modal-prova-bloqueada-content p {
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}

.modal-prova-bloqueada-acoes {
    margin: 1.25rem 0 0.75rem;
}

.modal-prova-bloqueada-contato {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem !important;
}

body:has(.prova-bloqueada-banner) .timer {
    top: 3.5rem;
}

body.prova-excel-aberto:has(.prova-bloqueada-banner) {
    padding-top: 6.5rem;
}

body.prova-excel-aberto .timer {
    top: 3.75rem;
}
