/*
 * scenario-modal.css — Run Scenario 6-Step Modal
 * Batch 28: Full-screen overlay, step pills, cloned calculator surfaces.
 * Zero hardcoded colors — CSS vars only.
 */

/* ============================================================
   OVERLAY
   ============================================================ */
.sm-overlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: rgba(0, 0, 0, 0.50);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: smOverlayIn 0.18s ease;
}

.sm-overlay.sm-open {
    display: flex;
}

@keyframes smOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   MODAL CARD
   ============================================================ */
.sm-card {
    width: 90vw;
    max-width: 1100px;
    height: 90vh;
    max-height: 90vh;
    background: var(--surface-dark);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.30);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: smCardIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes smCardIn {
    from { opacity: 0; transform: scale(0.96) translateY(16px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

/* ============================================================
   HEADER
   ============================================================ */
.sm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    background: var(--surface-dark);
}

.sm-title {
    font-family: 'Exo 2', var(--font-heading);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.sm-name-input {
    flex: 1;
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease;
    max-width: 280px;
}

.sm-name-input:focus {
    border-color: var(--glass-border-hover);
    background: var(--surface-dark);
}

.sm-name-input::placeholder {
    color: var(--text-dim);
}

.sm-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: var(--text-base);
    transition: color 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.sm-close-btn:hover {
    color: var(--text-primary);
    background: var(--glass-bg-hover);
}

/* ============================================================
   PROGRESS BAR — 6 step pills
   ============================================================ */
.sm-progress {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    background: var(--glass-bg);
    overflow-x: auto;
    scrollbar-width: none;
}

.sm-progress::-webkit-scrollbar { display: none; }

.sm-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.sm-step__num {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: 2px solid var(--glass-border);
    background: var(--surface-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--text-muted);
    transition: all 0.18s ease;
}

.sm-step__label {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: var(--weight-medium);
    color: var(--text-muted);
    letter-spacing: var(--tracking-wide);
    white-space: nowrap;
    transition: color 0.18s ease;
}

/* Active step — gold */
.sm-step--active .sm-step__num {
    background: var(--gold-500);
    border-color: var(--gold-500);
    color: var(--btn-primary-fg);
    box-shadow: var(--glow-gold-sm);
}

.sm-step--active .sm-step__label {
    color: var(--gold-600, var(--gold-500));
    font-weight: var(--weight-semibold);
}

/* Completed step — navy with checkmark */
.sm-step--done .sm-step__num {
    background: var(--text-cyan, #134160);
    border-color: var(--text-cyan, #134160);
    color: #ffffff;
}

.sm-step--done .sm-step__num::after {
    content: '✓';
    font-size: 12px;
}

.sm-step--done .sm-step__num .sm-step-num-text {
    display: none;
}

.sm-step--done .sm-step__label {
    color: var(--text-secondary);
}

/* Connector line */
.sm-step-connector {
    flex: 1;
    height: 2px;
    background: var(--glass-border);
    min-width: 24px;
    margin: 0 4px;
    margin-bottom: 14px; /* align with circle center */
    transition: background 0.18s ease;
}

.sm-step-connector--done {
    background: var(--text-cyan, #134160);
}

/* ============================================================
   STEP BODY — calculator surface area
   ============================================================ */
.sm-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.sm-step-panel {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.sm-step-panel--active {
    display: flex;
}

/* Step title inside body */
.sm-step-title {
    font-family: 'Exo 2', var(--font-heading);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-bottom: 12px;
    flex-shrink: 0;
}

/* Cloned calculator surface adjustments */
.sm-step-panel .lf-strategy-surface {
    display: flex !important;
    flex-direction: column;
}

.sm-step-panel .lf-surface-accent-bar {
    display: none; /* hide colored bar inside modal */
}

.sm-step-panel .glass-card {
    flex: 1;
}

/* Empty step placeholder */
.sm-step-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    padding: 48px;
    text-align: center;
}

.sm-step-placeholder i {
    font-size: 2.5rem;
    color: var(--text-dim);
    opacity: 0.22;
}

.sm-step-placeholder__name {
    font-family: var(--font-heading);
    font-size: var(--text-base);
    color: var(--text-muted);
}

.sm-step-placeholder__sub {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--text-dim);
}

/* ============================================================
   FOOTER
   ============================================================ */
.sm-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
    background: var(--surface-dark);
}

.sm-footer-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sm-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: none;
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.sm-btn-back:hover:not(:disabled) {
    border-color: var(--glass-border-hover);
    color: var(--text-primary);
    background: var(--glass-bg);
}

.sm-btn-back:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.sm-btn-next {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 22px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    cursor: pointer;
    transition: var(--btn-transition);
}

.sm-btn-next:hover {
    background: var(--btn-primary-bg-hover);
    box-shadow: var(--glow-gold-sm);
}

.sm-btn-save {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 22px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    cursor: pointer;
    transition: var(--btn-transition);
}

.sm-btn-save:hover {
    background: var(--btn-primary-bg-hover);
    box-shadow: var(--glow-gold-sm);
}

/* ============================================================
   COMPS TAB: subtab bar + panel show/hide
   ============================================================ */
.comps-subtab-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface-dark);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.comps-subtab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 16px;
    background: none;
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-wide);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.comps-subtab:hover {
    color: var(--text-secondary);
    border-color: var(--glass-border-hover);
    background: var(--glass-bg);
}

.comps-subtab--active {
    background: var(--gold-alpha-20);
    border-color: var(--gold-500);
    color: var(--gold-600, var(--gold-500));
    font-weight: var(--weight-semibold);
}

/* Comps panels */
.comps-panel {
    display: none;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.comps-panel--active {
    display: flex;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 768px) {
    .sm-overlay {
        padding: 0;
    }

    .sm-card {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .sm-progress {
        padding: 10px 12px;
    }

    .sm-step__label {
        font-size: 9px;
    }

    .sm-step-connector {
        min-width: 12px;
    }

    .comps-panel--active {
        flex-direction: column;
    }

    .comps-panel--active .comps-col-left,
    .comps-panel--active .comps-col-right {
        flex: unset;
        width: 100%;
    }

    .comps-panel--active .comps-col-left {
        max-height: 55vh;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
}
