/* ==========================================================================
   Guided Device Setup Wizard Styles
   ========================================================================== */

#deviceWizardModal .modal-content {
    max-width: 820px;
    height: auto;
    min-height: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* ── Stepper Navigation Bar ─────────────────────────────────────────────── */
.wizard-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.75rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow-x: auto;
    gap: 0.5rem;
}

.wizard-step-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.wizard-step-item.active {
    opacity: 1;
}

.wizard-step-item.completed {
    opacity: 0.85;
    cursor: pointer;
}

.wizard-step-item.completed:hover {
    opacity: 1;
}

.wizard-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all var(--transition-base);
}

.wizard-step-item.active .wizard-step-num {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.wizard-step-item.completed .wizard-step-num {
    background: var(--accent-success);
    border-color: var(--accent-success);
    color: #ffffff;
}

.wizard-step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.wizard-step-item.active .wizard-step-label {
    color: var(--text-primary);
}

.wizard-step-divider {
    flex: 1;
    height: 2px;
    background: var(--border-color);
    min-width: 14px;
    margin: 0 0.25rem;
    opacity: 0.6;
}

/* ── Wizard Body ────────────────────────────────────────────────────────── */
.wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.wizard-step-panel {
    display: none;
    animation: fadeIn 0.2s ease-in-out;
}

.wizard-step-panel.active {
    display: block;
}

.wizard-section-header {
    margin-bottom: 1.25rem;
}

.wizard-section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.wizard-section-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* ── Choice Cards (Existing vs Create vs Skip) ─────────────────────────── */
.wizard-choice-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.wizard-choice-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
}

.wizard-choice-card:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.wizard-choice-card.selected {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .wizard-choice-card.selected,
body.light-theme .wizard-choice-card.selected {
    background: rgba(37, 99, 235, 0.08);
}

.wizard-choice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wizard-choice-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.wizard-choice-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.wizard-choice-card.selected .wizard-choice-radio {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
}

.wizard-choice-card.selected .wizard-choice-radio::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
}

.wizard-choice-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.wizard-choice-content {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 0.5rem;
}

/* ── Grid Layout for Inputs ────────────────────────────────────────────── */
.wizard-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.wizard-form-full {
    grid-column: 1 / -1;
}

/* ── Protocol Badge & Info ─────────────────────────────────────────────── */
.wizard-proto-info {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.wizard-proto-port {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-primary);
}

/* ── User Access Picker ────────────────────────────────────────────────── */
.wizard-users-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.wizard-users-quick {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.wizard-quick-btn {
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.wizard-quick-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.wizard-users-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.65rem;
    max-height: 240px;
    overflow-y: auto;
    padding: 0.25rem;
}

.wizard-user-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.wizard-user-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.wizard-user-item.selected {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

.wizard-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}

.wizard-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wizard-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Summary Cards ─────────────────────────────────────────────────────── */
.wizard-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.wizard-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.wizard-summary-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.wizard-summary-val {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    word-break: break-all;
}

.wizard-summary-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Success & Cheat Sheet ─────────────────────────────────────────────── */
.wizard-success-header {
    text-align: center;
    padding: 0.75rem 0 1.25rem;
}

.wizard-success-badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid var(--accent-success);
    color: var(--accent-success);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 0.75rem;
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wizard-cheatsheet {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wizard-cheatsheet-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.wizard-param-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.wizard-param-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.wizard-param-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.wizard-param-val {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.wizard-copy-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.wizard-copy-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.wizard-copy-btn.copied {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--accent-success);
    color: var(--accent-success);
}

.wizard-tip-box {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.wizard-tip-box code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: var(--bg-card);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    color: var(--accent-primary);
}

/* ── Wizard Footer ──────────────────────────────────────────────────────── */
.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.wizard-footer-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

/* ── Responsiveness ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    #deviceWizardModal .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .wizard-stepper {
        padding: 0.75rem 1rem;
    }

    .wizard-step-label {
        display: none;
    }

    .wizard-body {
        padding: 1.25rem 1rem;
    }

    .wizard-choice-cards {
        grid-template-columns: 1fr;
    }

    .wizard-footer {
        padding: 1rem;
    }
}
