/* ux.css — UX improvements: step rail, responsive, a11y, progressive disclosure, banners */

/* ============================================================
   STEP RAIL
   ============================================================ */

.step-rail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #0f3460;
    border-bottom: 1px solid #1a4a8a;
    gap: 4px;
    flex-shrink: 0;
}

.step-rail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
    cursor: default;
    white-space: nowrap;
    transition: color 0.2s;
}

.step-rail-item.active {
    color: #e94560;
    font-weight: 600;
}

.step-rail-item.complete {
    color: #4caf50;
    cursor: pointer;
}

.step-rail-item.complete:hover {
    color: #66bb6a;
}

.step-rail-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid #444;
    background: transparent;
    transition: all 0.2s;
    flex-shrink: 0;
}

.step-rail-item.active .step-rail-number {
    border-color: #e94560;
    background: #e94560;
    color: white;
}

.step-rail-item.complete .step-rail-number {
    border-color: #4caf50;
    background: #4caf50;
    color: white;
}

.step-rail-connector {
    flex: 1;
    height: 2px;
    background: #333;
    min-width: 8px;
    max-width: 24px;
}

.step-rail-connector.complete {
    background: #4caf50;
}

/* ============================================================
   READINESS BADGE
   ============================================================ */

.readiness-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.readiness-badge.ready {
    background: #1a2a1a;
    border: 1px solid #2a4a2a;
    color: #4caf50;
}

.readiness-badge.not-ready {
    background: #2a1a1a;
    border: 1px solid #4a2a2a;
    color: #ef5350;
}

.readiness-badge .badge-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.readiness-badge .badge-text {
    font-size: 11px;
    line-height: 1.4;
}

/* ============================================================
   PROGRESSIVE DISCLOSURE — FLASH GROUPS
   ============================================================ */

.flash-group {
    margin-bottom: 2px;
}

.flash-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: #0a0a1a;
    border: 1px solid #0f3460;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    font-weight: 600;
    color: #a0a0c0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.15s;
    margin-top: 6px;
}

.flash-group-header:hover {
    background: #0f1a2e;
}

.flash-group-header .chevron {
    font-size: 10px;
    transition: transform 0.2s;
    color: #666;
}

.flash-group-header.expanded .chevron {
    transform: rotate(180deg);
}

.flash-group-body {
    display: none;
    padding: 4px 0;
}

.flash-group-body.expanded {
    display: block;
}

/* Required group is always visible */
.flash-group[data-group="required"] .flash-group-body {
    display: block;
}

.flash-group[data-group="required"] .flash-group-header {
    display: none;
}

/* ============================================================
   PINNED VERIFICATION CARD
   ============================================================ */

#flash-verify-summary.pinned {
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
    margin-top: 8px;
}

/* ============================================================
   FLASH MESSAGE (structured error/status)
   ============================================================ */

.flash-message {
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 6px;
}

.flash-message .fm-problem {
    font-weight: 600;
    margin-bottom: 2px;
}

.flash-message .fm-why {
    font-size: 11px;
    opacity: 0.8;
}

.flash-message .fm-action {
    margin-top: 4px;
}

.flash-message .fm-action-btn {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    margin-top: 2px;
}

