:root {
    --bg-color: #131722;
    --text-color: #d1d4dc;
    --accent-color: #d4af37;
    --sidebar-width: 250px;
    --header-height: 50px;
    /* Approximate height for ticker */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: #1e222d;
    border-right: 1px solid #2a2e39;
    padding: 20px;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 15px;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 5px;
    transition: background 0.2s, color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: #2a2e39;
    color: var(--accent-color);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Ticker */
.ticker-container {
    height: 70px;
    /* Adjusted for TradingView Ticker Tape needs */
    width: 100%;
    z-index: 900;
}

/* Heatmap Container */
.heatmap-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    height: 100%;
    overflow-y: auto;
    padding: 10px;
}

/* Custom Sidebar Menu */
.menu-category {
    padding: 15px 15px 5px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #5d606b;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.menu-item {
    padding: 10px 15px;
    margin: 5px 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px;
    background-color: transparent;
    transition: all 0.2s ease;
}

.menu-item .item-info {
    display: flex;
    flex-direction: column;
}

.menu-item .name {
    font-size: 0.9rem;
    color: #b2b5be;
    font-weight: 500;
}

.menu-item .details {
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 3px;
}

.menu-item:hover {
    background-color: #2a2e39;
    transform: translateX(5px);
}

.menu-item:hover .name {
    color: #fff;
}

/* Dynamic Colors */
.text-green {
    color: #4caf50;
}

.text-red {
    color: #f44336;
}

.link-waiting {
    color: #5d606b;
}

.menu-item i {
    font-size: 0.7rem;
    color: #5d606b;
    opacity: 0;
    transition: opacity 0.2s;
}

.menu-item:hover i {
    opacity: 1;
    color: var(--accent-color);
}

.heat-box {
    background-color: #2a2e39;
    border-radius: 4px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    transition: transform 0.2s;
    cursor: default;
    min-height: 100px;
}

.heat-box:hover {
    transform: scale(1.05);
    z-index: 10;
}

.heat-box .symbol {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 5px;
}

.heat-box .percent {
    font-size: 1.2rem;
    font-weight: bold;
}

.heat-box .price {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 5px;
}

/* Color Classes applied by JS */
.heat-green-1 {
    background-color: rgba(76, 175, 80, 0.2);
}

.heat-green-2 {
    background-color: rgba(76, 175, 80, 0.4);
}

.heat-green-3 {
    background-color: rgba(76, 175, 80, 0.6);
}

.heat-green-4 {
    background-color: rgba(76, 175, 80, 0.8);
}

.heat-green-5 {
    background-color: rgba(76, 175, 80, 1.0);
}

.heat-red-1 {
    background-color: rgba(244, 67, 54, 0.2);
}

.heat-red-2 {
    background-color: rgba(244, 67, 54, 0.4);
}

.heat-red-3 {
    background-color: rgba(244, 67, 54, 0.6);
}

.heat-red-4 {
    background-color: rgba(244, 67, 54, 0.8);
}

.heat-red-5 {
    background-color: rgba(244, 67, 54, 1.0);
}

/* Dashboard Grid */
.dashboard-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: 3fr 1fr;
    /* Major Chart vs Market List */
    grid-template-rows: auto auto;
    gap: 20px;
    flex: 1;
}

/* Widget Containers */
.widget-box {
    background-color: #1e222d;
    border: 1px solid #2a2e39;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Specific Areas */
/* Main Chart Controls */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #2a2e39;
}

.chart-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.time-controls button {
    background: #1e222d;
    border: 1px solid #2a2e39;
    color: #787b86;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 5px;
}

.time-controls button.active {
    background: #2962ff;
    color: #fff;
    border-color: #2962ff;
}

#apexChart {
    padding: 10px;
}


.market-list {
    grid-column: 2 / 3;
    height: 600px;
}

.bottom-analysis {
    grid-column: 1 / 2;
    /* Aligns with Main Chart, prevents full-width stretching */
    height: 400px;
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    position: fixed;
    top: 75px;
    /* Below ticker */
    left: 15px;
    z-index: 1100;
    background: #1e222d;
    border: 1px solid #2a2e39;
    color: var(--accent-color);
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .main-chart,
    .market-list {
        grid-column: 1 / -1;
        height: 500px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }
}