/* ============================================
 * ETF ANALYSIS PAGE - Section 7
 * File: css/components/etf-analysis.css
 * ============================================ */

/* ── Overview Grid ── */
.etf-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* ── ETF Card ── */
.etf-card {
    background: var(--card-bg, #1e293b);
    border-radius: 12px;
    padding: 18px;
    border-left: 4px solid var(--etf-accent, #3b82f6);
    position: relative;
    transition: box-shadow 0.2s, transform 0.15s;
}

.etf-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.etf-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.etf-card-symbol {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    letter-spacing: 0.5px;
}

.etf-card-name {
    font-size: 0.78rem;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 10px;
}

.etf-card-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 2px;
}

.etf-card-change {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.etf-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.etf-tag {
    display: inline-block;
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
}

.etf-tag.bullish { color: #22c55e; background: rgba(34, 197, 94, 0.12); }
.etf-tag.bearish { color: #ef4444; background: rgba(239, 68, 68, 0.12); }
.etf-tag.neutral { color: #f59e0b; background: rgba(245, 158, 11, 0.12); }

/* ── Score Badge ── */
.etf-score-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.etf-score-badge.score-high { background: linear-gradient(135deg, #22c55e, #16a34a); }
.etf-score-badge.score-mid  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.etf-score-badge.score-low  { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ── Best Pick Badge ── */
.etf-best-badge {
    position: absolute;
    top: -6px;
    right: 12px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

/* ── Recommendation Block ── */
.etf-recommendation {
    background: var(--card-bg, #1e293b);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border-left: 4px solid var(--etf-accent, #3b82f6);
}

.etf-rec-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.etf-rec-top-pick {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

.etf-rec-top-signal {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.etf-rec-top-reason {
    font-size: 0.82rem;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 6px;
    line-height: 1.5;
}

.etf-rec-top-entry {
    font-size: 0.8rem;
    color: var(--text-secondary, #cbd5e1);
}

/* ── Signals Grid ── */
.etf-signals-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.etf-signal-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    border-top: 3px solid var(--etf-accent, #64748b);
}

.etf-signal-symbol {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 4px;
}

.etf-signal-label {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.etf-signal-label.buy  { color: #22c55e; }
.etf-signal-label.hold { color: #f59e0b; }
.etf-signal-label.avoid { color: #ef4444; }

.etf-signal-alloc {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
}

/* ── Allocation Bar ── */
.etf-alloc-summary {
    margin-top: 14px;
}

.etf-alloc-summary-text {
    font-size: 0.82rem;
    color: var(--text-secondary, #cbd5e1);
    margin-bottom: 8px;
}

.etf-alloc-bar {
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    background: rgba(255, 255, 255, 0.06);
}

.etf-alloc-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    min-width: 40px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.etf-alloc-segment:hover {
    opacity: 0.85;
}

.etf-alloc-segment.empty {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted, #94a3b8);
    cursor: default;
}

/* ── Comparison Table ── */
.etf-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-bottom: 24px;
}

.etf-comparison-table th {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #94a3b8);
    font-weight: 600;
    padding: 10px 12px;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.etf-comparison-table th:first-child {
    text-align: left;
}

.etf-comparison-table td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary, #e2e8f0);
}

.etf-comparison-table td:first-child {
    text-align: left;
    font-weight: 600;
}

.etf-comparison-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.etf-best-cell {
    color: #22c55e !important;
    font-weight: 700 !important;
}

.etf-comparison-wrapper {
    background: var(--card-bg, #1e293b);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.etf-comparison-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 14px;
}

/* ── Chart Block ── */
.etf-chart-block {
    background: var(--card-bg, #1e293b);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.etf-chart-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 14px;
}

.etf-chart-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.etf-chart-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.etf-chart-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

.etf-chart-tab.active {
    background: var(--etf-accent, #3b82f6);
    color: #fff;
}

.etf-chart-container {
    width: 100%;
    height: 400px;
    position: relative;
}

/* ── Technical Dashboard (Accordion) ── */
.etf-tech-accordion {
    margin-bottom: 24px;
}

.etf-tech-item {
    background: var(--card-bg, #1e293b);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
}

.etf-tech-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.etf-tech-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.etf-tech-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.etf-tech-header-symbol {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary, #e2e8f0);
}

.etf-tech-header-name {
    font-size: 0.78rem;
    color: var(--text-muted, #94a3b8);
}

.etf-tech-arrow {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    transition: transform 0.2s;
}

.etf-tech-item.open .etf-tech-arrow {
    transform: rotate(180deg);
}

.etf-tech-body {
    display: none;
    padding: 0 18px 18px;
}

.etf-tech-item.open .etf-tech-body {
    display: block;
}

/* Technical grids inside accordion */
.etf-tech-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.etf-gauge-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.etf-gauge-label {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.etf-gauge-value {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.etf-gauge-zone {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    display: inline-block;
}

/* MA Position bars */
.etf-ma-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.etf-ma-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.etf-ma-bar-label {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.etf-ma-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.etf-ma-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.etf-ma-bar-val {
    font-size: 0.72rem;
    color: var(--text-secondary, #cbd5e1);
    width: 55px;
    flex-shrink: 0;
}

/* Support / Resistance compact table */
.etf-sr-table {
    width: 100%;
    font-size: 0.78rem;
    border-collapse: collapse;
}

.etf-sr-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.etf-sr-table td:first-child {
    color: var(--text-muted, #94a3b8);
    width: 40%;
}

/* Volume ratio bar */
.etf-vol-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.etf-vol-bar-track {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.etf-vol-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: #3b82f6;
    transition: width 0.3s;
}

.etf-vol-bar-val {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    min-width: 40px;
}

/* Setup tags chips */
.etf-setup-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.etf-setup-chip {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* ── Correlation Table ── */
.etf-correlation-wrapper {
    background: var(--card-bg, #1e293b);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.etf-correlation-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 14px;
}

.etf-correlation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.etf-correlation-table th {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #94a3b8);
    font-weight: 600;
    padding: 10px 12px;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.etf-correlation-table th:first-child,
.etf-correlation-table th:nth-child(2) {
    text-align: left;
}

.etf-correlation-table td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary, #e2e8f0);
}

.etf-correlation-table td:first-child,
.etf-correlation-table td:nth-child(2) {
    text-align: left;
}

.etf-corr-high { color: #22c55e; font-weight: 700; }
.etf-corr-mid  { color: #f59e0b; font-weight: 700; }
.etf-corr-low  { color: #ef4444; font-weight: 700; }

/* ── Section Header ── */
.etf-section-header {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── No Data State ── */
.etf-no-data {
    background: var(--card-bg, #1e293b);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: var(--text-muted, #94a3b8);
}

.etf-no-data-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

/* ── Color helpers ── */
.text-up   { color: #22c55e; }
.text-down { color: #ef4444; }
.text-flat { color: var(--text-muted, #94a3b8); }

/* ============================================
 * RESPONSIVE
 * ============================================ */

/* Tablet: 2 columns */
@media (max-width: 1200px) {
    .etf-overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .etf-signals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .etf-tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: 1 column */
@media (max-width: 768px) {
    .etf-overview-grid {
        grid-template-columns: 1fr;
    }
    .etf-signals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .etf-tech-grid {
        grid-template-columns: 1fr;
    }
    .etf-comparison-wrapper,
    .etf-correlation-wrapper {
        padding: 12px;
    }
    .etf-comparison-table,
    .etf-correlation-table {
        font-size: 0.72rem;
    }
    .etf-chart-container {
        height: 300px;
    }
    .etf-recommendation {
        padding: 16px;
    }
}

/* ── Light theme overrides ── */
[data-theme="light"] .etf-card {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .etf-recommendation,
[data-theme="light"] .etf-comparison-wrapper,
[data-theme="light"] .etf-chart-block,
[data-theme="light"] .etf-tech-item,
[data-theme="light"] .etf-correlation-wrapper,
[data-theme="light"] .etf-no-data {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .etf-tag {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .etf-comparison-table th,
[data-theme="light"] .etf-correlation-table th {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .etf-comparison-table td,
[data-theme="light"] .etf-correlation-table td {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .etf-signal-card,
[data-theme="light"] .etf-gauge-card,
[data-theme="light"] .etf-rec-top-pick {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .etf-chart-tab {
    background: rgba(0, 0, 0, 0.05);
    color: #64748b;
}