.flash-message.fm-info    { background: #1a2a3a; border: 1px solid #1a4a8a; color: #64b5f6; }
.flash-message.fm-success { background: #1a2a1a; border: 1px solid #2a4a2a; color: #4caf50; }
.flash-message.fm-error   { background: #2a1a1a; border: 1px solid #4a2a2a; color: #ef5350; }
.flash-message.fm-warning { background: #2a2a1a; border: 1px solid #4a3a2a; color: #ffa726; }

.flash-message.fm-info    .fm-action-btn { background: #1565c0; color: white; }
.flash-message.fm-success .fm-action-btn { background: #2e7d32; color: white; }
.flash-message.fm-error   .fm-action-btn { background: #c62828; color: white; }
.flash-message.fm-warning .fm-action-btn { background: #e65100; color: white; }

/* Simple status (backward compat) */
.flash-message.fm-simple {
    background: transparent;
    border: none;
    padding: 0;
    text-align: center;
    min-height: 1.2em;
}

/* ============================================================
   MAP CAPTURE BANNER
   ============================================================ */

.capture-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #ffa726;
    color: #1a1a2e;
    font-size: 13px;
    font-weight: 600;
    z-index: 800;
    flex-shrink: 0;
}

.capture-banner.active {
    display: flex;
}

.capture-banner .capture-cancel-btn {
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #1a1a2e;
    transition: background 0.15s;
}

.capture-banner .capture-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.35);
}

/* ============================================================
   TYPOGRAPHY & CONTRAST (E2)
   ============================================================ */

/* Bump muted text from #a0a0c0 → #b0b0d0 for WCAG AA on #16213e */
.panel h3 {
    color: #b0b0d0;
}

/* Operational text: minimum 12px for flash panel controls */
#flash-panel-body label {
    font-size: 12px;
    color: #b0b0cc;
}

#flash-panel-body select,
#flash-panel-body input {
    font-size: 13px;
}

/* Status/feedback text: minimum 12px */
#flash-status,
[id$="-pool-status"],
[id$="-mfr-status"] {
    font-size: 12px !important;
}

/* Metadata-only text that can stay small */
.meta-text {
    font-size: 10px;
    color: #666;
}

/* ============================================================
   RESPONSIVE — MODE SELECTORS & LAYOUT
   ============================================================ */

/* Current mode badge in toolbar */
#current-mode-badge {
    display: none;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

@media (max-width: 900px) {
    body {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid #0f3460;
    }

    #map-container {
        height: 50vh;
        min-height: 200px;
    }

    /* Mode tabs: wrap to 3 per row */
    .mode-tabs {
        flex-wrap: wrap;
    }

    .mode-tabs .mode-tab,
    .mode-tabs button[role="tab"] {
        flex: 0 0 calc(33.3% - 3px);
        font-size: 11px;
        padding: 6px 2px;
    }

    /* Flash mode buttons: wrap to 3 per row */
    #track-mode-toggle {
        flex-wrap: wrap;
    }

    #track-mode-toggle button.mode-tab {
        flex: 0 0 calc(33.3% - 3px);
        font-size: 10px;
        padding: 6px 2px;
    }

    /* Show current mode badge */
    #current-mode-badge {
        display: inline-block;
    }

    /* Step rail: compact */
    .step-rail {
        padding: 6px 10px;
    }

    .step-rail-item {
        font-size: 11px;
    }

    .step-rail-number {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    /* Mode tabs: 2 per row on very small screens */
    .mode-tabs .mode-tab,
    .mode-tabs button[role="tab"] {
        flex: 0 0 calc(50% - 2px);
    }

    #track-mode-toggle button.mode-tab {
        flex: 0 0 calc(50% - 2px);
    }

    /* Step rail: hide labels, show numbers only */
    .step-rail-label {
        display: none;
    }

    .step-rail {
        justify-content: center;
    }
}

/* ============================================================
   STICKY ACTION FOOTER (mobile only)
   ============================================================ */

.sticky-action-footer {
    display: none;
}

@media (max-width: 900px) {
    .sticky-action-footer {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #16213e;
        border-top: 2px solid #0f3460;
        padding: 8px 16px;
        z-index: 1000;
        gap: 8px;
        align-items: center;
    }

    .sticky-action-footer .footer-mode-label {
        font-size: 11px;
        color: #b0b0d0;
        white-space: nowrap;
    }

    .sticky-action-footer .footer-action-btn {
        flex: 1;
        padding: 10px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 600;
        color: white;
        text-align: center;
    }

    /* Pad sidebar bottom so content isn't hidden behind footer */
    #sidebar {
        padding-bottom: 56px;
    }
}

/* ============================================================
   ACCESSIBILITY — FOCUS & ARIA
   ============================================================ */

/* Visible focus ring for keyboard users */
button:focus-visible,
select:focus-visible,
input:focus-visible,
[role="tab"]:focus-visible {
    outline: 2px solid #64b5f6;
    outline-offset: 2px;
}

