/* -------------------------------------------------------------------------- */
/* VERIDIA - STYLE.CSS                                                        */
/* Versión final alineada con panel real, resultados, hallazgos e informe PDF */
/* -------------------------------------------------------------------------- */

:root {
    --bg-deep: #06090f;
    --bg-card: #0f141e;
    --bg-sidebar: #0a0e17;
    --bg-soft: rgba(255, 255, 255, 0.02);
    --bg-soft-2: rgba(255, 255, 255, 0.03);

    --accent-blue: #2563eb;
    --accent-blue-2: #60a5fa;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ff3366;

    --text-main: #e0e6ed;
    --text-dim: #94a3b8;
    --text-soft: #cbd5e1;

    --border: #1c2333;
    --border-soft: rgba(28, 35, 51, 0.6);
    --input-bg: #0d1117;

    --shadow-blue: 0 0 18px rgba(37, 99, 235, 0.18);
    --shadow-green: 0 0 12px rgba(16, 185, 129, 0.28);
    --shadow-red: 0 0 12px rgba(255, 51, 102, 0.22);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg-deep);
    color: var(--text-main);
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -------------------------------------------------------------------------- */
/* ACCESIBILIDAD Y ESTABILIDAD VISUAL                                         */
/* -------------------------------------------------------------------------- */

img {
    max-width: 100%;
    display: block;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

a,
button,
input {
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        opacity 0.2s ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
.btn-link:focus-visible,
.footer-legal a:focus-visible {
    outline: 2px solid var(--accent-blue-2);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
    border-radius: 8px;
}

::selection {
    background: rgba(96, 165, 250, 0.22);
    color: #ffffff;
}

/* -------------------------------------------------------------------------- */
/* ESTRUCTURA GENERAL                                                         */
/* -------------------------------------------------------------------------- */

.dashboard {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 34px 22px;
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 14px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-blue);
    object-fit: cover;
    background: #0b1120;
}

.sidebar h1 {
    font-size: 20px;
    letter-spacing: 4px;
    margin-bottom: 2px;
}

.version {
    font-size: 11px;
    color: #64748b;
    letter-spacing: 1px;
}

.sidebar-status,
.sidebar-summary {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 15px;
}

.sidebar-status p,
.sidebar-summary p {
    font-size: 12px;
    color: var(--text-soft);
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.sidebar-status p + p,
.sidebar-summary p + p {
    margin-top: 8px;
}

.sidebar-summary h4 {
    font-size: 11px;
    color: var(--accent-blue-2);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.main-content {
    flex: 1;
    padding: 36px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.top-header h2 {
    font-size: 28px;
    line-height: 1.2;
}

.top-subtitle {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    white-space: nowrap;
    min-height: 34px;
    background: rgba(255, 255, 255, 0.02);
    max-width: 100%;
}

.status-badge.status-ok {
    border-color: var(--accent-green);
    color: var(--accent-green);
    box-shadow: var(--shadow-green);
}

.status-badge.status-warn {
    border-color: var(--accent-amber);
    color: var(--accent-amber);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.18);
}

.status-badge.status-error {
    border-color: var(--accent-red);
    color: var(--accent-red);
    box-shadow: var(--shadow-red);
}

.dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: currentColor;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
    margin-right: 7px;
    flex-shrink: 0;
}

/* -------------------------------------------------------------------------- */
/* TARJETAS Y BLOQUES                                                         */
/* -------------------------------------------------------------------------- */

.card {
    width: 100%;
    max-width: 980px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    min-width: 0;
}

.card h3 {
    font-size: 22px;
    margin-bottom: 12px;
}

.card p {
    line-height: 1.6;
    color: var(--text-soft);
}

.input-group {
    margin: 20px 0 16px;
    width: 100%;
}

.input-main {
    width: 100%;
    padding: 15px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.input-main::placeholder {
    color: #64748b;
}

.input-main:focus {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-blue);
    transform: translateY(-1px);
}

.input-main:-webkit-autofill,
.input-main:-webkit-autofill:hover,
.input-main:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-main);
    -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
    transition: background-color 9999s ease-in-out 0s;
}

