/* ==========================================================================
   Ecosystem Help Sidebar
   Contextual slide-out help panel, reusable across all apps.
   ========================================================================== */

/* ── Trigger Button ──────────────────────────────────────── */
.eco-help-trigger {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
    background: var(--bg-card, #1a1a2e);
    color: var(--text-secondary, #a0a0b0);
    border: 1px solid var(--border, #2a2a3e);
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 10px 8px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.2s, color 0.2s, right 0.3s;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.3);
}
.eco-help-trigger:hover {
    background: var(--brand-primary, #f59e0b);
    color: #000;
}
.eco-help-trigger.open {
    right: 360px;
}
.eco-help-trigger-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* ── Overlay (mobile backdrop) ───────────────────────────── */
.eco-help-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.eco-help-overlay.open {
    display: block;
}

/* ── Sidebar Panel ───────────────────────────────────────── */
.eco-help-sidebar {
    position: fixed;
    top: 0;
    right: -380px;
    width: 360px;
    height: 100vh;
    z-index: 9999;
    background: var(--bg-card, #1a1a2e);
    border-left: 1px solid var(--border, #2a2a3e);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.eco-help-sidebar.open {
    right: 0;
}

/* ── Header ──────────────────────────────────────────────── */
.eco-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #2a2a3e);
    flex-shrink: 0;
}
.eco-help-header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
}
.eco-help-close {
    background: none;
    border: none;
    color: var(--text-secondary, #a0a0b0);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}
.eco-help-close:hover {
    color: var(--text-primary, #e0e0e0);
}

/* ── Body (scrollable) ───────────────────────────────────── */
.eco-help-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ── Content Sections ────────────────────────────────────── */
.eco-help-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border, #2a2a3e);
}
.eco-help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.eco-help-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 8px;
}
.eco-help-summary {
    font-size: 0.88rem;
    color: var(--text-secondary, #a0a0b0);
    line-height: 1.6;
}
.eco-help-section-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--brand-primary, #f59e0b);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Lists ───────────────────────────────────────────────── */
.eco-help-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.85rem;
    color: var(--text-secondary, #a0a0b0);
    line-height: 1.7;
}
.eco-help-list li {
    margin-bottom: 6px;
}
.eco-help-list li:last-child {
    margin-bottom: 0;
}

/* ── Examples ────────────────────────────────────────────── */
.eco-help-example {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border, #2a2a3e);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 0.83rem;
    line-height: 1.6;
}
.eco-help-example:last-child {
    margin-bottom: 0;
}
.eco-help-example-label {
    display: block;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.82rem;
    margin-bottom: 4px;
}
.eco-help-example p {
    color: var(--text-secondary, #a0a0b0);
    margin: 0;
}

/* ── Warnings ────────────────────────────────────────────── */
.eco-help-warnings .eco-help-list li {
    color: var(--warning, #f59e0b);
}

/* ── Tips ────────────────────────────────────────────────── */
.eco-help-tips .eco-help-list li {
    color: var(--success, #22c55e);
}

/* ── Empty State ─────────────────────────────────────────── */
.eco-help-empty {
    text-align: center;
    padding: 40px 20px;
}

/* ── Sticky Desktop Mode ────────────────────────────────── */
/* On desktop, sidebar is sticky: no overlay, content shifts left */
@media (min-width: 769px) {
    .eco-help-overlay {
        display: none !important;
    }
    body.eco-help-open {
        margin-right: 360px;
        transition: margin-right 0.3s ease;
    }
    /* Reflow stat grids to even layouts when sidebar reduces available width */
    body.eco-help-open .eco-stat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ── Responsive (mobile) ────────────────────────────────── */
@media (max-width: 768px) {
    .eco-help-sidebar {
        width: 100%;
        right: -100%;
    }
    .eco-help-trigger.open {
        right: 100%;
    }
    .eco-help-trigger {
        padding: 8px 6px;
        font-size: 0.9rem;
    }
}