/* Tab styling for button-based tabs */
button.mode-tab {
    background: #1a1a2e;
    border: 1px solid #0f3460;
    color: #a0a0c0;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    border-radius: 4px;
    transition: all 0.2s;
    padding: 8px 4px;
    font-family: inherit;
}

button.mode-tab.active,
button.mode-tab[aria-selected="true"] {
    background: var(--mode-tab-accent, #e94560);
    color: white;
    border-color: var(--mode-tab-accent, #e94560);
}

button.mode-tab:hover:not(.active):not([aria-selected="true"]) {
    background: #0f3460;
}

/* Collapsible ARIA expanded indicator */
[aria-expanded="false"] + .flash-group-body {
    display: none;
}

[aria-expanded="true"] + .flash-group-body {
    display: block;
}

/* Modal dialog overlay */
.modal-overlay[role="dialog"] {
    display: flex;
}

/* ============================================================
   KEYBOARD SHORTCUT CHEAT SHEET
   ============================================================ */

.shortcut-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 20000;
    align-items: center;
    justify-content: center;
}

.shortcut-overlay.visible {
    display: flex;
}

.shortcut-card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
}

.shortcut-card h3 {
    color: #e94560;
    font-size: 14px;
    margin-bottom: 16px;
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #0f3460;
    font-size: 12px;
}

.shortcut-key {
    background: #0f3460;
    color: #e0e0e0;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 11px;
}

.shortcut-desc {
    color: #b0b0d0;
}

/* ============================================================
   FIRST-RUN PATH CHOOSER
   ============================================================ */

.first-run-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 20001;
    align-items: center;
    justify-content: center;
}

.first-run-overlay.visible {
    display: flex;
}

.first-run-card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 12px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.first-run-card h2 {
    color: #e0e0e0;
    font-size: 18px;
    margin-bottom: 8px;
}

.first-run-card .subtitle {
    color: #888;
    font-size: 13px;
    margin-bottom: 24px;
}

.first-run-option {
    display: block;
    padding: 16px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    transition: border-color 0.2s, background 0.2s;
}

.first-run-option:hover {
    border-color: #e94560;
    background: #1a2040;
}

.first-run-option .fro-title {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.first-run-option .fro-desc {
    color: #888;
    font-size: 12px;
}

.first-run-skip {
    margin-top: 12px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    border: none;
    background: none;
    text-decoration: underline;
}

.first-run-skip:hover {
    color: #999;
}

/* ============================================================
   WIZARD LAYOUT SYSTEM
   Shared structural classes for all 15 wizard panels.
   Per-wizard accent via --wiz-accent custom property.
   ============================================================ */

:root {
    /* Per-wizard accent colors */
    --wiz-accent-gpstest:     #4caf50;
    --wiz-accent-quickflash:  #2196f3;
    --wiz-accent-stresstest:  #ff9800;
    --wiz-accent-fielddeploy: #4caf50;
    --wiz-accent-quickflight: #e94560;
    --wiz-accent-single:      #e94560;
    --wiz-accent-multi:       #e94560;
    --wiz-accent-chaos:       #ff5722;
    --wiz-accent-ballistic:   #f44336;
    --wiz-accent-delivery:    #9c27b0;
    --wiz-accent-mothership:  #ff9800;
    --wiz-accent-deliverywiz: #9c27b0;
    --wiz-accent-ridgen:      #607d8b;
    --wiz-accent-skywriting:  #00bcd4;
    --wiz-accent-imageobj:    #8bc34a;

    /* Shared wizard tokens */
    --wiz-bg:       #1a1a2e;
    --wiz-bg-card:  #0f0f1f;
    --wiz-border:   #0f3460;
    --wiz-text:     #e0e0e0;
    --wiz-text-dim: #a0a0c0;
    --wiz-radius:   4px;
}

/* Wizard section — hidden by default, shown when active */
.wiz-section { display: none; }
.wiz-section.active { display: block; }

/* Main wizard card */
.wiz-card {
    background: var(--wiz-bg);
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius);
    padding: 10px;
    margin-bottom: 10px;
}

