/* ═══════════════════════════════════════════════════
   PNIA — Módulo 15: Plano de 5 Anos — v1.0.0
   ═══════════════════════════════════════════════════ */

/* ── Wrap geral ─────────────────────────────────────── */
.pnia-m15-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a2e;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 4px;
}

/* ── Hero ────────────────────────────────────────────── */
.pnia-m15-hero {
    text-align: center;
    padding: 32px 16px 20px;
}
.pnia-m15-hero-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 8px;
}
.pnia-m15-hero h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: #1a1a2e;
}
.pnia-m15-hero p {
    color: #555;
    font-size: 1rem;
    margin: 0;
    max-width: 520px;
    margin: 0 auto;
}

/* ── Formulário de início ────────────────────────────── */
.pnia-m15-form-card {
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 12px;
    padding: 28px;
    margin-top: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.pnia-m15-form-card h3 {
    margin: 0 0 20px;
    font-size: 1.05rem;
    color: #2d3561;
}
.pnia-m15-field {
    margin-bottom: 18px;
}
.pnia-m15-field label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: #333;
}
.pnia-m15-field textarea,
.pnia-m15-field input[type="text"] {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #333;
    background: #fafbff;
    box-sizing: border-box;
    transition: border-color 0.2s;
    resize: vertical;
}
.pnia-m15-field textarea:focus,
.pnia-m15-field input[type="text"]:focus {
    outline: none;
    border-color: #6c63ff;
    background: #fff;
}

/* ── Botões ──────────────────────────────────────────── */
.pnia-m15-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.pnia-m15-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.pnia-m15-btn-primary {
    background: linear-gradient(135deg, #6c63ff, #5a52e0);
    color: #fff;
    box-shadow: 0 3px 12px rgba(108,99,255,0.3);
    margin-top: 8px;
}
.pnia-m15-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(108,99,255,0.4);
}
.pnia-m15-btn-secondary {
    background: #2ecc71;
    color: #fff;
}
.pnia-m15-btn-secondary:hover:not(:disabled) {
    background: #27ae60;
}
.pnia-m15-btn-outline {
    background: transparent;
    color: #6c63ff;
    border: 1.5px solid #6c63ff;
}
.pnia-m15-btn-outline:hover:not(:disabled) {
    background: #f0eeff;
}
.pnia-m15-btn-icon {
    font-size: 1.1em;
}

/* ── Toolbar ─────────────────────────────────────────── */
.pnia-m15-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0 16px;
    border-bottom: 1px solid #eee;
    margin-bottom: 16px;
}
.pnia-m15-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pnia-m15-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.pnia-m15-badge {
    background: #f0f0f0;
    color: #666;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}
.pnia-m15-badge-alterado {
    background: #fff3cd;
    color: #856404;
}
.pnia-m15-badge-concluido {
    background: #d4edda;
    color: #155724;
}
.pnia-m15-versao {
    font-size: 0.78rem;
    color: #999;
}

/* ── Preview / Markdown ──────────────────────────────── */
.pnia-m15-preview {
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 10px;
    padding: 28px 32px;
    min-height: 300px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
    user-select: text;
    cursor: text;
}
.pnia-m15-preview h1 {
    font-size: 1.6rem;
    color: #1a1a2e;
    border-bottom: 2px solid #6c63ff;
    padding-bottom: 8px;
    margin-top: 0;
}
.pnia-m15-preview h2 {
    font-size: 1.25rem;
    color: #2d3561;
    margin-top: 28px;
    border-left: 3px solid #6c63ff;
    padding-left: 10px;
}
.pnia-m15-preview h3 {
    font-size: 1.05rem;
    color: #444;
    margin-top: 18px;
}
.pnia-m15-preview h4 {
    font-size: 0.95rem;
    color: #555;
}
.pnia-m15-preview p { line-height: 1.7; margin: 10px 0; }
.pnia-m15-preview ul { margin: 8px 0 8px 20px; }
.pnia-m15-preview li { margin-bottom: 4px; line-height: 1.6; }
.pnia-m15-preview strong { color: #1a1a2e; }
.pnia-m15-preview hr {
    border: none;
    border-top: 1px solid #e8eaf0;
    margin: 24px 0;
}

/* ── Textarea (modo edição) ──────────────────────────── */
.pnia-m15-textarea {
    width: 100%;
    min-height: 500px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 20px;
    font-size: 0.88rem;
    font-family: 'Courier New', monospace;
    line-height: 1.7;
    color: #333;
    background: #fafbff;
    box-sizing: border-box;
    resize: vertical;
}
.pnia-m15-textarea:focus {
    outline: none;
    border-color: #6c63ff;
    background: #fff;
}
.pnia-m15-edit-hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 6px;
    padding: 8px 12px;
    background: #f8f8ff;
    border-radius: 6px;
}

/* ── Loading ─────────────────────────────────────────── */
.pnia-m15-loading {
    text-align: center;
    padding: 60px 20px;
}
.pnia-m15-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e8eaf0;
    border-top-color: #6c63ff;
    border-radius: 50%;
    animation: pnia-m15-spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
.pnia-m15-spinner-sm {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e8eaf0;
    border-top-color: #6c63ff;
    border-radius: 50%;
    animation: pnia-m15-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes pnia-m15-spin {
    to { transform: rotate(360deg); }
}
.pnia-m15-loading p {
    color: #666;
    font-size: 0.95rem;
}

/* ── Menu flutuante ──────────────────────────────────── */
.pnia-m15-menu-flutuante {
    position: absolute;
    z-index: 9999;
    background: #fff;
    border: 1px solid #e0e0f0;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.14);
    min-width: 280px;
}
.pnia-m15-mf-titulo {
    font-size: 0.8rem;
    font-weight: 700;
    color: #6c63ff;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pnia-m15-mf-acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.pnia-m15-mf-btn {
    background: #f0eeff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #5a52e0;
    cursor: pointer;
    transition: background 0.15s;
}
.pnia-m15-mf-btn:hover {
    background: #ddd8ff;
}
.pnia-m15-mf-custom {
    display: flex;
    gap: 6px;
}
.pnia-m15-mf-custom input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-family: inherit;
}
.pnia-m15-mf-custom input:focus {
    outline: none;
    border-color: #6c63ff;
}
.pnia-m15-mf-custom button {
    background: #6c63ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}
.pnia-m15-mf-loading {
    display: flex;
    align-items: center;
    padding: 8px 0;
    color: #666;
    font-size: 0.85rem;
}
.pnia-m15-mf-fechar {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 0.9rem;
    color: #999;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.pnia-m15-mf-fechar:hover { color: #333; background: #f0f0f0; }

/* ── Banner concluído ────────────────────────────────── */
.pnia-m15-concluido-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #e8f5e9, #f0fff4);
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 20px;
    font-size: 1.5rem;
}
.pnia-m15-concluido-banner div { flex: 1; }
.pnia-m15-concluido-banner strong {
    display: block;
    font-size: 1rem;
    color: #1b5e20;
    margin-bottom: 2px;
}
.pnia-m15-concluido-banner p {
    margin: 0;
    font-size: 0.85rem;
    color: #388e3c;
}

/* ── Responsivo ──────────────────────────────────────── */
@media (max-width: 600px) {
    .pnia-m15-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .pnia-m15-toolbar-right {
        width: 100%;
    }
    .pnia-m15-preview {
        padding: 16px;
    }
    .pnia-m15-menu-flutuante {
        min-width: 240px;
        left: 10px !important;
    }
}
