/* =============================================================================
   v2-forms.css — Primitivos de formulário
   Complementa o v2-components.css, que não tem input, label, select,
   textarea, checkbox, tabela, alerta nem modal.

   Mesma convenção BEM, mesmos tokens.
   ============================================================================= */

/* ── CAMPO ────────────────────────────────────────────────────────────────── */
.v2-field {
    margin-bottom: 16px;
}
.v2-field--inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.v2-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--v2-text-muted);
    letter-spacing: 0.2px;
    margin-bottom: 6px;
}
.v2-label__req {
    color: var(--v2-danger);
    margin-left: 2px;
}

.v2-help {
    font-size: 12px;
    line-height: 1.45;
    color: var(--v2-text-dim);
    margin-top: 5px;
}
.v2-error {
    font-size: 12px;
    font-weight: 500;
    color: var(--v2-danger);
    margin-top: 5px;
}

/* ── INPUT / SELECT / TEXTAREA ────────────────────────────────────────────── */
.v2-input,
.v2-select,
.v2-textarea {
    width: 100%;
    background: var(--v2-surface);
    border: 1px solid var(--v2-border-strong);
    border-radius: var(--v2-radius-sm);
    padding: 0 14px;
    height: 48px;
    font-size: 15px;
    color: var(--v2-text);
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
}

.v2-textarea {
    height: auto;
    min-height: 110px;
    padding: 12px 14px;
    line-height: 1.5;
    resize: vertical;
}

.v2-input::placeholder,
.v2-textarea::placeholder {
    color: var(--v2-text-dim);
}

.v2-input:focus,
.v2-select:focus,
.v2-textarea:focus {
    outline: none;
    border-color: var(--v2-primary);
    box-shadow: var(--v2-focus-ring);
}

.v2-input:disabled,
.v2-select:disabled,
.v2-textarea:disabled {
    background: var(--v2-surface-alt);
    color: var(--v2-text-dim);
    cursor: not-allowed;
}

/* Estado de erro */
.v2-input--invalid,
.v2-select--invalid,
.v2-textarea--invalid {
    border-color: var(--v2-danger);
}
.v2-input--invalid:focus,
.v2-select--invalid:focus,
.v2-textarea--invalid:focus {
    box-shadow: 0 0 0 3px rgba(209, 67, 67, 0.22);
}

/* Seta do select */
.v2-select {
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2355606F' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

/* Tamanho compacto — filtros e telas densas */
.v2-input--sm,
.v2-select--sm {
    height: 38px;
    font-size: 13px;
    padding-left: 11px;
}
.v2-select--sm { padding-right: 32px; background-position: right 11px center; }

/* ── CHECKBOX E RADIO ─────────────────────────────────────────────────────── */
.v2-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.45;
    color: var(--v2-text);
    padding: 4px 0;
}
.v2-check input[type="checkbox"],
.v2-check input[type="radio"] {
    appearance: none;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1.5px solid var(--v2-border-strong);
    background: var(--v2-surface);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.v2-check input[type="checkbox"] { border-radius: 6px; }
.v2-check input[type="radio"]    { border-radius: 50%; }

.v2-check input:checked {
    background-color: var(--v2-primary);
    border-color: var(--v2-primary);
}
.v2-check input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}
.v2-check input[type="radio"]:checked {
    box-shadow: inset 0 0 0 4px var(--v2-surface);
}
.v2-check input:focus-visible {
    box-shadow: var(--v2-focus-ring);
}

/* ── UPLOAD ───────────────────────────────────────────────────────────────── */
.v2-file {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1.5px dashed var(--v2-border-strong);
    border-radius: var(--v2-radius-sm);
    background: var(--v2-surface-alt);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.v2-file:hover {
    border-color: var(--v2-primary);
    background: var(--v2-primary-soft);
}
.v2-file input[type="file"] { display: none; }
.v2-file__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--v2-surface);
    border: 1px solid var(--v2-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--v2-primary);
}
.v2-file__title { font-size: 14px; font-weight: 600; }
.v2-file__hint  { font-size: 12px; color: var(--v2-text-dim); margin-top: 2px; }

