/* ═══════════════════════════════════════════════════════════════════════════
   DevFix — app-hardening.css
   Estilos para o módulo de Endurecimento (Hardening Audit)
═══════════════════════════════════════════════════════════════════════════ */

/* ── Container geral ── */
#hdHardeningResults {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Grelha principal: banda superior em 2 colunas + blocos de largura total */
.hdn-results-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.hdn-results-top {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
    width: 100%;
}

.hdn-results-top--single {
    grid-template-columns: minmax(0, 1fr);
}

.hdn-results-top-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hdn-results-top-col > .hdn-section {
    margin-bottom: 0;
}

@media (max-width: 960px) {
    .hdn-results-top {
        grid-template-columns: 1fr;
    }

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

/* ── Seção individual ── */
.hdn-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 20px 22px;
    margin-bottom: 0;
}

.hdn-section-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 16px;
    align-items: start;
    margin-bottom: 10px;
    flex-wrap: unset;
}

.hdn-section-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    min-width: 0;
}

.hdn-section-desc {
    margin: 0 0 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
}

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

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

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

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

/* ── WAF Provider Tag ── */
.hdn-provider-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    margin-top: 4px;
}

/* ── Fix suggestions ── */
.hdn-fix-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.hdn-fix-item {
    padding: 10px 14px;
    border-radius: 6px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.55;
}

.hdn-fix-item strong {
    text-transform: capitalize;
    color: var(--accent);
}

.hdn-fix-box {
    border-top: 1px dashed var(--border);
    padding-top: 12px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hdn-fix-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.hdn-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);
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* ── Sub-páginas ── */
.hdn-subpages-list {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}

.hdn-subpages-header {
    display: flex;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-raised);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.hdn-subpage-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 14px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-soft, var(--border));
    font-size: 0.8rem;
}

.hdn-subpage-row:last-child {
    border-bottom: none;
}

.hdn-subpage-url {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    min-width: 0;
}

.hdn-page-ok {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.76rem;
    white-space: nowrap;
}

.hdn-page-fail {
    color: var(--error);
    font-weight: 600;
    font-size: 0.76rem;
    white-space: nowrap;
}

.hdn-page-error {
    color: var(--warning);
    font-weight: 600;
    font-size: 0.76rem;
    white-space: nowrap;
}

/* ── Vazamentos ── */
.hdn-leaks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hdn-leak-row {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-body);
    border-left: 3px solid #f59e0b;
}

.hdn-leak-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.hdn-leak-header {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-raised);
    padding: 2px 8px;
    border-radius: 4px;
}

.hdn-leak-value {
    font-size: 0.78rem;
    color: var(--error);
    font-weight: 500;
}

.hdn-leak-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 8px;
    line-height: 1.5;
}

.hdn-leak-fixes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.hdn-leak-fix {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.76rem;
}

.hdn-leak-fix .hdn-fix-label {
    min-width: 60px;
}

.hdn-leak-fix code {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--text-primary);
    background: var(--bg-raised);
    padding: 2px 6px;
    border-radius: 4px;
    word-break: break-word;
}

/* ── Extras (Cross-Origin) ── */
.hdn-extras-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.hdn-extra-row {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-body);
    min-width: 0;
}

.hdn-extra-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: start;
    margin-bottom: 6px;
}

.hdn-extra-head strong {
    font-size: 0.84rem;
    color: var(--text-primary);
}

.hdn-extra-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 8px;
    line-height: 1.5;
}

.hdn-extra-value code {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 3px 8px;
    border-radius: 4px;
}

/* ── Loading spinner ── */
#hdHardeningLoading {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 0;
}

#hdHardeningLoading p {
    margin-top: 12px;
    font-size: 0.85rem;
}

/* ── Auditoria ativa ── */
.hdn-active-section {
    border-color: var(--accent-glow);
}

.hdn-active-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.hdn-active-card {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-body);
}

.hdn-active-card--critical {
    border-left: 3px solid var(--error);
}

.hdn-active-card--warn {
    border-left: 3px solid var(--warning);
}

.hdn-active-card--pass {
    border-left: 3px solid var(--accent);
}

.hdn-active-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.hdn-active-card-head strong {
    color: var(--text-primary);
    font-size: 0.86rem;
}

.hdn-active-card p {
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.hdn-active-code {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-raised);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    white-space: normal;
    word-break: break-word;
}

.hdn-active-list {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.5;
}

.hdn-active-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hdn-active-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
}

.hdn-active-table th,
.hdn-active-table td {
    padding: 8px 9px;
    border-bottom: 1px solid var(--border-soft, var(--border));
    color: var(--text-secondary);
    vertical-align: top;
}

.hdn-active-table th {
    color: var(--text-muted);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.66rem;
}

.hdn-active-table td:first-child {
    color: var(--text-primary);
    font-weight: 600;
}

.hdn-active-table tr:last-child td {
    border-bottom: none;
}

.hdn-active-url {
    display: inline-block;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .hdn-active-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Responsividade ── */
@media (max-width: 768px) {
    .hdn-section {
        padding: 16px;
    }

    .hdn-subpage-url {
        font-size: 0.7rem;
    }

    .hdn-leak-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .hdn-section-header {
        grid-template-columns: minmax(0, 1fr);
        justify-items: start;
    }

    .hdn-section-header .hdn-badge-pass,
    .hdn-section-header .hdn-badge-fail,
    .hdn-section-header .hdn-badge-warn,
    .hdn-section-header .hdn-badge-info {
        justify-self: start;
    }

    .hdn-subpage-url {
        white-space: normal;
        word-break: break-word;
    }
}
