/* ════════════════════════════════════════════════════════════════
   Strategies Selection Page Styles
   ════════════════════════════════════════════════════════════════ */

.strategies-page {
    background: #f8f9fa;
    overflow-x: hidden;
}

/* ─── Strategy Cards ─── */
.strategy-card {
    position: relative;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.strategy-enabled-label {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1;
}

.strategy-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
    transform: translateY(-2px);
}

.strategy-card.selected {
    border-color: #0d6efd;
    background: #e8f0fe;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
}

.strategy-card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.strategy-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.strategy-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.5rem;
}

.strategy-description {
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.strategy-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.strategy-meta .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
}

/* ─── Configuration Section Styles ─── */
.algo-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #f0f0f0;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    color: #666;
    flex-shrink: 0;
}

.algo-hero-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.algo-tag {
    display: inline-block;
    background: #e8f0fe;
    color: #1a73e8;
    border-radius: 20px;
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ─── Hero Meta Row (Capital pills + buttons) ─── */
.hero-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    margin-top: 0.75rem;
}

.capital-pill {
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    min-width: 110px;
}

.capital-pill-label {
    font-size: 0.72rem;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.capital-pill-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #212529;
}

.btn-deploy-hero {
    background: #6f42c1;
    color: #fff;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
    cursor: pointer;
}

.btn-deploy-hero:hover {
    background: #5a32a3;
    color: #fff;
}

.btn-deploy-hero.is-deployed {
    background: #28a745;
}

.btn-save-hero {
    background: transparent;
    color: #0d6efd;
    border: 1.5px solid #0d6efd;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-save-hero:hover {
    background: #0d6efd;
    color: #fff;
}

.capital-context {
    font-size: 0.78rem;
    color: #6c757d;
    font-weight: 500;
}

/* ─── Strategy detail submenu ─── */
.sc-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
    overflow-x: auto;
    border-bottom: 1px solid #dee2e6;
}

.sc-tab {
    flex: 0 0 auto;
    padding: 0.55rem 1rem;
    border: 1px solid #dee2e6;
    border-bottom: 0;
    border-radius: 0.45rem 0.45rem 0 0;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
}

.sc-tab.active {
    background: #fff;
    color: #0d6efd;
    border-color: #0d6efd;
    font-weight: 600;
}

.sc-panel {
    display: none;
}

.sc-panel.active {
    display: block;
}

.trades-calendar {
    overflow-x: auto;
}

.trades-pnl-chart {
    height: 190px;
    margin: 0.5rem 0 1rem;
}

.trades-pnl-chart svg {
    display: block;
    width: 100%;
    height: 100%;
}

.trades-pnl-chart .pnl-chart-baseline {
    stroke: #dfe5ec;
    stroke-width: 1;
}

.trades-pnl-chart .pnl-chart-line {
    fill: none;
    stroke: #55a630;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.trades-pnl-chart .pnl-chart-area {
    fill: rgba(85, 166, 48, 0.12);
}

.trades-calendar-grid {
    min-width: 700px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
}

.trades-calendar-weekday {
    padding: 0.5rem;
    color: #64748b;
    font-size: 0.8rem;
    text-align: center;
}

.trades-calendar-day {
    min-height: 76px;
    padding: 0.5rem;
    border: 1px solid #edf0f4;
    background: #fafafa;
    color: #64748b;
}

.trades-calendar-day.has-trades {
    background: #f0f8e8;
    border-color: #8bc34a;
    color: #256d16;
    cursor: pointer;
}

.trades-calendar-day.has-trades:hover,
.trades-calendar-day.selected {
    background: #e2f2d4;
    border-color: #55a630;
}

.trades-calendar-day-number {
    font-size: 0.8rem;
}

.trades-calendar-day-pnl {
    margin-top: 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.trades-calendar-day-pnl.negative {
    color: #dc3545;
}

.trades-calendar-day-pnl.positive {
    color: #198754;
}

/* ─── Performance Charts ─── */
.perf-period-btns {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.perf-period-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 20px;
    padding: 0.3rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    color: #444;
    transition: all 0.15s;
}

.perf-period-btn.active {
    background: #0d6efd;
    color: #fff;
}

.perf-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.perf-stat {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    min-width: 110px;
    flex: 1;
}

.perf-stat-label {
    font-size: 0.72rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
}

.perf-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 220px;
}

canvas.sc-chart {
    width: 100% !important;
    height: 220px !important;
}

/* ─── Best & Worst ─── */
.bw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .bw-grid {
        grid-template-columns: 1fr;
    }
}

.bw-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.bw-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.bw-trade-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid #e9ecef;
}

.bw-trade-row:last-child {
    border-bottom: none;
}

.bw-symbol {
    font-weight: 600;
    font-size: 0.88rem;
}

.bw-date {
    font-size: 0.75rem;
    color: #888;
}

.bw-pnl {
    font-weight: 700;
    font-size: 0.95rem;
}

.bw-duration {
    font-size: 0.75rem;
    color: #666;
}

/* ─── Calendar ─── */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.cal-nav-btn {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    font-weight: 600;
}

.cal-nav-btn:hover {
    background: #f0f0f0;
}

.cal-month-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.cal-hdr {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #888;
    padding: 0.3rem 0;
}

.cal-cell {
    min-height: 64px;
    border-radius: 6px;
    padding: 0.3rem 0.35rem;
    background: #fafafa;
    border: 1px solid #efefef;
    font-size: 0.75rem;
    position: relative;
}

.cal-cell.other-month {
    opacity: 0.35;
}

.cal-cell.today {
    border-color: #0d6efd;
    background: #e8f0fe;
}

.cal-cell.has-trade {
    background: #fff;
}

.cal-day-num {
    font-weight: 700;
    color: #555;
    font-size: 0.78rem;
}

.cal-pnl {
    font-size: 0.78rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.cal-trades-count {
    font-size: 0.7rem;
    color: #888;
}

.cal-pnl.profit {
    color: #28a745;
}

.cal-pnl.loss {
    color: #dc3545;
}

/* ─── About Algo ─── */
.about-section {
    margin-bottom: 1.5rem;
}

.about-section h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
}

.about-tag {
    display: inline-block;
    background: #e8f0fe;
    color: #1a73e8;
    border-radius: 20px;
    padding: 0.2rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    margin-right: 0.4rem;
    margin-bottom: 0.4rem;
}

.logic-step {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.6rem;
}

.logic-step-num {
    background: #0d6efd;
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.logic-step-text {
    font-size: 0.88rem;
    color: #444;
    line-height: 1.5;
}

.config-row-active td {
    background: #eef5ff !important;
}

/* ─── Responsive Adjustments ─── */
@media (max-width: 768px) {
    .hero-meta-row {
        flex-direction: column;
        gap: 1rem;
    }

    .capital-pill {
        width: 100%;
    }

    .btn-deploy-hero,
    .btn-save-hero {
        width: 100%;
    }

}