/* ── GRUPOS ───────────────────────────────────────────────────────────────── */
.v2-row {
    display: grid;
    gap: 14px;
}
@media (min-width: 768px) {
    .v2-row--2 { grid-template-columns: 1fr 1fr; }
    .v2-row--3 { grid-template-columns: repeat(3, 1fr); }
    .v2-row--4 { grid-template-columns: repeat(4, 1fr); }
}

.v2-fieldset {
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: var(--v2-surface);
    padding: 20px;
    margin-bottom: 18px;
}
.v2-fieldset__legend {
    font-size: 13px;
    font-weight: 700;
    color: var(--v2-text);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--v2-border);
}

/* ── ALERTAS ──────────────────────────────────────────────────────────────── */
.v2-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: var(--v2-radius-sm);
    padding: 13px 16px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.v2-alert--info    { background: var(--v2-primary-soft); color: var(--v2-primary-deep); }
.v2-alert--success { background: var(--v2-success-soft); color: var(--v2-success); }
.v2-alert--warning { background: var(--v2-warning-soft); color: var(--v2-warning); }
.v2-alert--danger  { background: var(--v2-danger-soft);  color: var(--v2-danger); }

/* ── BOTÕES COMPLEMENTARES ────────────────────────────────────────────────── */
/* O v2-components.css tem .v2-btn, --primary, --secondary, --sm, --full.
   Faltavam estes: */
.v2-btn--ghost {
    background: transparent;
    color: var(--v2-text-muted);
    border: 1px solid var(--v2-border-strong);
}
.v2-btn--ghost:hover { background: var(--v2-surface-alt); }

.v2-btn--success { background: var(--v2-success); color: #fff; }
.v2-btn--warning { background: var(--v2-warning); color: #fff; }
.v2-btn--danger  { background: var(--v2-danger);  color: #fff; }

.v2-btn:disabled,
.v2-btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── AVATAR ───────────────────────────────────────────────────────────────── */
.v2-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--v2-surface-alt);
    border: 1px solid var(--v2-border);
    flex-shrink: 0;
}
.v2-avatar--sm { width: 30px; height: 30px; border-radius: 8px; }
.v2-avatar--lg { width: 64px; height: 64px; border-radius: 14px; }

/* ── MODAL ────────────────────────────────────────────────────────────────── */
.v2-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 26, 0.55);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.v2-modal-overlay--open { display: flex; }
.v2-modal {
    background: var(--v2-surface);
    border-radius: var(--v2-radius-lg);
    box-shadow: var(--v2-shadow-lg);
    width: 100%;
    max-width: 620px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 26px;
}
.v2-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.v2-modal__title { font-size: 18px; font-weight: 700; }
.v2-modal__close { font-size: 24px; line-height: 1; color: var(--v2-text-dim); }

/* =============================================================================
   CORREÇÃO DE ESPECIFICIDADE — <button> vs reset

   O reset `.v2-app button` (0,1,1) vence `.v2-btn--primary` (0,1,0) e zera
   background, padding e border. O design system funcionava porque as telas
   originais usavam <a class="v2-btn">; em <button> o estilo sumia.

   Aqui as regras ganham o prefixo `.v2-app` (0,2,0) e voltam a valer.
   Vale para qualquer tag — a, button ou input.
   ============================================================================= */
.v2-app .v2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px;
    padding: 0 20px;
    border: none;
    border-radius: var(--v2-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.05s;
}
.v2-app .v2-btn--sm   { height: 38px; padding: 0 14px; font-size: 13px; }
.v2-app .v2-btn--full { width: 100%; }

