/* modals.css — modal genérico (.modal/.modal-content), modal de diálogo
   (alerta/confirmação) e modal de Projetos. Transcrito byte-a-byte do
   IntraOnline (css/editor.css, secção "MODAL & ALERTS"). */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    /* Bem acima de qualquer z-index de bloco (Camada Z, definida livremente
       pelo utilizador) — .preview-frame tem transform:scale(), que cria um
       stacking context próprio, mas nunca deve conseguir ultrapassar um
       modal fixed no topo do documento. */
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-panel);
    border-radius: var(--radius);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 14px;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover {
    color: white;
}

.modal-body {
    flex: 1;
    padding: 18px;
    overflow: auto;
}

.app-dialog-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Projetos */
.projects-modal-actions {
    display: flex;
    gap: 8px;
}

.projects-modal-actions input {
    flex: 1;
}

.projects-modal-note {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.control-group .projects-current-title {
    display: block;
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.projects-saved-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.projects-saved-count {
    color: var(--text-muted);
    font-weight: 300;
}

.projects-saved-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
    padding-right: 4px;
}

.project-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--bg-darker);
}

.project-row-main {
    min-width: 0;
}

.project-row-name {
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-row-meta {
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 2px;
}

.project-row-actions {
    display: inline-flex;
    gap: 6px;
}

.project-action-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

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

.project-action-btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.project-action-btn-danger:hover {
    background: rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.project-rename-input {
    width: 100%;
    margin-top: 6px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12px;
}

.projects-empty {
    color: var(--text-secondary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}
