/* ═══════════════════════════════════════════════════════════════════
 * Tab Redesign CSS
 * - Collapsible sections
 * - Sub-tabs for Analysis tab
 * - Quick Actions Bar
 * - Levels grouping
 * - Smart Suggest enhancements
 * ═══════════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════════
 * 1) COLLAPSIBLE SECTIONS
 * ═══════════════════════════════════════════════════════════════════ */

.collapsible-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.collapsible-section {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.collapsible-section:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.collapsible-section.open {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(15, 23, 42, 0.6);
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(168, 85, 247, 0.03));
}

.collapsible-header:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.05));
}

.collapsible-section.open .collapsible-header {
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.collapsible-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #c4b5fd;
}

.collapsible-chevron {
    color: #a78bfa;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.collapsible-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 14px;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.2s ease;
}

.collapsible-section.open .collapsible-body {
    max-height: 5000px; /* large enough for any content */
    opacity: 1;
    padding: 14px;
}


/* ═══════════════════════════════════════════════════════════════════
 * 2) ANALYSIS SUB-TABS
 * ═══════════════════════════════════════════════════════════════════ */

.analysis-subtabs {
    display: flex;
    gap: 6px;
    margin: 12px 0;
    padding: 4px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    overflow-x: auto;
    scrollbar-width: thin;
    /* 🆕 Span full width inside the analysis-grid (which is 2-column) */
    grid-column: 1 / -1;
}

.analysis-subtab-btn {
    flex: 1;
    min-width: max-content;
    padding: 8px 14px;
    background: transparent;
    color: rgba(203, 213, 225, 0.7);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.analysis-subtab-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #c4b5fd;
}

.analysis-subtab-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.analysis-subtab-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* 🆕 Span full grid width */
    grid-column: 1 / -1;
}


/* 🆕 Liquidity sub-tab: 3 columns side-by-side (Liquidity / OB / Confluence) */
.analysis-subtab-body.liquidity-subtab {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    align-items: start;
}

.analysis-subtab-body.liquidity-subtab .analysis-section {
    margin: 0;
}


/* 🆕 Basics sub-tab: top row has 2 columns (Info + Structure), RSI below full-width */
.basics-row-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
}

.basics-row-top .analysis-section {
    margin: 0;
}


/* 🆕 Levels grid: 5 columns of level groups */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 4px;
}

.levels-grid .levels-group {
    margin-bottom: 0;
}


/* ─── Mobile: stack everything to single column ─── */
@media (max-width: 1100px) {
    .levels-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .analysis-subtab-body.liquidity-subtab {
        grid-template-columns: 1fr;
    }
    .levels-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .basics-row-top {
        grid-template-columns: 1fr;
    }
}

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


/* ═══════════════════════════════════════════════════════════════════
 * 3) QUICK ACTIONS BAR
 * ═══════════════════════════════════════════════════════════════════ */

.quick-actions-bar {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.6), rgba(30, 41, 59, 0.4));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
    /* 🆕 Span full width when inside analysis-grid (2-col layout) */
    grid-column: 1 / -1;
}

.qa-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(15, 23, 42, 0.5);
    color: rgba(203, 213, 225, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.qa-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c4b5fd;
    transform: translateY(-1px);
}

.qa-btn span:first-child {
    font-size: 1rem;
    line-height: 1;
}


/* ═══════════════════════════════════════════════════════════════════
 * 4) LEVELS GROUPING
 * ═══════════════════════════════════════════════════════════════════ */

.levels-group {
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 8px;
}

.levels-group:last-child {
    margin-bottom: 0;
}

.levels-group-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #a78bfa;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}


/* ═══════════════════════════════════════════════════════════════════
 * 5) SMART SUGGEST ENHANCEMENTS
 * ═══════════════════════════════════════════════════════════════════ */

.ss-summary-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    margin: 0 0 16px 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.06));
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 10px;
}

.ss-summary-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.ss-summary-content {
    flex: 1;
    min-width: 0;
}

.ss-summary-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #c4b5fd;
    margin-bottom: 6px;
}

.ss-summary-text {
    font-size: 0.85rem;
    color: rgba(226, 232, 240, 0.95);
    line-height: 1.6;
}

.ss-summary-text strong {
    color: #fbbf24;
    font-weight: 700;
}

.ss-summary-text > div {
    margin-bottom: 3px;
}

.ss-summary-text > div:last-child {
    margin-bottom: 0;
}

.ss-quality-stars {
    margin-right: 6px;
    font-size: 0.7rem;
    letter-spacing: 1px;
    opacity: 0.85;
}


/* ═══════════════════════════════════════════════════════════════════
 * 6) NARRATOR PLANS SECTION (highlight - it's the most important)
 * ═══════════════════════════════════════════════════════════════════ */

.narrator-plans-section {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(99, 102, 241, 0.03));
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 10px;
    padding: 12px;
}

.narrator-plans-section h3 {
    color: #10b981;
}


/* ═══════════════════════════════════════════════════════════════════
 * 7) MOBILE RESPONSIVE
 * ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .quick-actions-bar {
        padding: 8px;
        gap: 6px;
    }
    
    .qa-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .qa-btn span:first-child {
        font-size: 0.9rem;
    }
    
    .analysis-subtabs {
        padding: 3px;
    }
    
    .analysis-subtab-btn {
        padding: 7px 10px;
        font-size: 0.78rem;
    }
    
    .collapsible-header {
        padding: 9px 12px;
    }
    
    .collapsible-title {
        font-size: 0.88rem;
    }
    
    .collapsible-section.open .collapsible-body {
        padding: 12px;
    }
    
    .ss-summary-banner {
        padding: 10px;
    }
    
    .ss-summary-icon {
        font-size: 1.25rem;
    }
    
    .ss-summary-title {
        font-size: 0.85rem;
    }
    
    .ss-summary-text {
        font-size: 0.78rem;
    }
}
