/* ═══════════════════════════════════════════════════════════════════
   Shared Strategy Modal Styles
   Used by both Dashboard strategy modal and Marketplace preview modal.
   All classes are prefixed `.sm-` (strategy modal).
   ═══════════════════════════════════════════════════════════════════ */

.sm-panel {
    padding: 0;
    width: 90vw;
    max-width: 980px;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: var(--s-radius-lg, 12px);
}

/* ── Hero header (avatar + title + meta + description) ────────── */
.sm-hero {
    display: flex;
    gap: 16px;
    padding: 22px 26px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    align-items: flex-start;
}

.sm-hero-img {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.6rem;
}
.sm-hero-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sm-hero-info {
    flex: 1;
    min-width: 0;
}
.sm-hero-title {
    margin: 0 0 6px;
    font-size: 1.28rem;
    font-weight: 600;
    color: var(--s-text);
    line-height: 1.2;
}
.sm-hero-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--s-text-muted);
}
.sm-hero-meta .risk-badge,
.sm-hero-meta .sm-pill {
    margin-left: 2px;
}
.sm-hero-desc {
    margin-top: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--s-text);
    white-space: pre-wrap;
}

/* ── Body (scrollable) ────────────────────────────────────────── */
.sm-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 26px 10px;
}

/* ── Section wrapper ──────────────────────────────────────────── */
.sm-section {
    padding: 18px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.sm-section:last-child {
    border-bottom: none;
}

.sm-section-title {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--s-text-muted);
    font-weight: 700;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sm-section-subtitle {
    font-weight: 400;
    font-size: 0.74rem;
    color: var(--s-text-muted);
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.8;
}
.sm-section-count {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    letter-spacing: 0;
    font-weight: 600;
    color: var(--s-text);
}

/* ── Performance stats grid ───────────────────────────────────── */
.sm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}
.sm-stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 11px 13px;
}
.sm-stat-lbl {
    font-size: 0.68rem;
    color: var(--s-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.sm-stat-val {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--s-text);
    margin-top: 4px;
    line-height: 1.25;
}

/* ── Configuration ────────────────────────────────────────────── */
.sm-config {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sm-config-row {
    display: flex;
    gap: 14px;
    font-size: 0.85rem;
    padding: 8px 0;
    align-items: center;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
}
.sm-config-row:last-child {
    border-bottom: none;
}
.sm-config-lbl {
    color: var(--s-text-muted);
    min-width: 150px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.sm-config-val {
    color: var(--s-text);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
}
.sm-muted {
    color: var(--s-text-muted);
}

/* ── Badge chips (networks, venues, currency) ─────────────────── */
.sm-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--s-text);
    text-transform: capitalize;
    line-height: 1.1;
}
.sm-chip img,
.sm-chip .sm-chip-logo {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
}
.sm-chip-letter {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.sm-chip-venue {
    background: rgba(67, 233, 89, 0.08);
    border-color: rgba(67, 233, 89, 0.22);
    color: var(--s-green, #43E959);
}
.sm-chip-currency {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}
.sm-chip-auto {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
}
.sm-config-venue-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sm-config-venue-group .sm-muted {
    font-size: 0.76rem;
}

/* ── Chart range buttons (shared, green active) ──────────────── */
.sm-chart-controls {
    display: flex;
    gap: 6px;
    margin: 4px 0 10px;
    flex-wrap: wrap;
}
.sm-chart-tab {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--s-text-muted);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.74rem;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sm-chart-tab:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--s-text);
}
.sm-chart-tab.active {
    background: rgba(67, 233, 89, 0.16);
    color: var(--s-green, #43E959);
    border-color: rgba(67, 233, 89, 0.4);
}

.sm-chart {
    width: 100%;
    height: 260px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

/* ── Orders / Signals view toggle tabs ────────────────────────── */
.sm-orders-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    width: fit-content;
}
.sm-orders-tab {
    background: transparent;
    border: none;
    color: var(--s-text-muted);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease;
}
.sm-orders-tab:hover {
    color: var(--s-text);
}
.sm-orders-tab.active {
    background: rgba(67, 233, 89, 0.16);
    color: var(--s-green, #43E959);
}

.sm-orders-host {
    max-height: 420px;
    overflow-y: auto;
}
.sm-orders-empty {
    opacity: 0.5;
    text-align: center;
    padding: 22px 0;
    font-size: 0.85rem;
}

.sm-cohort-subtitle {
    font-size: 0.72rem;
    color: var(--s-text-muted);
    font-style: italic;
    margin-top: -6px;
    margin-bottom: 8px;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 400;
}

/* ── Footer (only marketplace uses) ────────────────────────────── */
.sm-footer {
    padding: 14px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
}

/* ─────────────────────────────────────────────────────────────────
   Cursor-following tooltip (used on strategy cards in both pages).
   Trigger element needs:  class="sm-tip" + data-tip="<text>"
   A single <div id="sm-tooltip"> is appended to <body> and positioned
   on mousemove by strategy-modal.js — see attachSmTooltip().
   ───────────────────────────────────────────────────────────────── */
#sm-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: rgba(15, 18, 25, 0.97);
    color: var(--s-text, #fff);
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translate(0, 4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}
#sm-tooltip.visible {
    opacity: 1;
    transform: translate(0, 0);
}
#sm-tooltip.sm-tip-positive { color: #43E959; }
#sm-tooltip.sm-tip-negative { color: #ef4444; }

/* ─────────────────────────────────────────────────────────────────
   Compact orders table reused inside the modal. Uses .sm-orders-table
   so it doesn't fight with the main page's data-table styling.
   ───────────────────────────────────────────────────────────────── */
.sm-orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.sm-orders-table th {
    text-align: left;
    font-weight: 600;
    color: var(--s-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.68rem;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    background: var(--s-bg, #0b0e14);
    z-index: 1;
}
.sm-orders-table th.num,
.sm-orders-table td.num {
    text-align: right;
}
.sm-orders-table td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--s-text);
    vertical-align: middle;
}
.sm-orders-table tr:last-child td {
    border-bottom: none;
}
.sm-orders-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.sm-filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0 0 10px;
    flex-wrap: wrap;
}
.sm-filter-bar .search-input {
    flex: 1;
    min-width: 140px;
    max-width: 260px;
    padding: 6px 10px;
    font-size: 0.8rem;
    border: 1px solid var(--s-border, rgba(255, 255, 255, 0.08));
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--s-text);
}

.sm-pill {
    font-size: 0.7rem;
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--s-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}
.sm-pill:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--s-text);
}
.sm-pill.active {
    background: var(--s-green, #43E959);
    color: #000;
    border-color: var(--s-green, #43E959);
}

/* ── Advanced section list rows (triggers / conditional orders) ── */
.sm-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sm-list-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--s-text, rgba(255, 255, 255, 0.92));
}
.sm-list-row-title {
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--s-text, rgba(255, 255, 255, 0.92));
    line-height: 1.3;
}
.sm-list-row-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.sm-list-row-meta .sm-chip {
    font-size: 0.72rem;
    padding: 2px 9px;
}

@media (max-width: 700px) {
    .sm-stats { grid-template-columns: repeat(2, 1fr); }
    .sm-hero { flex-direction: column; }
    .sm-config-row { flex-direction: column; gap: 4px; align-items: flex-start; }
    .sm-config-lbl { min-width: 0; }
    .sm-body { padding: 4px 16px 10px; }
    .sm-hero { padding: 16px 18px 14px; }
}
