/**
 * BITV v2.0 Wizard — Routing Popup (Runtime)
 * Migrated from BITV v1.4 popup.css
 * Uses CSS custom properties from wizard.css / theme overrides
 */

/* ── Overlay ── */
.wiz-routing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--wiz-spacing-md, 1rem);
}

/* ── Popup container ── */
.wiz-routing-popup {
    background: var(--wiz-color-bg, #fff);
    border-radius: var(--wiz-border-radius, 0);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--wiz-font-family, 'Lato', 'Segoe UI', Arial, sans-serif);
    /* Don't set color explicitly — inherit from themed ancestor (e.g. [data-wiz-theme="fennec"] sets color directly) */
    /* Override base .wiz-dialog padding so the header/content/footer layout stays intact */
    padding: 0;
}

/* ── Header ── */
.wiz-routing-popup__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--wiz-spacing-md, 1rem) var(--wiz-spacing-lg, 1.25rem);
    /* No own background — let popup container (theme-aware .wiz-dialog) show through.
       A subtle theme-colored border separates it from content. */
    background: transparent;
    border-bottom: 1px solid var(--wiz-color-border-light, #ccc);
    min-height: 52px;
    flex-shrink: 0;
}

.wiz-routing-popup__title {
    margin: 0;
    font-size: var(--wiz-font-size-lg, 1.1rem);
    font-weight: 600;
    /* Inherit from popup container so theme-set color (e.g. fennec #fafaf9) applies */
    color: inherit;
    line-height: 1.3;
}

.wiz-routing-popup__close--header {
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--wiz-color-text-muted, #666);
    padding: var(--wiz-spacing-xs, 0.25rem) var(--wiz-spacing-sm, 0.5rem);
    line-height: 1;
    border-radius: var(--wiz-border-radius, 4px);
    flex-shrink: 0;
    margin-left: 0.75rem;
    transition: background var(--wiz-transition, 150ms ease-in-out),
                color var(--wiz-transition, 150ms ease-in-out);
}

.wiz-routing-popup__close--header:hover,
.wiz-routing-popup__close--header:focus {
    background: var(--wiz-color-border-light, #e0e0e0);
    color: var(--wiz-color-text, #111);
    outline: var(--wiz-focus-outline, 3px solid var(--wiz-color-focus));
    outline-offset: var(--wiz-focus-offset, 2px);
}

/* ── Content ── */
.wiz-routing-popup__content {
    padding: var(--wiz-spacing-lg, 1.25rem);
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

/* ── Form Elements ── */
.wiz-routing-element--text {
    font-size: var(--wiz-font-size-base, 0.95rem);
    color: var(--wiz-color-text, #333);
    line-height: 1.5;
}

.wiz-routing-element--button {
    display: flex;
    justify-content: flex-start;
}

.wiz-routing-element--input {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.wiz-routing-element--input label {
    font-size: var(--wiz-font-size-sm, 0.875rem);
    font-weight: 500;
    color: var(--wiz-color-text-muted, #444);
}

.wiz-routing-input,
.wiz-routing-select {
    padding: var(--wiz-spacing-sm, 0.5rem) 0.75rem;
    border: 1px solid var(--wiz-color-border-light, #bbb);
    border-radius: var(--wiz-border-radius, 4px);
    font-family: var(--wiz-font-family, inherit);
    font-size: var(--wiz-font-size-base, 0.95rem);
    color: var(--wiz-color-text, #1a1a1a);
    background: var(--wiz-color-bg, #fff);
    width: 100%;
    box-sizing: border-box;
    transition: border-color var(--wiz-transition, 150ms ease-in-out),
                box-shadow var(--wiz-transition, 150ms ease-in-out);
}

.wiz-routing-input:focus,
.wiz-routing-select:focus {
    outline: none;
    border-color: var(--wiz-color-primary, #63BAEF);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wiz-color-primary, #63BAEF) 15%, transparent);
}

.wiz-routing-input-info {
    font-size: 0.8rem;
    color: var(--wiz-color-error, #c62828);
    padding: var(--wiz-spacing-xs, 0.25rem) 0;
}

/* ── Footer ── */
.wiz-routing-popup__footer {
    padding: 0.875rem var(--wiz-spacing-lg, 1.25rem);
    background: transparent;
    border-top: 1px solid var(--wiz-color-border-light, #ccc);
    flex-shrink: 0;
}

.wiz-routing-popup__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
    flex-wrap: wrap;
}

/* ── Buttons ──
   Styling is delegated to `.wiz-btn .wiz-btn--primary/--secondary` from wizard.css
   and theme-specific overrides. No popup-specific button colors here — the popup
   uses the same button styles as the rest of the wizard (including hover, focus). */
.wiz-routing-popup__btn {
    white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .wiz-routing-popup {
        max-width: 98vw;
        max-height: 95vh;
    }

    .wiz-routing-popup__actions {
        justify-content: stretch;
    }

    .wiz-routing-popup__btn {
        flex: 1;
        text-align: center;
    }
}
