:root {
    --bg-color: #0b0e14;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --accent-green: #00ff88;
    --accent-blue: #00d2ff;
    --text-main: #e0e0e0;
    --text-dim: #909090;
    --lock-overlay: rgba(11, 14, 20, 0.85);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', 'Roboto', sans-serif;
    overflow-x: hidden;
}

.dashboard-container {
    display: flex;
    /* Use flex for easier sidebar collapsing */
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--card-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    width: 260px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    overflow-y: auto; /* Enable scrolling for long menus */
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) transparent;
}

.sidebar.collapsed {
    width: 68px;
    padding: 20px 10px;
}

.sidebar.collapsed .logo,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .status-badge,
.sidebar.collapsed .unlock-btn {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .nav-item i {
    margin-right: 0;
    font-size: 20px;
}

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 65px;
    width: 24px;
    height: 24px;
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: 0.3s;
}

.sidebar-toggle:hover {
    border-color: var(--accent-green);
}

.logo {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 50px;
    white-space: nowrap;
    padding-left: 5px;
}

.nav-item {
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    color: var(--text-dim);
    font-weight: 500;
    display: flex;
    align-items: center;
}

.nav-item i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.nav-text {
    white-space: nowrap;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    border-left: 3px solid var(--accent-green);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    transition: padding 0.3s;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.user-profile {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 8px 15px;
    border-radius: 50px;
    border: 1px solid var(--card-border);
}

.status-badge {
    font-size: 10px;
    text-transform: uppercase;
    background: var(--accent-green);
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 10px;
    font-weight: 700;
}

/* Grid Layout for Modules */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.module-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 25px;
    backdrop-filter: blur(10px);
    min-height: 280px;
    transition: transform 0.3s;
}

.module-card:hover {
    transform: translateY(-5px);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
}

.card-subtitle {
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* AI Signal specific */
.signal-buy {
    color: var(--accent-green);
}

.signal-score {
    font-size: 32px;
    font-weight: 800;
    margin: 10px 0;
}

/* Locked State */
.module-locked .card-content {
    filter: blur(4px);
    pointer-events: none;
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--lock-overlay);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 16px;
    z-index: 10;
    opacity: 0;
    transition: 0.4s;
}

.module-locked:hover .lock-overlay {
    opacity: 1;
}

.lock-icon {
    font-size: 30px;
    margin-bottom: 15px;
}

.unlock-btn {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    border: none;
    color: #000;
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.unlock-btn:hover {
    filter: brightness(1.1);
}

/* Chart Placeholder */
.chart-placeholder {
    width: 100%;
    height: 120px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chart-placeholder::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.1), transparent);
    animation: sweep 3s infinite linear;
}

@keyframes sweep {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Perplexity inspired high-density layouts */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.asset-tile {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.asset-tile:hover {
    border-color: var(--neon-cyan);
    background: rgba(0, 255, 242, 0.05);
}

.asset-name {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-weight: 500;
}

.asset-price {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.asset-change {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.asset-change.up {
    color: var(--accent-green);
}

.asset-change.down {
    color: var(--accent-red);
}

.layout-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px; /* Use minmax(0, 1fr) to prevent overflow */
    gap: 24px;
    width: 100%;
    align-items: start;
}

.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

/* Tablet / Large Screens (e.g., iPad Pro or half-screen browser) */
@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr) 300px;
    }
}

/* Slim Tablet / Mobile (iPhone) - Single column stack */
@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* Stack everything on one column */
    }

    .dashboard-sidebar {
        width: 100%;
    }

    .main-content {
        padding: 20px;
    }

    .asset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.heatmap-placeholder {
    width: 100%;
    aspect-ratio: 21/9;
    background: #0a0a0a;
    border-radius: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--card-border);
    margin-bottom: 30px;
    overflow: hidden;
}

.heatmap-box {
    flex: 1;
    min-width: 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #000;
    border-radius: 2px;
}

.sector-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sector-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid transparent;
}

.sector-item:hover {
    border-color: var(--card-border);
    background: rgba(255, 255, 255, 0.04);
}

.prediction-card {
    padding: 16px;
    border-radius: 12px;
    background: var(--card-bg);
    margin-bottom: 12px;
    border: 1px solid var(--card-border);
}

.prediction-header {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dim);
}

.prob-bar-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 8px 0;
    overflow: hidden;
}

.prob-bar {
    height: 100%;
    background: var(--neon-cyan);
    border-radius: 10px;
}

/* Main Content Styling & Uniformity */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: clamp(10px, 3vw, 40px);
    background: radial-gradient(circle at top left, #12161f, #0b0e14);
    display: flex;
    flex-direction: column;
    min-width: 0;
    align-items: center; /* Center the inner content */
}

