/* Styles for the demo-only build widget (build-widget.js). */

/* Matches .np-prof__toggle so the two toolbar toggles look alike.
   No `margin-left: auto` here: .np-prof__toggle already claims one to sit
   hard right, and a second auto margin would SPLIT the free space, stranding
   Profiling mid-toolbar. Build… is mounted before Profiling and so leads it
   on the right-hand group; DOM order is enough, no `order` needed (which
   would also have to outrank the <h1>, dragging the title out of place). */
.np-build__toggle {
    padding: 4px 12px;
    font: inherit;
    font-size: 0.82rem;
    color: #eee;
    background: #2d2d4a;
    border: 1px solid #44446a;
    border-radius: 6px;
    cursor: pointer;
}

.np-build__toggle:hover {
    background: #3a3a5c;
}

.np-build__btn {
    padding: 4px 12px;
    font: inherit;
    font-size: 0.82rem;
    color: #eee;
    background: #2d2d4a;
    border: 1px solid #44446a;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}

.np-build__btn:hover {
    background: #3a3a5c;
}

.np-build__btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* `display: flex` on a class beats the [hidden] attribute's built-in
   `display: none`, so hiding the panel would set the property and change
   nothing on screen. Restore it explicitly. */
.np-build[hidden] {
    display: none;
}

/* Top-centre under the toolbar — the same anchor profiling-widget.css uses.
   The horizontal centre is clear of MapLibre's corner controls, so no
   per-corner pixel offsets are needed. */
.np-build {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-width: 280px;
    max-width: min(520px, calc(100vw - 20px));
    padding: 10px 12px;
    font-size: 0.82rem;
    color: #eee;
    background: #1a1a2e;
    border: 1px solid #44446a;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.np-build__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.np-build__title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9a9ac0;
}

/* Pushed hard right of the title. */
.np-build__elapsed {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
    color: #9a9ac0;
}

/* Same trap as .np-build: a display rule would override [hidden]. */
.np-build__pickers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.np-build__note {
    margin-top: 8px;
    line-height: 1.35;
    color: #9a9ac0;
}

.np-build__cancel[hidden] {
    display: none;
}

.np-build__cancel {
    color: #ff9aa2;
    border-color: #6b3f45;
    background: #40242a;
}

.np-build__cancel:hover {
    background: #552f36;
}

.np-build__spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #44446a;
    border-top-color: #8fb8ff;
    border-radius: 50%;
    animation: np-build-spin 0.7s linear infinite;
}

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

/* Reduced motion: keep the running/idle distinction without the animation. */
@media (prefers-reduced-motion: reduce) {
    .np-build__spinner {
        animation: none;
        border-top-color: #8fb8ff;
        opacity: 0.8;
    }
}

/* No display rule here, so the [hidden] attribute works natively — unlike
   the flex containers above, which need it restoring. */
.np-build__log {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    max-height: 30vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.np-build__line {
    padding: 2px 0;
    line-height: 1.35;
    /* Build lines carry long paths and filenames; wrap rather than clip. */
    overflow-wrap: anywhere;
}

.np-build__line--ok {
    color: #a8dcb8;
}

.np-build__line--error {
    color: #ff9aa2;
}

/* Same trap as .np-build above: display:flex would override [hidden]. */
.np-build__actions[hidden] {
    display: none;
}

.np-build__actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.np-build__download {
    color: #cfe9d4;
    border-color: #3f6b4d;
    background: #24402f;
}

.np-build__download:hover {
    background: #2f5540;
}
