/**
 * equity-curve.css — EquityCurve Panel Styling
 *
 * Theme: Glass-box treatment with gold/red accents.
 * Responsive: Gracefully degradates when container narrows.
 * All classes prefixed `ec-` for namespace safety.
 */

/* ========================================================================
   CONTAINER & LAYOUT
   ======================================================================== */

#equityCurve {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    backdrop-filter: blur(14px) saturate(160%);
    box-shadow: var(--glass-underglow);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-primary);
    overflow: hidden;
    padding: 12px;
}

/* ========================================================================
   TITLE BAR: Title + Range Selector
   ======================================================================== */

.ec-title-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    flex-shrink: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
}

.ec-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-primary);
}

/* ========================================================================
   RANGE SELECTOR
   ======================================================================== */

.ec-range-selector {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.ec-range-btn {
    padding: 4px 10px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 150ms ease;
    font-family: 'JetBrains Mono', monospace;
}

.ec-range-btn:hover {
    border-color: rgba(255, 215, 0, 0.4);
    color: var(--ml-color);
    background: rgba(255, 215, 0, 0.12);
}

.ec-range-btn.active {
    background: rgba(255, 215, 0, 0.25);
    border-color: var(--ml-color);
    color: var(--ml-color);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

/* ========================================================================
   SVG CONTAINER & CHART
   ======================================================================== */

.ec-svg-container {
    flex: 1;
    min-height: 200px;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.ec-svg {
    width: 100%;
    height: 100%;
}

/* ========================================================================
   TRADE MARKERS
   ======================================================================== */

.ec-marker {
    cursor: pointer;
    transition: opacity 150ms ease, filter 150ms ease;
    vector-effect: non-scaling-stroke;
}

.ec-marker:hover {
    opacity: 0.85;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6));
}

/* ========================================================================
   TOOLTIP
   ======================================================================== */

.ec-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 10px;
    font-weight: 500;
    color: var(--ml-color);
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8),
                0 0 8px rgba(255, 215, 0, 0.15) inset;
    font-family: 'JetBrains Mono', monospace;
}

.ec-tooltip.hidden {
    display: none;
}

/* ========================================================================
   STATS ROW
   ======================================================================== */

.ec-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.ec-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0; /* Allow text overflow handling */
}

.ec-stat-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ec-stat-value {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ec-stat-value.profit {
    color: var(--profit-color);
}

.ec-stat-value.loss {
    color: var(--loss-color);
}

/* ========================================================================
   EMPTY STATE
   ======================================================================== */

.ec-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 400;
    animation: ec-pulse 2s ease-in-out infinite;
}

@keyframes ec-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* ========================================================================
   RESPONSIVE DEGRADATION (for narrow containers)
   ======================================================================== */

@media (max-width: 400px) {
    .ec-title-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ec-range-selector {
        width: 100%;
        justify-content: flex-start;
    }

    .ec-range-btn {
        font-size: 8px;
        padding: 3px 8px;
    }

    .ec-svg-container {
        min-height: 120px;
    }

    .ec-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .ec-stat-label {
        font-size: 8px;
    }

    .ec-stat-value {
        font-size: 11px;
    }
}

@media (max-width: 300px) {
    .ec-stats {
        grid-template-columns: 1fr;
    }

    .ec-range-selector {
        gap: 4px;
    }

    .ec-range-btn {
        padding: 2px 6px;
        font-size: 7px;
    }
}
