/* =============================================
   modals.css
   =============================================
   Parte do CSS modularizado da aplicação.
   Contém estilos para: Janelas modais, overlays de fundo e botões/abas de símbolos e Emojis.
   Não alterar regras – apenas agrupar.
   ============================================= */

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10, 28, 64, 0.58); z-index: 9999; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.modal-content { background: linear-gradient(180deg, #ffffff, #f7faff); border-radius: 18px; width: 450px; max-width: 90vw; box-shadow: 0 30px 60px rgba(11,61,145,0.18); overflow: hidden; display: flex; flex-direction: column; animation: modalPop 0.2s ease-out; border: 1px solid #d6e3fb; }
@keyframes modalPop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border-color); background: linear-gradient(180deg, #f9fbff, #edf4ff); }
.modal-header h3 { font-size: 15px; color: var(--text-main); margin: 0; }
.modal-close {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: none;
    border-radius: 50%;
    background: #e6eefc;
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    box-shadow: none;
    transition: background-color 0.18s ease, color 0.18s ease;
}
.modal-close:hover,
.modal-close:focus-visible {
    background: var(--danger-color, #ef4444);
    color: #ffffff;
    outline: none;
}

.skills-modal-content {
    width: 780px;
    max-width: 95vw;
    height: 85vh;
    max-height: 680px;
    display: flex;
    flex-direction: column;
}

.skills-modal-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    overflow: hidden;
    background: #f8fafc;
}

.skills-modal-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.skills-modal-select {
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    flex: 1 1 220px;
    background: white;
    min-width: 0;
}

.skills-modal-select:disabled {
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: not-allowed;
}

.skills-modal-select-native-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.skills-modal-single-select {
    position: relative;
    flex: 1 1 220px;
    min-width: 0;
}

.skills-modal-single-trigger {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    /* 10px é o padrão dos selects fechados no app (form-select.css) */
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    background: white;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.skills-modal-single-trigger:hover:not(.is-disabled),
.skills-modal-single-trigger.is-open {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.skills-modal-single-trigger.is-disabled {
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: not-allowed;
}

.skills-modal-single-trigger i {
    flex: 0 0 auto;
    margin-top: 2px;
    transition: transform 0.2s ease;
}

.skills-modal-single-trigger.is-open i {
    transform: rotate(180deg);
}

.skills-modal-single-summary {
    flex: 1;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
}

.skills-modal-single-summary.is-placeholder {
    color: var(--text-muted);
}

.skills-modal-single-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #cbd5e1;
    /* 12px é o padrão de todas as listas suspensas do app */
    border-radius: 12px;
    background: white;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.16);
    z-index: 20;
    padding: 6px;
}

.skills-modal-single-option {
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-main);
}

.skills-modal-single-option:hover {
    background: #eff6ff;
}

.skills-modal-single-option.is-selected {
    background: #dbeafe;
    color: #1d4ed8;
}

.skills-modal-single-option-title {
    display: block;
    width: 100%;
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    color: #1d4ed8;
}

.skills-modal-single-option-text {
    font-size: 12px;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
    text-align: left;
}

.skills-modal-single-option.is-selected .skills-modal-single-option-title {
    color: #1e3a8a;
}

.skills-modal-search {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    background: white;
}

.skills-modal-search:focus,
.skills-modal-select:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.skills-modal-results {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    background: white;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.skills-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.skills-modal-message {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    color: var(--text-muted);
    padding: 24px 18px;
}

.skills-modal-message i {
    font-size: 42px;
    opacity: 0.55;
}

.skills-modal-message p {
    margin: 0;
    line-height: 1.5;
    max-width: 520px;
}

.skills-modal-message.is-error {
    color: #b91c1c;
}

.skills-picker-item {
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: background 0.2s, border-color 0.2s;
}

.skills-picker-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.skills-picker-checkbox {
    margin-top: 4px;
    transform: scale(1.15);
    cursor: pointer;
}

.skills-picker-label {
    font-size: 12px;
    cursor: pointer;
    line-height: 1.55;
    flex: 1;
    user-select: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.skills-picker-main {
    color: var(--text-main);
}

.skills-picker-code {
    color: var(--primary-color);
}

.skills-picker-separator {
    color: var(--text-main);
}

.skills-picker-meta {
    color: var(--text-muted);
}

.modal-tabs { display: flex; border-bottom: 1px solid var(--border-color); background: white; padding: 0 10px; }
.tab-btn { flex: 1; padding: 12px 0; background: transparent; border: none; border-bottom: 3px solid transparent; font-size: 13px; font-weight: bold; color: var(--text-muted); cursor: pointer; border-radius: 0; transition: 0.2s; }
.tab-btn:hover { color: var(--primary-color); }
.tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }

.modal-symbols-body { padding: 15px; height: 300px; overflow-y: auto; background: #f7faff; }
.symbol-grid { display: none; grid-template-columns: repeat(auto-fill, minmax(35px, 1fr)); gap: 6px; }
.symbol-grid.active-grid { display: grid; }
.symbol-grid button { width: 100%; aspect-ratio: 1; display: flex; justify-content: center; align-items: center; font-size: 18px; border: 1px solid var(--border-color); background: white; border-radius: 6px; cursor: pointer; padding: 0; margin: 0; transition: 0.1s; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.symbol-grid button:hover { background: var(--primary-light); border-color: var(--primary-color); transform: translateY(-1px); }

.emoji-container { display: none; justify-content: center; }
.emoji-container.active-grid { display: flex; }
emoji-picker { width: 100%; height: 270px; --background: #f7faff; border: none; }

/* ==========================================
   EDITOR DE EQUAÇÕES (KaTeX)
   ==========================================
   #mathModalOverlay de banco-questoes.html. Em criar-avaliacao.html o mesmo
   modal existe montado com style= inline — estas regras reproduzem aquele
   layout medida por medida, para que as duas páginas mostrem o mesmo painel.
   Se um dia o inline de lá for trocado por estas classes, o visual não muda.

   Os ids (#mathLatexInput, #mathSizeSlider, #mathPreview) são os que
   js/modules/editor.js procura: o layout mora aqui, o comportamento lá. */
.math-modal { width: 550px; max-width: 95vw; }
.math-modal-body { padding: 15px; background: #f8fafc; }

.math-label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: bold; color: var(--text-muted); }
/* Só o rótulo da pré-visualização respira: o de cima já vem espaçado pelo
   margin-bottom dos atalhos. */
.math-size-control + .math-label { margin-top: 15px; }

/* Os atalhos herdam .btn-secondary (toolbar.css); aqui só o arranjo.
   O link da documentação é empurrado para a direita por margin-left:auto. */
.latex-shortcuts { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 10px; }
.latex-shortcuts-docs { margin-left: auto; background: #eef4ff; color: #0b4fb3; border: 1px solid #c7dafd; text-decoration: none; box-shadow: none; }
.latex-shortcuts-docs:hover { background: #dde9ff; color: #0b4fb3; }

.math-input { width: 100%; height: 80px; padding: 10px; font-size: 14px; font-family: monospace; border: 1px solid var(--border-color); border-radius: 4px; resize: vertical; }
.math-input:focus { outline: none; border-color: var(--primary-color); }

.math-size-control { margin-top: 15px; padding: 10px; background: white; border: 1px solid var(--border-color); border-radius: 4px; }
.math-size-control .math-label { margin-top: 0; margin-bottom: 8px; }
.math-size-row { display: flex; align-items: center; gap: 10px; }
.math-size-row input[type="range"] { flex: 1; cursor: pointer; }
.math-size-row span { width: 45px; font-size: 13px; font-weight: bold; text-align: right; color: var(--primary-color); }

/* Borda tracejada: sinaliza que o quadro é espelho da fórmula, não um campo.
   O overflow-x deixa fórmula longa rolar em vez de esticar o modal. */
.math-preview { min-height: 60px; padding: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text-main); background: white; border: 1px dashed var(--primary-color); border-radius: 4px; overflow-x: auto; }

.math-modal-foot { display: flex; justify-content: flex-end; margin-top: 15px; }

#fontGhostNotification { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.5); background: rgba(37, 99, 235, 0.9); color: white; width: 60px; height: 60px; border-radius: 50%; font-size: 24px; font-weight: 900; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; z-index: 999999; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
#fontGhostNotification.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }


/* ==========================================
   BLOQUEADOR DE TELA (MOBILE)
   ========================================== */
.mobile-blocker {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, #f9fbff, #eef4ff);
    z-index: 999999; 
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.mobile-blocker-content {
    background: linear-gradient(180deg, #ffffff, #f6faff);
    padding: 40px 30px;
    border-radius: 18px;
    box-shadow: 0 20px 40px rgba(11, 61, 145, 0.12);
    max-width: 400px;
    border: 1px solid #d8e5fb;
}

.mobile-blocker i {
    font-size: 64px;
    color: #0284c7; 
    margin-bottom: 20px;
}

.mobile-blocker h2 {
    color: #1e293b;
    margin-bottom: 15px;
    font-size: 22px;
}

.mobile-blocker p {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* O GATILHO: Se a tela for de celular (até 768px de largura) */
@media (max-width: 768px) {
    .skills-modal-content {
        width: 96vw;
        height: 88vh;
    }

    .skills-modal-filters {
        flex-direction: column;
    }

    .skills-modal-select {
        flex-basis: auto;
        width: 100%;
    }

    .skills-modal-single-select {
        flex-basis: auto;
        width: 100%;
    }

    .mobile-blocker {
        display: flex; 
    }
    
    body {
        overflow: hidden; 
    }
}
