/* ============================================================
   TradeJournal — Strategies ("Playbook") Stylesheet
   Card grid reuses the same visual language as an-insight-card
   (dashboard-charts.css / analytics.css). Add/Edit modal reuses
   .trade-modal / .at-modal chrome so it's pixel-consistent with
   the Add Trade modal. 100% Supabase design tokens, no new colors
   outside the official accent list in DESIGN-supabase.md.
   ============================================================ */

/* ── Card grid ──────────────────────────────────────────── */
.strat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--s-lg);
}

.strat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
    background: var(--canvas);
    border: 1px solid var(--hairline-cool);
    border-radius: var(--r-lg);
    padding: var(--s-xl);
    transition: border-color 160ms ease;
}

.strat-card:hover {
    border-color: var(--hairline-strong);
}

.strat-card:hover .strat-card__actions {
    opacity: 1;
}

.strat-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-md);
}

.strat-card__name-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.strat-color-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--r-full);
    flex: none;
}

.strat-card__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.strat-card__actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: none;
    opacity: 0;
    transition: opacity 120ms ease;
}

.strat-icon-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    color: var(--ink-mute);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.strat-icon-btn:hover {
    background: var(--canvas-soft);
    color: var(--ink);
}

.strat-icon-btn.is-danger:hover {
    background: var(--loss-tint);
    color: var(--loss-deep);
}

.strat-icon-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.strat-card__desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-mute);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 39px;
}

.strat-card__desc.is-empty {
    color: var(--ink-mute-2);
    font-style: italic;
}

/* ── Stat grid (4-up) ───────────────────────────────────── */
.strat-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-sm) var(--s-md);
    padding-top: var(--s-md);
    border-top: 1px solid var(--hairline-cool);
}

.strat-stat__label {
    display: block;
    font-size: 11px;
    color: var(--ink-mute-2);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.strat-stat__value {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.2px;
}

.strat-stat__value.is-positive {
    color: var(--primary-deep);
}

.strat-stat__value.is-negative {
    color: var(--loss-deep);
}

.strat-card__foot {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-mute-2);
}

.strat-card__foot svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Delete two-step confirm state ──────────────────────── */
.strat-icon-btn.is-confirm-delete {
    background: var(--loss-tint);
    color: var(--loss-deep);
    width: auto;
    padding: 0 10px;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
}

/* ── Empty state (no strategies yet) ────────────────────── */
.strat-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--s-xxl, 40px);
    color: var(--ink-mute);
    font-size: 13px;
    border: 1px dashed var(--hairline-cool);
    border-radius: var(--r-lg);
}

/* ============================================================
   ADD / EDIT STRATEGY MODAL
   ============================================================ */
.strat-form {
    display: flex;
    flex-direction: column;
    gap: var(--s-lg);
}

/* ── Color picker (official accent swatches only) ───────── */
.strat-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.strat-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: var(--r-full);
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    position: relative;
    transition: transform 120ms ease, border-color 120ms ease;
}

.strat-color-swatch:hover {
    transform: scale(1.08);
}

.strat-color-swatch.is-active {
    border-color: var(--ink);
}

.strat-color-swatch.is-active::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 8px;
    height: 8px;
    border-radius: var(--r-full);
    background: var(--canvas);
}

/* ── Rules / checklist ──────────────────────────────────── */
.strat-rules-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.strat-rule-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--canvas-soft);
    border-radius: var(--r-sm);
}

.strat-rule-row__icon {
    flex: none;
    width: 15px;
    height: 15px;
    color: var(--primary-deep);
}

.strat-rule-row__icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.strat-rule-row__text {
    flex: 1;
    font-size: 13px;
    color: var(--ink);
    min-width: 0;
    word-break: break-word;
}

.strat-rule-row__remove {
    flex: none;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--r-full);
    color: var(--ink-mute-2);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.strat-rule-row__remove:hover {
    background: var(--loss-tint);
    color: var(--loss-deep);
}

.strat-rule-row__remove svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.strat-rule-input-row {
    display: flex;
    gap: 8px;
}

.strat-rule-input-row .at-input {
    flex: 1;
}

.strat-rules-empty {
    font-size: 12.5px;
    color: var(--ink-mute-2);
    font-style: italic;
    padding: 2px 2px 4px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .strat-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 640px) {
    .strat-grid {
        grid-template-columns: 1fr;
    }

    .strat-rule-input-row {
        flex-direction: column;
    }
}