.content-view {
    width: 100%;
    max-width: 1600px; /* Prevent it from getting too wide on ultra-wide screens */
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    font-size: clamp(20px, 4vw, 32px);
    font-weight: 900;
}

.asset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2-column layout for 2x2 grid */
    gap: 20px;
    margin-bottom: 30px;
}

.heatmap-container {
    height: 600px;
    background: #000;
    border-radius: 12px;
    padding: 6px;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.heatmap-sector {
    display: flex;
    flex-direction: column;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border: 1px solid var(--card-border);
    min-width: 150px;
}

.sector-header {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-dim);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    height: 100%;
    align-content: flex-start;
}

.heatmap-stock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    color: #fff;
    /* Changed to white for better dark-mode legibility */
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.heatmap-stock span:first-child {
    font-size: 14px;
    font-weight: 900;
}

.heatmap-stock span:last-child {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.9;
}

.heatmap-stock:hover {
    transform: scale(1.02);
    filter: brightness(1.2);
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* Floating Tooltip */
#stock-tooltip {
    position: fixed;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--card-border);
    padding: 20px;
    border-radius: 16px;
    width: 320px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 9999;
    display: none;
    border-left: 4px solid var(--neon-cyan);
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tooltip-price {
    font-size: 28px;
    font-weight: 800;
    margin: 10px 0;
    letter-spacing: -1px;
}

.tooltip-tag {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-dim);
}

/* Modal for expansion */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
}

.modal-content {
    width: 95%;
    max-width: 1400px;
    height: 90%;
    background: var(--bg-dark);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.close-modal {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
}

.expand-btn {
    font-size: 12px;
    color: var(--neon-cyan);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(0, 255, 242, 0.1);
}

/* Crypto Trends */
.crypto-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crypto-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid transparent;
}

.crypto-item:hover {
    border-color: var(--card-border);
    background: rgba(255, 255, 255, 0.04);
}

.crypto-info {
    display: flex;
    flex-direction: column;
}

.crypto-symbol {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* Politician Trades */
.politician-item {
    padding: 12px;
    border-bottom: 1px solid var(--card-border);
    font-size: 13px;
}

.politician-item:last-child {
    border-bottom: none;
}

.trade-action {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    margin-right: 5px;
}

.action-buy {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.action-sell {
    background: rgba(255, 68, 68, 0.2);
    color: var(--accent-red);
}

/* Enhanced Prediction Cards */
.prediction-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.prediction-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
}

.pred-option {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 6px;
}

.pred-vol {
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 8px;
}

/* Watchlist Mini */
.watchlist-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.01);
    margin-bottom: 4px;
}

/* Data Tables for Screener/Politicians */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 12px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Filters */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.filter-pill {
    padding: 6px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-pill.active {
    border-color: var(--neon-cyan);
    background: rgba(0, 255, 242, 0.1);
    color: var(--neon-cyan);
}

/* Disclosure Modules */
.disclosure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.disclosure-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    border-left: 4px solid transparent;
}

.disclosure-card:hover {
    border-color: var(--neon-cyan);
}

.disclosure-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.disclosure-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    font-weight: 800;
}

.impact-high {
    color: #ffbb00;
}

.impact-extreme {
    color: #ff4444;
    font-weight: 900;
}

.pe-tag {
    color: var(--text-dim);
    font-size: 11px;
}

/* View Specific */
.view-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* News Feed */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.news-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

.news-meta {
    display: flex;
    flex-direction: column;
    min-width: 80px;
    font-size: 11px;
    color: var(--text-dim);
}

.news-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

.news-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    margin-top: 5px;
    width: fit-content;
}

.badge-high {
    background: rgba(255, 68, 68, 0.2);
    color: var(--accent-red);
}

/* Spotlight Section */
.spotlight-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
}

.spotlight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.spotlight-chart-large {
    height: 200px;
    width: 100%;
    margin: 20px 0;
}

.spotlight-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    border-top: 1px solid var(--card-border);
    padding-top: 15px;
}

.stat-item .label {
    font-size: 11px;
    color: var(--text-dim);
    display: block;
}

.stat-item .value {
    font-size: 14px;
    font-weight: 700;
}

/* Portfolio Styles */
.portfolio-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.summary-item {
    padding: 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent);
    border: 1px solid var(--card-border);
}

/* Mini Sparkline Canvas */
.sparkline-box {
    width: 100%;
    height: 60px;
}

.badge-medium {
    background: rgba(255, 187, 0, 0.2);
    color: #ffbb00;
}