/* Wizard title */
.wiz-title {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--wiz-accent, #e0e0e0);
}

/* Wizard description */
.wiz-desc {
    font-size: 11px;
    color: var(--wiz-text-dim);
    margin: 0 0 10px;
}

/* Step block */
.wiz-step { margin-bottom: 10px; }

.wiz-step-label {
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--wiz-accent, #64b5f6);
}

/* Button row (board selectors, option groups) */
.wiz-btn-row { display: flex; gap: 4px; }

/* Form controls */
.wiz-select, .wiz-input {
    width: 100%;
    padding: 4px 6px;
    background: #0a0a1a;
    border: 1px solid var(--wiz-border);
    color: var(--wiz-text);
    border-radius: var(--wiz-radius);
    font-size: 12px;
}

.wiz-select-sm, .wiz-input-sm {
    padding: 4px;
    font-size: 11px;
}

/* Form label + group */
.wiz-label { font-size: 11px; color: var(--wiz-text-dim); }
.wiz-field { margin-bottom: 8px; }
.wiz-row { display: flex; gap: 4px; margin-bottom: 4px; }

/* Review card */
.wiz-review {
    display: none;
    background: var(--wiz-bg-card);
    border: 1px solid #1a1a3a;
    border-radius: var(--wiz-radius);
    padding: 8px;
}
.wiz-review.visible { display: block; }

.wiz-review-title {
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--wiz-accent, #64b5f6);
}

.wiz-review-content {
    font-size: 10px;
    color: var(--wiz-text-dim);
    line-height: 1.6;
}

/* Status / result text */
.wiz-status {
    font-size: 10px;
    color: var(--wiz-text-dim);
    font-family: monospace;
    min-height: 1.2em;
}

/* Primary action button */
.wiz-action-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: var(--wiz-radius);
    cursor: pointer;
    font-size: 14px;
    color: white;
    background: var(--wiz-accent, #2196f3);
}

/* Customize link */
.wiz-customize-link {
    font-size: 10px;
    color: #666;
    text-decoration: underline;
}

/* ============================================================
   TAB FAMILY GROUPS
   ============================================================ */

.mode-tab-groups {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.tab-family-label {
    flex-basis: 100%;
    font-size: 9px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
    margin-bottom: 2px;
}
.tab-family-label:first-child { margin-top: 0; }

.tab-family-divider {
    flex-basis: 100%;
    height: 0;
}

/* ============================================================
   WIZARD UTILITY CLASSES — consistent layout across all wizards
   ============================================================ */

/* Flex row for inline controls (range + value, input + button, etc.) */
.wiz-flex { display: flex; align-items: center; gap: 8px; }

/* Flex columns for multi-field rows */
.wiz-col { flex: 1; min-width: 0; }
.wiz-col-2 { flex: 2; min-width: 0; }

/* Range slider wrapper — consistent range + value display */
.wiz-range-group { display: flex; align-items: center; gap: 8px; }
.wiz-range-group input[type="range"] { flex: 1; }
.wiz-range-group .wiz-range-val {
    font-size: 11px;
    font-weight: 600;
    color: var(--wiz-accent, #a0a0c0);
    min-width: 32px;
    text-align: right;
}
.wiz-range-group .wiz-range-unit {
    font-size: 9px;
    color: #666;
}

/* Value highlight — replaces per-wizard inline color spans */
.wiz-val {
    font-weight: 600;
    color: var(--wiz-accent, #a0a0c0);
}

/* Normalize wizard text inputs */
.wiz-input {
    width: 100%;
    padding: 4px 8px;
    background: var(--wiz-bg-card);
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius);
    color: var(--wiz-text);
    font-size: 12px;
}

/* Small number/text input (width-constrained) */
.wiz-input-sm {
    width: 60px;
    padding: 3px 6px;
    background: var(--wiz-bg-card);
    border: 1px solid var(--wiz-border);
    border-radius: var(--wiz-radius);
    color: var(--wiz-text);
    font-size: 11px;
    text-align: center;
}