.highlight-box,
.info-box {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.highlight-box {
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-left: 3px solid var(--accent-blue);
    color: var(--text-main);
}

.info-box {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
}

.info-box p {
    font-size: 13px;
    color: var(--text-soft);
}

.info-box p + p {
    margin-top: 8px;
}

.hidden {
    display: none !important;
}

/* -------------------------------------------------------------------------- */
/* BOTONES                                                                    */
/* -------------------------------------------------------------------------- */

.btn-primary,
.btn-outline {
    padding: 14px 28px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    transition: 0.2s ease;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 0 16px rgba(37, 99, 235, 0.28);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #1c2333;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--accent-blue);
    background: rgba(37, 99, 235, 0.06);
}

.btn-outline:active {
    transform: translateY(0);
}

.btn-outline:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    text-decoration: underline;
    font-size: 12px;
    margin-top: 14px;
}

.btn-link:hover {
    color: var(--text-main);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

/* -------------------------------------------------------------------------- */
/* ESTADOS DE TEXTO                                                           */
/* -------------------------------------------------------------------------- */

.status-green {
    color: var(--accent-green);
    font-weight: 700;
}

.warning-text {
    color: #fda4af;
    font-weight: 600;
}

.tech-detail {
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.55;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* -------------------------------------------------------------------------- */
/* LOADING                                                                    */
/* -------------------------------------------------------------------------- */

.loading-bar {
    margin-top: 18px;
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.loading-bar-inner {
    width: 42%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-blue-2));
    border-radius: inherit;
    animation: veridia-loading 1.3s ease-in-out infinite alternate;
}

.loading-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-dim);
}

@keyframes veridia-loading {
    from {
        width: 18%;
        opacity: 0.7;
    }
    to {
        width: 78%;
        opacity: 1;
    }
}

/* -------------------------------------------------------------------------- */
/* INFORME / PDF                                                              */
/* -------------------------------------------------------------------------- */

.certificate-box {
    background: #0a0e17;
    border: 1px solid var(--border);
    padding: 30px;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}

.certificate-box::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.10), transparent 28%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05), transparent 24%);
}

.cert-header {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
    margin-bottom: 24px;
}

.cert-header h3 {
    margin-bottom: 6px;
    font-size: 24px;
    letter-spacing: 0.4px;
}

