/* ==========================================================================
   Network Latency Tester (issue #68)
   Design tokens from main.css only (UI Guidelines).
   ========================================================================== */

.nlt-container {
    max-width: var(--app-container-max);
    margin: 0 auto;
}

/* Sticky progress block (spec F4). The site header is position: fixed at
   --header-height, so the block pins BELOW it — never overlapping. */
.nlt-progress {
    position: sticky;
    top: calc(var(--header-height) + 12px);
    z-index: 900;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.nlt-progress__row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nlt-progress__row + .nlt-progress__row {
    margin-top: 8px;
}

.nlt-progress__phase {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-primary-text);
    min-width: 90px;
}

.nlt-progress__meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.nlt-progress__pct {
    font-weight: 600;
    color: var(--color-text);
}

.nlt-progress__track {
    flex: 1 1 100%;
    height: 10px;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.nlt-progress__fill {
    height: 100%;
    width: 0;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.nlt-progress__rtt {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

.nlt-progress__spark {
    flex: 1 1 160px;
    height: 64px;
    min-width: 120px;
}

/* Stop control: >= 44x44 px touch target (spec §10.3). */
.nlt-stop {
    min-width: 44px;
    min-height: 44px;
}

/* Preset picker (radiogroup). 2 columns mobile, 3 columns desktop. */
.nlt-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 12px 0 8px;
}

@media (min-width: 1024px) {
    .nlt-presets {
        grid-template-columns: repeat(3, 1fr);
    }
}

.nlt-preset {
    position: relative;
    display: block;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.nlt-preset:hover {
    border-color: var(--color-primary-light);
}

.nlt-preset input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.nlt-preset:has(input:checked) {
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.nlt-preset input:focus-visible + .nlt-preset__body {
    outline: 3px solid var(--color-primary-light);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.nlt-preset__name {
    font-weight: 600;
    font-size: var(--font-size-base);
    display: block;
}

.nlt-preset__flag {
    display: inline-block;
    font-size: var(--font-size-xs);
    color: var(--color-primary-text);
    font-weight: 600;
    margin-left: 6px;
}

.nlt-preset__servers {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: 4px;
}

.nlt-preset__ref {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    margin-top: 4px;
}

/* Run-length radios. */
.nlt-modes {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.nlt-mode {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.nlt-mode input {
    accent-color: var(--color-primary);
    width: 18px;
    height: 18px;
}

/* Panels/cards. */
.nlt-panel {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 16px;
}

.nlt-panel__title {
    font-size: var(--font-size-lg);
    margin: 0 0 8px;
}

/* Methodology disclosure in the intro (expanded desktop / collapsed mobile). */
.nlt-method {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 16px;
}

.nlt-method summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--color-primary-text);
}

.nlt-method summary:hover {
    color: var(--color-primary-text-hover);
}

.nlt-method summary:focus-visible {
    outline: 3px solid var(--color-primary-light);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.nlt-method p {
    margin: 8px 0 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

/* .nlt-method--intro: expanded by default on desktop via JS (spec §10.1);
   no CSS override needed. */

.nlt-privacy {
    margin-top: 12px;
    font-size: var(--font-size-sm);
    color: var(--color-success-text);
}

/* Error / notice state. */
.nlt-error {
    border: 1px solid var(--color-error);
    background: rgba(239, 68, 68, 0.08);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.nlt-error__text {
    margin: 0 0 12px;
    color: var(--color-error-text);
    font-weight: 600;
}

/* Partial-results banner. */
.nlt-partial {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid var(--color-warning);
    color: var(--color-warning-text);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Verdict banner. */
.nlt-verdict {
    background: var(--color-bg-alt);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.nlt-verdict__band {
    display: block;
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin: 0 0 6px;
}

.nlt-verdict__note {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

/* Stat cards row (2 columns mobile, 4 columns desktop). */
.nlt-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

@media (min-width: 1024px) {
    .nlt-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

.nlt-stat {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
}

/* Accessible stat-card title (screen readers); the visible label is
   aria-hidden and driven by the same i18n keys (JS may enrich it). */
.nlt-stat__title {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.nlt-stat__label {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nlt-panel__subtitle {
    font-weight: 600;
    font-size: var(--font-size-sm);
    margin: 16px 0 4px;
}

.nlt-panel__hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin: 8px 0 0;
}

.nlt-stat__value {
    display: block;
    font-size: var(--font-size-xl);
    font-weight: 700;
    font-family: var(--font-mono);
    margin: 4px 0 2px;
}

.nlt-stat__count {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
}

/* Sparklines. */
.nlt-spark,
.nlt-spark--result {
    display: block;
    width: 100%;
    height: 64px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-alt);
}

.nlt-spark--result {
    height: 160px;
    margin-top: 8px;
}

.nlt-spark-line {
    fill: none;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.nlt-spark-line--idle {
    stroke: var(--color-primary);
}

.nlt-spark-line--load {
    stroke: var(--color-warning);
}

.nlt-spark-region--load {
    fill: rgba(245, 158, 11, 0.10);
}

.nlt-spark-extremum {
    stroke: var(--color-border-dark);
    stroke-dasharray: 4 3;
}

.nlt-spark-anno {
    font-size: 10px;
    fill: var(--color-text-muted);
}

/* Bufferbloat-lite card. */
.nlt-bb__row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 8px 0;
    font-size: var(--font-size-sm);
}

.nlt-bb__row dt {
    color: var(--color-text-muted);
}

.nlt-bb__row dd {
    margin: 0;
    font-family: var(--font-mono);
    font-weight: 600;
}

.nlt-bb__verdict {
    font-weight: 600;
    margin: 8px 0;
}

.nlt-bb__caveat {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    margin: 8px 0 0;
}

/* Serving edge + integrity panel. */
.nlt-edge {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0 0 16px;
}

.nlt-integrity {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 16px;
    font-size: var(--font-size-sm);
}

.nlt-integrity dl {
    margin: 8px 0 0;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 4px 12px;
}

.nlt-integrity dt {
    color: var(--color-text-muted);
}

.nlt-integrity dd {
    margin: 0;
}

/* Annotations. */
.nlt-ann {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
}

.nlt-ann--warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid var(--color-warning);
    color: var(--color-warning-text);
}

.nlt-ann--info {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

/* Results actions. */
.nlt-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.nlt-actions .btn {
    min-height: 44px;
}

/* Cross-links card. */
.nlt-cross {
    margin-top: 16px;
}

.nlt-cross ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

@media (min-width: 1024px) {
    .nlt-cross ul {
        grid-template-columns: repeat(4, 1fr);
    }
}

.nlt-cross a {
    display: block;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-primary-text);
    font-size: var(--font-size-sm);
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.nlt-cross a:hover {
    border-color: var(--color-primary-light);
    background: var(--color-bg-alt);
}

.nlt-cross a:focus-visible {
    outline: 3px solid var(--color-primary-light);
    outline-offset: 2px;
}
