
/* ═══════════════════════════════════════════════════════════════════════════
   DevFix — app-headers.css
   Estilos para o Security Headers Grader — versão final
═══════════════════════════════════════════════════════════════════════════ */

/* Painéis HTTP Headers (sub-abas legacy + aba principal #tab-headers) */
#tab-headers,
#tab-headers-grader,
#tab-headers-csp,
#tab-headers-cookies,
#tab-headers-hardening,
#tab-hardening {
    text-align: left;
}

#tab-headers .tags-header,
#tab-headers .snippet-intro,
#tab-headers-grader .tags-header,
#tab-headers-grader .snippet-intro,
#tab-headers-csp .tags-header,
#tab-headers-csp .snippet-intro,
#tab-headers-cookies .tags-header,
#tab-headers-cookies .snippet-intro,
#tab-headers-hardening .tags-header,
#tab-hardening .tags-header,
#tab-hardening .snippet-intro {
    text-align: left;
}

.hd-tab-placeholder {
    margin: 0;
    padding: 28px 22px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
    border: 1px dashed var(--border);
    border-radius: var(--r-md);
    background: var(--bg-raised);
}

.hd-tab-placeholder code {
    font-size: 0.84em;
}

.hd-subtab-mount {
    margin-top: 10px;
}

/* ── Grid superior: 3 painéis de largura igual ── */
.hd-top-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
    min-width: 0;
}

/* Card genérico do topo */
.hd-top-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100px;
}

/* ── Painel 1: Grade ── */
.hd-card-grade {
    flex-direction: row;
    align-items: center;
    gap: 18px;
}

/* Círculo de nota */
.hd-grade-pill {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    font-weight: 800;
    color: #F5F5F7;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    letter-spacing: -1px;
}