.tech-id {
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: var(--accent-blue-2);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.report-meta {
    text-align: right;
    min-width: 220px;
}

.report-meta p {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.cert-body {
    position: relative;
    z-index: 1;
}

.main-status {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    margin-bottom: 24px;
    padding: 16px 18px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-soft);
}

.status-line,
.score-line {
    font-size: 14px;
    color: var(--text-soft);
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.summary-pill {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    min-width: 0;
}

.summary-pill .label {
    display: block;
    font-size: 11px;
    color: var(--accent-blue-2);
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}

.summary-pill .value {
    display: block;
    font-size: 14px;
    color: var(--text-main);
    font-weight: 700;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}

.analysis-item {
    background: var(--bg-soft);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    min-height: 100%;
    min-width: 0;
}

.analysis-item strong {
    display: block;
    font-size: 11px;
    color: var(--accent-blue-2);
    margin-bottom: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.analysis-item p,
.analysis-item li,
.analysis-item div {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-soft);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.full-width {
    grid-column: span 2;
}

.findings-list {
    display: grid;
    gap: 12px;
}

.finding-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(96, 165, 250, 0.16);
    border-radius: 10px;
    padding: 14px;
}

.finding-card p {
    margin-bottom: 8px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.finding-card p:last-child {
    margin-bottom: 0;
}

.placeholder-text {
    color: var(--text-dim);
    font-style: italic;
}

.remediation-list {
    list-style: none;
    margin-top: 8px;
    display: grid;
    gap: 8px;
    min-width: 0;
}

.remediation-list li {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.55;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.remediation-list ul {
    margin-top: 8px;
    margin-left: 18px;
}

.remediation-list ul li {
    list-style: disc;
    color: var(--text-soft);
}

.metrics-footer,
.report-severity-grid {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.metrics-footer {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: rgba(0, 0, 0, 0.25);
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
}

.report-severity-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 12px;
    font-size: 11px;
    font-family: "Courier New", monospace;
    color: var(--text-dim);
    line-height: 1.5;
    min-width: 0;
}

.metric span:last-child {
    color: var(--text-main);
    font-weight: 700;
    margin-left: 6px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.report-footer-block {
    position: relative;
    z-index: 1;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.report-footer-block p {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.date-line {
    margin-top: 14px;
    font-size: 12px;
    color: var(--text-dim);
}

/* -------------------------------------------------------------------------- */
/* FOOTER LEGAL                                                               */
/* -------------------------------------------------------------------------- */

.footer-legal {
    max-width: 980px;
    font-size: 12px;
    color: var(--text-dim);
    padding-bottom: 24px;
}

.footer-legal a {
    color: var(--accent-blue-2);
    text-decoration: none;
}

.footer-legal a:hover {
    text-decoration: underline;
}

.footer-legal p {
    margin-top: 8px;
    color: var(--text-dim);
}

/* -------------------------------------------------------------------------- */
/* MODALES                                                                    */
/* -------------------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-card);
    padding: 34px;
    border-radius: 14px;
    text-align: center;
    border: 1px solid var(--border);
    max-width: 520px;
    width: 100%;
    max-height: min(90vh, 900px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-content h3 {
    margin-bottom: 12px;
}

.modal-content p {
    color: var(--text-soft);
    line-height: 1.65;
}

.icon-blocked {
    font-size: 32px;
    margin-bottom: 10px;
}

.price-highlight {
    margin: 24px 0;
    font-size: 16px;
    font-weight: 700;
    color: white;
    background: rgba(37, 99, 235, 0.10);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.35);
}

.legal-box {
    text-align: left;
}

.legal-scroll {
    max-height: 220px;
    overflow-y: auto;
    font-size: 12px;
    color: var(--text-dim);
    margin: 20px 0;
    padding-right: 10px;
    scrollbar-width: thin;
}

.legal-scroll p + p {
    margin-top: 12px;
}

/* -------------------------------------------------------------------------- */
/* UTILIDAD VISUAL PARA PDF                                                   */
/* -------------------------------------------------------------------------- */

#pdf-content {
    page-break-inside: avoid;
}

#pdf-content .analysis-item,
#pdf-content .finding-card,
#pdf-content .summary-pill,
#pdf-content .metric {
    break-inside: avoid;
    page-break-inside: avoid;
}

#pdf-content .btn-primary,
#pdf-content .btn-outline,
#pdf-content .btn-link {
    display: none !important;
}

/* -------------------------------------------------------------------------- */
/* RESPONSIVE                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
    .summary-strip {
        grid-template-columns: 1fr;
    }

    .metrics-footer {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-severity-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .dashboard {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .main-content {
        padding: 20px;
    }

    .top-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card {
        padding: 22px;
    }

    .cert-header {
        flex-direction: column;
    }

    .report-meta {
        text-align: left;
        min-width: auto;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: auto;
    }

    .metrics-footer,
    .report-severity-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    html,
    body {
        overflow-x: hidden;
    }

    .logo {
        width: 84px;
        height: 84px;
    }

    .top-header h2 {
        font-size: 22px;
    }

    .main-status {
        flex-direction: column;
        gap: 12px;
    }

    .metrics-footer,
    .report-severity-grid {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary,
    .btn-outline {
        width: 100%;
    }

    .modal-content {
        padding: 24px;
    }

    .certificate-box {
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}