/* =========================================================
   NEXENG | Internet Speed Test
   Archivo: /apps/internet_speed_test/assets/internet-speed-test.css
   Version: 1.0.0

   Mantener este archivo específico de la app.
   La estética principal vive en:
   /assets/css/nexeng-app-base.css
   ========================================================= */

/* =========================================================
   Layout principal de speed test
   ========================================================= */

.nx-speed-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(360px, 0.72fr);
    gap: 22px;
    align-items: start;
    margin-top: 22px;
}

.nx-speed-main-panel {
    display: grid;
    gap: 18px;
    text-align: center;
}

.nx-speed-gauge-wrap {
    width: min(360px, 100%);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    display: grid;
    place-items: center;
    position: relative;
}

.nx-speed-gauge {
    width: 100%;
    height: 100%;
    display: block;
}

.nx-speed-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.nx-speed-note {
    text-align: left;
    margin-top: 0;
}

/* =========================================================
   Gauge / Canvas support
   ========================================================= */

#graphCanvas,
#gaugeCanvas {
    display: block;
}

.nx-speed-graph-section,
.nx-speed-comparison-section {
    margin-top: 22px;
}

.nx-speed-graph-wrap {
    width: 100%;
    height: 210px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(15, 87, 130, 0.12);
    border-radius: 20px;
    background:
        linear-gradient(rgba(2, 132, 199, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(2, 132, 199, 0.04) 1px, transparent 1px),
        rgba(248, 251, 255, 0.86);
    background-size: 32px 32px;
}

.nx-speed-graph {
    width: 100%;
    height: 100%;
}

/* =========================================================
   Leyenda
   ========================================================= */

.nx-speed-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--nx-muted);
    font-size: 0.82rem;
    font-weight: 850;
}

.nx-speed-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nx-speed-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    border-radius: 999px;
}

.nx-speed-dot-download {
    background: var(--nx-accent);
    box-shadow: 0 0 0 5px rgba(2, 132, 199, 0.10);
}

.nx-speed-dot-upload {
    background: var(--nx-orange);
    box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.10);
}

/* =========================================================
   Estados del test
   ========================================================= */

.nx-speed-testing .nx-speed-gauge-wrap::before {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: 999px;
    border: 2px solid rgba(2, 132, 199, 0.18);
    animation: nxSpeedPulse 1.8s ease-out infinite;
    pointer-events: none;
}

@keyframes nxSpeedPulse {
    0% {
        transform: scale(0.92);
        opacity: 0.75;
    }

    100% {
        transform: scale(1.16);
        opacity: 0;
    }
}

.nx-speed-phase-download {
    color: var(--nx-accent) !important;
}

.nx-speed-phase-upload {
    color: var(--nx-orange) !important;
}

.nx-speed-phase-error {
    color: var(--nx-danger) !important;
}

/* =========================================================
   Resultados
   ========================================================= */

#heroPrimaryResult,
#downloadValue,
#uploadValue,
#pingValue,
#jitterValue,
#qualityValue,
#durationValue,
#summaryDownload,
#summaryUpload,
#summaryPing {
    overflow-wrap: anywhere;
}

#downloadValue,
#uploadValue {
    font-variant-numeric: tabular-nums;
}

.nx-speed-value-download {
    color: var(--nx-accent) !important;
}

.nx-speed-value-upload {
    color: var(--nx-orange) !important;
}

/* =========================================================
   Comparativa
   ========================================================= */

.nx-speed-bars {
    display: grid;
    gap: 14px;
}

.nx-speed-bar-row {
    display: grid;
    gap: 7px;
}

.nx-speed-bar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--nx-soft);
    font-size: 0.88rem;
    font-weight: 850;
}

.nx-speed-bar-head strong {
    color: var(--nx-text);
    font-size: 0.92rem;
}

.nx-speed-bar-head span:last-child {
    color: var(--nx-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.82rem;
}

.nx-speed-bar-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15, 87, 130, 0.08);
}

.nx-speed-bar-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--nx-accent), var(--nx-accent-3));
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.nx-speed-bar-fill.is-muted {
    background: linear-gradient(90deg, rgba(107, 127, 149, 0.55), rgba(107, 127, 149, 0.28));
}

.nx-speed-bar-fill.is-upload {
    background: linear-gradient(90deg, var(--nx-orange), #fbbf24);
}

/* =========================================================
   Servidor
   ========================================================= */

.nx-speed-server-section {
    margin-top: 22px;
}

.nx-speed-server-section h2 {
    overflow-wrap: anywhere;
}

/* =========================================================
   Historial
   ========================================================= */

.nx-speed-history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--nx-muted);
    font-size: 0.82rem;
}

.nx-speed-history-metric {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.nx-speed-history-metric.is-download {
    color: var(--nx-accent);
}

.nx-speed-history-metric.is-upload {
    color: var(--nx-orange);
}

.nx-speed-history-metric.is-ping {
    color: var(--nx-soft);
}

/* =========================================================
   Avisos técnicos
   ========================================================= */

#engineeringWarning {
    white-space: normal;
}

#engineeringWarning ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

#engineeringWarning li + li {
    margin-top: 6px;
}

/* =========================================================
   Chips / riesgos por calidad
   ========================================================= */

.nx-risk-low {
    color: #047857 !important;
    background: rgba(5, 150, 105, 0.10) !important;
    border-color: rgba(5, 150, 105, 0.22) !important;
}

.nx-risk-medium {
    color: #b45309 !important;
    background: rgba(217, 119, 6, 0.10) !important;
    border-color: rgba(217, 119, 6, 0.22) !important;
}

.nx-risk-high {
    color: #b91c1c !important;
    background: rgba(220, 38, 38, 0.10) !important;
    border-color: rgba(220, 38, 38, 0.22) !important;
}

/* =========================================================
   Botón durante test
   ========================================================= */

#startTestBtn.is-testing {
    border-color: rgba(220, 38, 38, 0.32);
    background: linear-gradient(135deg, #dc2626, #f97316);
    color: #ffffff;
    box-shadow: 0 14px 32px rgba(220, 38, 38, 0.20);
}

#stopTestBtn:not([hidden]) {
    display: inline-flex;
}

/* =========================================================
   Noscript
   ========================================================= */

.nx-noscript {
    width: min(100% - 32px, 760px);
    margin: 24px auto;
    padding: 16px 18px;
    border: 1px solid rgba(220, 38, 38, 0.22);
    border-radius: 18px;
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b;
    font-weight: 800;
    text-align: center;
}

/* =========================================================
   Responsive específico
   ========================================================= */

@media (max-width: 1050px) {
    .nx-speed-layout {
        grid-template-columns: 1fr;
    }

    .nx-speed-gauge-wrap {
        width: min(340px, 100%);
    }
}

@media (max-width: 720px) {
    .nx-speed-layout {
        gap: 18px;
    }

    .nx-speed-graph-wrap {
        height: 180px;
    }

    .nx-speed-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .nx-speed-actions .nx-btn {
        width: 100%;
    }

    .nx-speed-legend {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .nx-speed-gauge-wrap {
        width: min(300px, 100%);
    }

    .nx-speed-graph-wrap {
        height: 160px;
    }

    .nx-speed-bar-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}