.v2-app .v2-btn--primary   { background: var(--v2-primary); color: #fff; }
.v2-app .v2-btn--secondary { background: var(--v2-surface); color: var(--v2-primary); border: 1px solid var(--v2-border-strong); }
.v2-app .v2-btn--ghost     { background: transparent; color: var(--v2-text-muted); border: 1px solid var(--v2-border-strong); }
.v2-app .v2-btn--success   { background: var(--v2-success); color: #fff; }
.v2-app .v2-btn--warning   { background: var(--v2-warning); color: #fff; }
.v2-app .v2-btn--danger    { background: var(--v2-danger);  color: #fff; }

.v2-app .v2-btn:hover { opacity: 0.92; }
.v2-app .v2-btn:active { transform: translateY(1px); }
.v2-app .v2-btn:disabled,
.v2-app .v2-btn--disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Mesmo problema no botão de menu do mobile */
.v2-app .v2-iconbtn {
    background: var(--v2-surface-alt);
    border: 1px solid var(--v2-border);
    padding: 0;
}
.v2-app .v2-iconbtn:hover { background: var(--v2-border); }

/* =============================================================================
   EDITOR DE TEXTO RICO
   ============================================================================= */
.v2-rich {
    border: 1px solid var(--v2-border-strong);
    border-radius: var(--v2-radius-sm);
    background: var(--v2-surface);
    overflow: hidden;
}
.v2-rich:focus-within {
    border-color: var(--v2-primary);
    box-shadow: var(--v2-focus-ring);
}

.v2-rich__bar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: var(--v2-surface-alt);
    border-bottom: 1px solid var(--v2-border);
    flex-wrap: wrap;
}
.v2-app .v2-rich__btn {
    width: 30px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--v2-text-muted);
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.v2-app .v2-rich__btn:hover { background: var(--v2-border); color: var(--v2-text); }
.v2-rich__sep {
    width: 1px;
    height: 18px;
    background: var(--v2-border-strong);
    margin: 0 4px;
}

.v2-rich__area {
    min-height: 130px;
    max-height: 420px;
    overflow-y: auto;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.6;
    outline: none;
}
.v2-rich__area:empty::before {
    content: attr(data-placeholder);
    color: var(--v2-text-dim);
}
.v2-rich__area p           { margin: 0 0 10px; }
.v2-rich__area p:last-child{ margin-bottom: 0; }
.v2-rich__area h3          { font-size: 16px; font-weight: 700; margin: 14px 0 8px; }
.v2-rich__area h4          { font-size: 14px; font-weight: 700; margin: 12px 0 6px; }
.v2-rich__area ul,
.v2-rich__area ol          { margin: 0 0 10px; padding-left: 22px; }
.v2-rich__area li          { margin-bottom: 4px; }
.v2-rich__area a           { color: var(--v2-primary); text-decoration: underline; }
.v2-rich__area blockquote  {
    margin: 10px 0;
    padding: 6px 0 6px 14px;
    border-left: 3px solid var(--v2-border-strong);
    color: var(--v2-text-muted);
}

/* Mesma tipografia quando o conteúdo é exibido fora do editor */
.v2-prose         { font-size: 15px; line-height: 1.65; }
.v2-prose p       { margin: 0 0 10px; }
.v2-prose h3      { font-size: 16px; font-weight: 700; margin: 16px 0 8px; }
.v2-prose h4      { font-size: 14px; font-weight: 700; margin: 12px 0 6px; }
.v2-prose ul,
.v2-prose ol      { margin: 0 0 10px; padding-left: 22px; }
.v2-prose li      { margin-bottom: 4px; }
.v2-prose a       { color: var(--v2-primary); text-decoration: underline; }
.v2-prose blockquote {
    margin: 10px 0; padding: 6px 0 6px 14px;
    border-left: 3px solid var(--v2-border-strong); color: var(--v2-text-muted);
}

/* =============================================================================
   LIGHTBOX — abrir comprovante grande sem sair da tela
   ============================================================================= */
.v2-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 26, 0.88);
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px;
}
.v2-lightbox--open { display: flex; }
.v2-lightbox__img {
    max-width: 100%;
    max-height: calc(100vh - 110px);
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}
.v2-lightbox__cap {
    position: absolute;
    left: 0; right: 0; bottom: 20px;
    text-align: center;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    padding: 0 32px;
}
.v2-app .v2-lightbox__close {
    position: absolute;
    top: 18px; right: 22px;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.v2-app .v2-lightbox__close:hover { background: rgba(255,255,255,0.26); }
.v2-zoom { cursor: zoom-in; }

/* <summary> usado como botão não deve mostrar a setinha do navegador */
.v2-app summary.v2-btn::-webkit-details-marker { display: none; }
.v2-app summary.v2-btn::marker { content: ''; }

/* =============================================================================
   PERFIL DO CRIADOR — progresso por etapas
   ============================================================================= */
.pf-hero {
    display: flex;
    gap: 20px;
    align-items: center;
    background: linear-gradient(135deg, var(--v2-primary), var(--v2-primary-deep));
    border-radius: var(--v2-radius-lg);
    padding: 22px 24px;
    color: #fff;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.pf-ring {
    position: relative;
    width: 86px; height: 86px;
    flex-shrink: 0;
}
.pf-ring svg { transform: rotate(-90deg); }
.pf-ring__pct {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800;
}
.pf-hero__txt { flex: 1; min-width: 200px; }
.pf-hero__nivel { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.pf-hero__sub   { font-size: 13px; opacity: 0.85; line-height: 1.5; }

.pf-foto {
    width: 76px; height: 76px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.45);
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
}
.pf-foto--vazia {
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 800; color: #fff;
}

/* ── Etapas ───────────────────────────────────────────────────────────────── */
.pf-etapa {
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: var(--v2-surface);
    margin-bottom: 12px;
    overflow: hidden;
}
.pf-etapa[open] { border-color: var(--v2-primary); }

.pf-etapa__cab {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
}
.pf-etapa__cab::-webkit-details-marker { display: none; }
.pf-etapa__cab::marker { content: ''; }
.pf-etapa__cab:hover { background: var(--v2-primary-soft); }

.pf-etapa__selo {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    background: var(--v2-surface-alt);
    color: var(--v2-text-dim);
}
.pf-etapa__selo--ok      { background: var(--v2-success-soft); color: var(--v2-success); }
.pf-etapa__selo--parcial { background: var(--v2-warning-soft); color: var(--v2-warning); }

.pf-etapa__info  { flex: 1; min-width: 0; }
.pf-etapa__nome  { font-size: 15px; font-weight: 700; }
.pf-etapa__falta { font-size: 12px; color: var(--v2-text-muted); margin-top: 2px; }
.pf-etapa__pct   { font-size: 13px; font-weight: 700; flex-shrink: 0; }

.pf-etapa__corpo {
    padding: 4px 18px 18px;
    border-top: 1px solid var(--v2-border);
}

.pf-barra {
    height: 5px;
    border-radius: 99px;
    background: var(--v2-surface-alt);
    overflow: hidden;
    margin-top: 6px;
}
.pf-barra__fill { height: 100%; background: var(--v2-primary); transition: width .3s; }

/* ── Seleção múltipla em pílulas ──────────────────────────────────────────── */
.pf-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--v2-radius-pill);
    border: 1.5px solid var(--v2-border-strong);
    background: var(--v2-surface);
    font-size: 13px;
    cursor: pointer;
    transition: all .12s;
    user-select: none;
}
.pf-tag:hover { border-color: var(--v2-primary); }
.pf-tag input { position: absolute; opacity: 0; pointer-events: none; }
.pf-tag:has(input:checked) {
    background: var(--v2-primary);
    border-color: var(--v2-primary);
    color: #fff;
    font-weight: 600;
}

