/* =====================================================
   VERIFICAR DOCUMENTO - CLAVESP
   Padrão visual CLAVESP — página pública de verificação
   ===================================================== */

:root {
    --primary: #007349;
    --primary-dark: #005f3b;
    --primary-light: #e8f5ef;
    --primary-glow: rgba(0, 115, 73, 0.12);
    --success: #007349;
    --success-bg: #e8f5ef;
    --success-border: #b2dfcc;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #f8faf9;
    --border: #dce3de;
    --border-light: #edf1ee;
    --text: #1a2e23;
    --text-secondary: #2d4a3a;
    --text-muted: #6b8578;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
}

.hidden { display: none !important; }

/* ── Container ── */
.container {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
.header {
    text-align: center;
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.logo {
    width: 48px;
    height: auto;
}

.logo-text h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 3px;
}

.logo-text p {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 1px;
    font-weight: 600;
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Verification Card ── */
.verification-card {
    background: var(--surface);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    background: var(--primary);
    color: #fff;
    padding: 28px 28px;
    text-align: center;
    position: relative;
}

.card-header::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -20%;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    pointer-events: none;
}

.icon-shield {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.icon-shield svg {
    width: 26px;
    height: 26px;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    position: relative;
}

.card-header p {
    font-size: 13px;
    opacity: 0.85;
    max-width: 380px;
    margin: 0 auto;
    line-height: 1.5;
    position: relative;
}

/* ── Form ── */
.verification-form {
    padding: 24px 28px 28px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-group input {
    width: 100%;
    padding: 14px 18px 14px 44px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    outline: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    text-transform: uppercase;
    background: var(--surface);
    color: var(--text);
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-group input::placeholder {
    color: #a3b5ac;
    letter-spacing: 1px;
    font-size: 13px;
}

.input-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
    line-height: 1.4;
}

.btn-verificar {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    letter-spacing: 0.3px;
}

.btn-verificar:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(0, 95, 59, 0.25);
}

.btn-verificar svg {
    width: 18px;
    height: 18px;
}

/* ── Resultado ── */
.resultado {
    background: var(--surface);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.resultado-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
}

.resultado-header.sucesso {
    background: var(--success-bg);
    border-bottom: 1px solid var(--success-border);
}

.resultado-header.erro {
    background: var(--danger-bg);
    border-bottom: 1px solid var(--danger-border);
}

.resultado-header.cancelado {
    background: var(--danger-bg);
    border-bottom: 1px solid var(--danger-border);
}

.resultado-header.pendente {
    background: var(--warning-bg);
    border-bottom: 1px solid var(--warning-border);
}

.resultado-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.resultado-badge svg {
    width: 20px;
    height: 20px;
}

.resultado-badge.cancelado,
.resultado-badge.erro {
    background: var(--danger);
}

.resultado-badge.pendente {
    background: var(--warning);
}

.resultado-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.resultado-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.resultado-body {
    padding: 22px;
}

/* ── Doc Info Table ── */
.doc-info {
    background: var(--surface-2);
    border-radius: 4px;
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    gap: 12px;
}

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

.info-row:nth-child(even) {
    background: rgba(0, 115, 73, 0.02);
}

.info-row span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.info-row strong {
    color: var(--text);
    text-align: right;
    word-break: break-word;
    font-weight: 600;
}

/* ── Badges ── */
.badge-tipo {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px !important;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

/* ── Alerta Cancelamento ── */
.alerta-cancelamento {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: 4px;
    padding: 14px 16px;
    margin-bottom: 14px;
}

.alerta-cancelamento strong {
    color: var(--danger);
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.alerta-cancelamento p {
    color: #991b1b;
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

/* ── Dica Lista (erro) ── */
.dica-lista {
    color: var(--text-muted);
    font-size: 13px;
}

.dica-lista p {
    margin-bottom: 8px;
    font-weight: 600;
}

.dica-lista ul {
    padding-left: 20px;
}

.dica-lista li {
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ── Blocos Contrato (ICP, Hash, PKCS7) ── */
.bloco-icp,
.bloco-hash,
.bloco-pkcs7 {
    border-radius: 4px;
    padding: 14px 16px;
    margin-top: 14px;
}

.bloco-icp {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
}

.bloco-hash {
    background: var(--surface-2);
    border: 1px dashed var(--border);
}

.bloco-pkcs7 {
    background: #e8f5ef;
    border: 1px solid #b2dfcc;
}

.bloco-titulo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
}

.bloco-icp .bloco-titulo { color: var(--primary-dark); }
.bloco-hash .bloco-titulo { color: var(--text-secondary); }
.bloco-pkcs7 .bloco-titulo { color: var(--primary-dark); }

.bloco-titulo svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.bloco-hash code {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    word-break: break-all;
    line-height: 1.6;
}

.hash-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
}

.hash-check svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.hash-check.valid { color: var(--success); }
.hash-check.invalid { color: var(--danger); }

.bloco-pkcs7 p {
    font-size: 12px;
    color: #475569;
    margin-bottom: 10px;
    line-height: 1.5;
}

.pkcs7-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pkcs7-hint {
    font-size: 11px !important;
    color: var(--text-muted) !important;
    margin-top: 10px !important;
    margin-bottom: 0 !important;
}

.pkcs7-hint a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.pkcs7-hint a:hover {
    text-decoration: underline;
}

/* ── PDF Section ── */
.pdf-section {
    background: var(--surface);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.pdf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    gap: 12px;
    flex-wrap: wrap;
}

.pdf-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
}

.pdf-title svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.pdf-actions {
    display: flex;
    gap: 8px;
}

.btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    background: var(--primary);
    color: #fff;
}

.btn-pdf svg {
    width: 15px;
    height: 15px;
}

.btn-pdf:hover {
    background: var(--primary-dark);
    box-shadow: 0 3px 10px rgba(0, 95, 59, 0.2);
}

.btn-pdf-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-pdf-secondary:hover {
    background: var(--surface-2);
    box-shadow: var(--shadow-sm);
}

.pdf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 18px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    border-top: 1px solid var(--border);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Info Section ── */
.info-section {
    background: var(--surface);
    border-radius: 6px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.info-section h3 {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 18px;
    text-align: center;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.info-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.info-icon {
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.info-text strong {
    display: block;
    font-size: 12px;
    color: var(--text);
    margin-bottom: 3px;
}

.info-text p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 28px 0 20px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
}

.footer p {
    margin-bottom: 3px;
}

.copyright {
    color: #a3b5ac;
    margin-top: 6px !important;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .container {
        padding: 0 14px;
    }

    .header {
        padding: 24px 0 18px;
    }

    .logo { width: 40px; }
    .logo-text h1 { font-size: 19px; }

    .card-header { padding: 22px 20px; }
    .card-header h2 { font-size: 16px; }

    .verification-form { padding: 18px 20px 22px; }

    .input-group input {
        font-size: 14px;
        padding: 12px 14px 12px 40px;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .resultado-header { padding: 14px 16px; }
    .resultado-header h3 { font-size: 15px; }
    .resultado-body { padding: 16px; }

    .pdf-header {
        flex-direction: column;
        align-items: stretch;
    }

    .pdf-actions .btn-pdf {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .resultado-badge { width: 36px; height: 36px; }
    .resultado-badge svg { width: 18px; height: 18px; }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
        padding: 10px 14px;
    }

    .info-row strong { text-align: left; }
}
