/* ============================================================
   OPIFY Options Backtester: first-run UX (quickstart.js)
   Quick start banner, card "Backtest This" button, run bar,
   first-visit steps. Styles only for the new elements.
   ============================================================ */

.opify-quickstart[hidden],
.opify-run-bar[hidden],
.opify-steps[hidden] {
    display: none !important;
}

/* ---------- quick start banner (strategy list page) ---------- */

.opify-quickstart {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 18px;
    padding: 16px 20px;
    border-radius: 14px;
    border: 1px solid rgba(16, 185, 129, 0.35);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(16, 185, 129, 0.18), transparent 60%),
        linear-gradient(90deg, rgba(19, 28, 46, 0.95), rgba(15, 23, 42, 0.95));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.opify-quickstart-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.opify-quickstart-title {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.opify-quickstart-sub {
    color: #94a3b8;
    font-size: 12.5px;
    line-height: 1.45;
}

.opify-quickstart-btn,
.opify-run-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(90deg, #10b981, #0d9488);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(16, 185, 129, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.opify-quickstart-btn:hover,
.opify-run-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.opify-quickstart-btn i,
.opify-run-btn i {
    font-size: 11px;
}

/* ---------- template card button ---------- */

.css-fvddflkfopfo.opify-card-run-btn {
    background: linear-gradient(90deg, #10b981, #0d9488) !important;
    border-color: transparent !important;
    color: #fff !important;
    font-weight: 700;
}

.css-fvddflkfopfo.opify-card-run-btn i {
    color: #fff !important;
}

/* ---------- first-visit steps (editor) ---------- */

.opify-steps {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    margin-bottom: 16px;
    padding: 12px 44px 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.08);
}

.opify-steps-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.opify-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #e2e8f0;
    font-size: 12.5px;
    font-weight: 600;
}

.opify-step b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
}

.opify-step-arrow {
    color: #64748b;
    font-size: 10px;
}

.opify-steps-note {
    color: #94a3b8;
    font-size: 12px;
}

.opify-steps-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.opify-steps-close:hover {
    background: rgba(148, 163, 184, 0.15);
    color: #fff;
}

/* ---------- run bar (editor, under the legs) ---------- */

.opify-run-bar {
    position: sticky;
    bottom: 8px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 20px;
    padding: 12px 14px 12px 18px;
    border-radius: 16px;
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: rgba(15, 23, 42, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.opify-run-summary {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.opify-run-summary-text {
    color: #e2e8f0;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.opify-run-ready {
    color: #34d399;
    font-size: 11.5px;
    font-weight: 600;
}

.opify-run-ready.warn {
    color: #fbbf24;
}

.opify-run-btn {
    padding: 13px 26px;
    font-size: 15px;
}

.opify-run-btn:disabled,
.opify-run-btn.busy {
    opacity: 0.7;
    cursor: wait;
    transform: none;
    animation: none !important;
}

.opify-run-btn.pulse {
    animation: opifyRunPulse 1.8s ease-out infinite;
}

@keyframes opifyRunPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55), 0 8px 22px rgba(16, 185, 129, 0.35); }
    70% { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0), 0 8px 22px rgba(16, 185, 129, 0.35); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0), 0 8px 22px rgba(16, 185, 129, 0.35); }
}

@media (prefers-reduced-motion: reduce) {
    .opify-run-btn.pulse {
        animation: none;
    }
}

/* ---------- light editor theme ---------- */

.strategy-light .opify-run-bar {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
}

.strategy-light .opify-run-summary-text,
.strategy-light .opify-step {
    color: #0f172a;
}

.strategy-light .opify-steps {
    background: rgba(59, 130, 246, 0.08);
}

.strategy-light .opify-run-ready {
    color: #059669;
}

.strategy-light .opify-run-ready.warn {
    color: #b45309;
}

/* ---------- mobile ---------- */

@media (max-width: 767px) {
    .opify-quickstart {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin: 4px 0 14px;
        padding: 14px;
    }

    .opify-quickstart-title {
        font-size: 15px;
    }

    .opify-quickstart-btn {
        width: 100%;
        padding: 13px 16px;
        font-size: 15px;
    }

    .opify-steps {
        padding: 10px 40px 10px 12px;
    }

    .opify-step-arrow {
        display: none;
    }

    .opify-run-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        bottom: 6px;
        padding: 10px;
        margin: 0 0 12px;
    }

    .opify-run-btn {
        width: 100%;
        padding: 14px 16px;
        font-size: 16px;
    }
}

/* ---------- auto-run loader (covers the editor while an auto-run is going) ---------- */

.opify-run-loader {
    position: absolute;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(5, 9, 18, 0.72);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.opify-run-loader[hidden] {
    display: none !important;
}

.opify-run-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 380px;
    width: 100%;
    padding: 26px 22px;
    border-radius: 18px;
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: #131c2e;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    text-align: center;
}

.opify-run-loader-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid rgba(16, 185, 129, 0.2);
    border-top-color: #10b981;
    animation: opifyRunSpin 0.8s linear infinite;
}

.opify-run-loader-title {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

.opify-run-loader-sub {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

@keyframes opifyRunSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .opify-run-loader-spinner {
        animation-duration: 2s;
    }
}

.strategy-light .opify-run-loader {
    background: rgba(241, 245, 249, 0.75);
}

.strategy-light .opify-run-loader-card {
    background: #fff;
}

.strategy-light .opify-run-loader-title {
    color: #0f172a;
}