.hd-grade-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hd-grade-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hd-grade-score {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Gradientes por nota ── */
.grade-A-plus { background: linear-gradient(135deg, #10b981, #059669); }
.grade-A      { background: linear-gradient(135deg, #34d399, #10b981); }
.grade-B      { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.grade-C      { background: linear-gradient(135deg, #facc15, #ca8a04); }
.grade-D      { background: linear-gradient(135deg, #f97316, #ea580c); }
.grade-F      { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ── Painel 2: Avisos ── */
.hd-warn-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #10b981;
    font-size: 0.85rem;
    font-weight: 500;
}

.hd-warning-box {
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid #f59e0b;
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    color: var(--text-primary);
    font-size: 0.84rem;
    line-height: 1.5;
    word-break: break-word;
}

/* ── Painel 3: Sobre ── */
.hd-card-about {
    gap: 8px;
}

.hd-about-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin: 0 0 4px;
}

.hd-about-text {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.hd-about-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   GRID DE HEADERS — 3 colunas iguais (2 linhas × 3 cartões)
═══════════════════════════════════════════════════════ */
.hd-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 14px;
    width: 100%;
    min-width: 0;
    align-items: start;
}

/* ── Secção matriz CSP (Mozilla Observatory) ─────────────────────────── */
.hd-obs-section {
    grid-column: 1 / -1;
}

.hd-obs-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 18px 20px 20px;
    margin-bottom: 4px;
}

.hd-obs-heading {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.hd-obs-lede {
    margin: 0 0 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.hd-obs-banner {
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 10px 14px;
    border-radius: var(--r-sm, 6px);
    margin-bottom: 14px;
}

.hd-obs-banner--pass {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    color: var(--text-primary);
}

.hd-obs-banner--fail {
    background: var(--error-soft);
    border: 1px solid var(--error);
    color: var(--text-primary);
}

.hd-obs-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hd-obs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.hd-obs-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-raised);
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.68rem;
    border-bottom: 1px solid var(--border);
}

.hd-obs-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-soft, var(--border));
    vertical-align: top;
    color: var(--text-primary);
    line-height: 1.5;
}

.hd-obs-table tbody tr:last-child td {
    border-bottom: none;
}

.hd-obs-td-test {
    font-weight: 500;
    width: 38%;
    min-width: 160px;
}

.hd-obs-td-res {
    width: 72px;
    text-align: center;
}

.hd-obs-td-info {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.hd-obs-res {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.95rem;
}

.hd-obs-res--ok {
    background: var(--accent-soft);
    color: var(--accent);
}

.hd-obs-res--fail {
    background: var(--error-soft);
    color: var(--error);
}

.hd-obs-res--na {
    background: var(--bg-raised);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.hd-obs-wrap--policy {
    margin-top: 8px;
}

/* Espaço entre blocos CSP Observatory (conteúdo → política → auditoria) */
.hd-csp-chunk-gap {
    display: block;
    height: 0;
    margin: 24px 0 0;
    border: 0;
}

.hd-csp-chunk-gap + .hd-csp-chunk .hd-obs-wrap--policy {
    margin-top: 0;
}

.hd-obs-wrap--cookies {
    margin-top: 8px;
}

.hd-cookie-table .hd-cookie-name {
    font-weight: 600;
}

.hd-cookie-table .hd-cookie-mono {
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.hd-cookie-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 6px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--accent);
    vertical-align: middle;
}

/* ── Cartão combinado: X-Frame-Options + Cross-Origin-Opener-Policy ── */
.hd-item--xfo-coop-stack {
    padding: 0;
    gap: 0;
    overflow: hidden;
}

.hd-item--xfo-coop-stack > .hd-stack-pane {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hd-item--xfo-coop-stack > .hd-stack-pane:first-child {
    padding-bottom: 12px;
}

.hd-item--xfo-coop-stack .hd-item-desc {
    margin-bottom: 8px;
}

.hd-item--xfo-coop-stack .hd-value-box {
    margin-top: 0;
}

.hd-stack-divider {
    height: 0;
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
    flex-shrink: 0;
}

.hd-stack-fallback {
    margin: 0;
    font-style: italic;
    color: var(--text-muted);
}

/* ── Card individual de header ── */
.hd-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    min-width: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.df-result-stage .hd-item:hover {
    border-color: var(--df-line-strong, var(--border));
}

#tab-headers #hdResults {
    width: 100%;
    min-width: 0;
}

#tab-headers .tags-section.tags-section--codeblock {
    width: 100%;
    max-width: none;
    min-width: 0;
}

/* Linha: nome + badge */
.hd-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.hd-item-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.4;
    text-align: left;
}

.hd-item-desc {
    font-size: 0.81rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0 0 10px;
    text-align: left;
}

/* CSP presente mas reprovado na auditoria estrita */
.hd-item--partial {
    border-left: 3px solid var(--warning);
    background: var(--warning-soft);
}

.hd-partial-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 12px;
    padding: 8px 10px;
    border-radius: var(--r-sm, 6px);
    background: var(--bg-raised);
    border: 1px solid var(--border-soft, var(--border));
}

/* Badge verde */
.hd-badge-pass {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Badge vermelho */
.hd-badge-fail {
    background: var(--error-soft);
    color: var(--error);
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.hd-badge-warn {
    background: var(--warning-soft);
    color: var(--warning);
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.hd-badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6; /* Azul mantido suavemente */
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.hd-deep-wrap {
    grid-column: 1 / -1;
}

.hd-deep-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.hd-deep-row {
    padding: 10px 12px;
    border-radius: var(--r-md, 8px);
    border: 1px solid var(--border);
    background: var(--bg-body);
    text-align: left;
}

.hd-deep-row-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.hd-deep-title {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hd-deep-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 8px;
    line-height: 1.5;
}


.hd-deep-rec {
    margin-top: 0;
}

/* Caixa de valor do header */
.hd-value-box {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 12px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-primary);
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
    overflow-x: auto;
    line-height: 1.55;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
}

/* Área de correção (header ausente) */
.hd-fix-box {
    border-top: 1px dashed var(--border);
    padding-top: 12px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 960px) {
    .hd-fix-box {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
        align-items: start;
    }

    .hd-fix-box > div {
        min-width: 0;
    }
}

.hd-fix-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hd-fix-code {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.77rem;
    color: var(--text-primary);
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    overflow-x: auto;
    line-height: 1.5;
}

/* ── Slot Prompt IA (entre grelha e resposta bruta) ── */
.hd-prompt-slot {
    margin-top: 28px;
    margin-bottom: 16px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.hd-prompt-slot .aip-box {
    margin-top: 0;
}

/* Prompt IA colado à secção WAF / CSP sub-páginas / Cross-Origin — sem linha divisória */
.hd-prompt-slot.hd-prompt-slot--no-divider {
    margin-top: 12px;
    margin-bottom: 16px;
    padding-top: 0;
    border-top: none;
}

/* Slots CSP: sem separador vazio quando não há prompt (tudo OK no bloco) */
.hd-prompt-slot.hd-prompt-slot--csp-obs:not(:has(.aip-box)) {
    display: none;
}

/* ── Resposta bruta: igual a Schema.org (schema-block, sem caixa branca .robots-card) ── */
.hd-raw-block {
    margin-top: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.hd-raw-block .code-editor-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.hd-raw-heading {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.hd-raw-heading svg {
    flex-shrink: 0;
    color: var(--accent);
    opacity: 0.95;
}

.hd-raw-subtitle {
    margin: 0 0 12px;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-secondary);
    text-align: left;
}

pre#hdRaw.hd-raw-pre,
pre.code-editor.hd-raw-pre {
    min-height: 120px;
    max-height: 360px;
    margin: 0;
    text-align: left;
}

#tab-headers #hdWarnings,
#tab-headers-grader #hdWarnings {
    width: 100%;
    align-items: stretch;
}

/* ── Responsividade ── */

@media (max-width: 1024px) {
    .hd-list-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    }
}

/* Tablet pequeno: grid de 2 colunas, topo empilha em 2+1 */
@media (max-width: 768px) {
    .hd-top-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hd-card-about {
        grid-column: 1 / -1;
    }

    .hd-list-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    }
}

/* Mobile: tudo em 1 coluna */
@media (max-width: 480px) {
    .hd-top-grid {
        grid-template-columns: 1fr;
    }

    .hd-card-about {
        grid-column: auto;
    }

    .hd-list-grid {
        grid-template-columns: 1fr;
    }

    .hd-grade-pill {
        width: 52px;
        height: 52px;
        font-size: 1.35rem;
    }

    pre#hdRaw.hd-raw-pre,
    pre.code-editor.hd-raw-pre {
        font-size: 0.75rem;
        padding: 16px;
        max-height: 280px;
    }
}


