/* economic.day - Dashboard Analytics Dark */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Color Variables */
:root {
    --terminal-dark: #0d1117;
    --panel-dark: #161b22;
    --trust-blue: #1f6feb;
    --gain-green: #2ea043;
    --loss-red: #da3633;
    --data-white: #c9d1d9;
    --muted-label: #8b949e;
    --grid-line: #21262d;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--terminal-dark);
    color: var(--data-white);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

/* Dashboard Grid */
#dashboard {
    display: grid;
    grid-template-rows: 60px 1fr 80px;
    grid-template-areas:
        "header"
        "main"
        "ticker";
    height: 100vh;
    width: 100vw;
}

/* Header */
#header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background-color: var(--panel-dark);
    border-bottom: 1px solid var(--grid-line);
    z-index: 10;
}

.header-left {
    flex: 1;
}

.domain-name {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    color: var(--data-white);
}

.header-center {
    flex: 1;
    text-align: center;
}

#live-datetime {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--muted-label);
}

.header-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.market-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.open {
    background-color: var(--gain-green);
    box-shadow: 0 0 6px var(--gain-green);
}

.status-dot.closed {
    background-color: var(--loss-red);
    box-shadow: 0 0 6px var(--loss-red);
}

.status-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--muted-label);
    letter-spacing: 0.05em;
}

/* Main Area */
#main-area {
    grid-area: main;
    display: grid;
    grid-template-columns: 65% 35%;
    overflow: hidden;
}

/* Chart Panel */
#chart-panel {
    display: flex;
    flex-direction: column;
    padding: 24px;
    background:
        radial-gradient(circle, var(--grid-line) 1px, transparent 1px),
        var(--terminal-dark);
    background-size: 20px 20px;
    position: relative;
}

.chart-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.chart-title {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--muted-label);
    letter-spacing: 0.02em;
}

.chart-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-value {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--data-white);
}

.chart-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chart-change.positive {
    color: var(--gain-green);
}

.chart-change.negative {
    color: var(--loss-red);
}

.chart-period {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--muted-label);
}

/* Direction Arrows */
.arrow {
    display: inline-block;
    width: 0;
    height: 0;
}

.arrow.up {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid var(--gain-green);
}

.arrow.down {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid var(--loss-red);
}

/* Pulse Dot */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--gain-green);
    position: relative;
    display: inline-block;
}

.pulse-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--gain-green);
    animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Chart Container */
.chart-container {
    flex: 1;
    position: relative;
    min-height: 0;
}

#main-chart {
    width: 100%;
    height: calc(100% - 24px);
    display: block;
}

.chart-tooltip {
    position: absolute;
    display: none;
    background-color: var(--panel-dark);
    border: 1px solid var(--grid-line);
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--data-white);
    pointer-events: none;
    z-index: 20;
    white-space: nowrap;
}

.x-axis {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    height: 24px;
}

.x-axis span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--muted-label);
}

/* Sidebar */
#sidebar {
    background-color: var(--panel-dark);
    border-left: 1px solid var(--grid-line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-title {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--muted-label);
    letter-spacing: 0.02em;
    padding: 20px 20px 12px;
    flex-shrink: 0;
}

.indicator-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom scrollbar */
.indicator-list::-webkit-scrollbar {
    width: 4px;
}

.indicator-list::-webkit-scrollbar-track {
    background: transparent;
}

.indicator-list::-webkit-scrollbar-thumb {
    background: var(--grid-line);
    border-radius: 2px;
}

/* Indicator Cards */
.indicator-card {
    background-color: var(--terminal-dark);
    border: 1px solid var(--grid-line);
    border-radius: 6px;
    padding: 14px 16px;
    transition: border-color 0.2s ease;
}

.indicator-card:hover {
    border-color: var(--trust-blue);
}

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

.indicator-label {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--muted-label);
}

.indicator-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: var(--muted-label);
    background-color: var(--grid-line);
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.indicator-body {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.indicator-value {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1.15rem;
    color: var(--data-white);
    font-variant-numeric: tabular-nums;
}

.indicator-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 4px;
}

.indicator-change.positive {
    color: var(--gain-green);
}

.indicator-change.negative {
    color: var(--loss-red);
}

.indicator-change.neutral {
    color: var(--muted-label);
}

.dash-icon {
    display: inline-block;
    width: 8px;
    height: 2px;
    background-color: var(--muted-label);
}

.indicator-sparkline {
    height: 16px;
}

.sparkline {
    width: 100%;
    height: 16px;
}

.sparkline.green path {
    stroke: var(--gain-green);
}

.sparkline.red path {
    stroke: var(--loss-red);
}

.sparkline.neutral path {
    stroke: var(--muted-label);
}

/* Ticker Strip */
#ticker-strip {
    grid-area: ticker;
    background-color: var(--panel-dark);
    border-top: 1px solid var(--grid-line);
    overflow: hidden;
    display: flex;
    align-items: center;
    position: relative;
}

#ticker-strip::before,
#ticker-strip::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 5;
    pointer-events: none;
}

#ticker-strip::before {
    left: 0;
    background: linear-gradient(to right, var(--panel-dark), transparent);
}

#ticker-strip::after {
    right: 0;
    background: linear-gradient(to left, var(--panel-dark), transparent);
}

.ticker-track {
    width: 100%;
    overflow: hidden;
}

.ticker-content {
    display: flex;
    animation: tickerScroll 30s linear infinite;
    width: max-content;
}

@keyframes tickerScroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 24px;
    white-space: nowrap;
    border-right: 1px solid var(--grid-line);
    height: 80px;
}

.ticker-label {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--muted-label);
}

.ticker-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--data-white);
    font-variant-numeric: tabular-nums;
}

.ticker-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 3px;
}

.ticker-change.positive {
    color: var(--gain-green);
}

.ticker-change.negative {
    color: var(--loss-red);
}

.ticker-spark {
    width: 40px;
    height: 16px;
}

.ticker-spark path {
    fill: none;
    stroke-width: 1;
}

.ticker-spark.green path {
    stroke: var(--gain-green);
}

.ticker-spark.red path {
    stroke: var(--loss-red);
}

/* Mobile Layout */
@media (max-width: 768px) {
    #dashboard {
        grid-template-rows: 60px 50vh auto 80px;
        grid-template-areas:
            "header"
            "main-chart"
            "sidebar"
            "ticker";
        height: auto;
        min-height: 100vh;
    }

    html, body {
        overflow: auto;
    }

    #main-area {
        display: contents;
    }

    #chart-panel {
        grid-area: main-chart;
    }

    #sidebar {
        grid-area: sidebar;
        border-left: none;
        border-top: 1px solid var(--grid-line);
        max-height: 40vh;
        overflow-y: auto;
    }

    .chart-header {
        flex-direction: column;
        gap: 8px;
    }

    .header-right {
        gap: 10px;
    }

    .status-label {
        font-size: 0.6rem;
    }
}