/* ── Rede social ──────────────────────────────────────────────────────────── */
.pf-rede {
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    background: var(--v2-surface-alt);
}
.pf-rede__topo {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px; flex-wrap: wrap;
}
.pf-rede__velho {
    font-size: 11px;
    color: var(--v2-warning);
    font-weight: 600;
}

/* =============================================================================
   PERGUNTAS DA MISSÃO — ações da linha
   Quatro formulários lado a lado com botões de altura cheia quebravam o
   alinhamento. Aqui as setas ficam pequenas e as ações viram texto.
   ============================================================================= */
.mq-acoes {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.v2-app .mq-seta {
    width: 26px; height: 26px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--v2-border);
    color: var(--v2-text-muted);
    font-size: 13px; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
}
.v2-app .mq-seta:hover:not(:disabled) { background: var(--v2-surface-alt); color: var(--v2-text); }
.v2-app .mq-seta:disabled { opacity: 0.3; cursor: default; }

.v2-app .mq-link {
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--v2-primary);
    text-decoration: none;
    border-radius: 6px;
}
.v2-app .mq-link:hover { background: var(--v2-primary-soft); }
.v2-app .mq-link--risco { color: var(--v2-text-muted); }
.v2-app .mq-link--risco:hover { background: var(--v2-danger-soft); color: var(--v2-danger); }
