/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-card: #1e2433;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --accent: #4a9eff;
    --accent-hover: #3a8eef;
    --success: #34a853;
    --danger: #ea4335;
    --warning: #fbbc04;
    --border: #2d3748;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    margin-top: 20px;
    padding: 20px;
}

/* Header */
header {
    background: var(--bg-secondary);
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px var(--shadow);
}

/* Price Ticker Banner */
.price-ticker {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 10px 30px;
    border-radius: 0;
    margin: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    box-shadow: 0 2px 4px var(--shadow);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ticker-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ticker-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ticker-symbol {
    font-size: 14px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

.ticker-price {
    font-size: 15px;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1;
}

.ticker-change {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.ticker-change.positive {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

.ticker-change.negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

@media (max-width: 768px) {
    .price-ticker {
        flex-wrap: wrap;
        gap: 12px;
        padding: 8px 15px;
    }

    .ticker-item {
        flex: 1 1 45%;
        min-width: 140px;
    }

    .ticker-icon {
        width: 24px;
        height: 24px;
    }

    .ticker-price {
        font-size: 13px;
    }

    .ticker-change {
        font-size: 10px;
    }
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.last-update {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-refresh {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-refresh:active {
    transform: translateY(0);
}

/* Dashboard Grid */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
}

.card-wide {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.source {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 12px;
    border-radius: 12px;
}

.card-content {
    color: var(--text-primary);
    position: relative;
}

.section-timestamp {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.metric {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border);
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-value.positive {
    color: var(--success);
}

.metric-value.negative {
    color: var(--danger);
}

.metric-change {
    font-size: 13px;
    font-weight: 500;
    margin-top: 4px;
}

.metric-change.positive {
    color: var(--success);
}

.metric-change.negative {
    color: var(--danger);
}

.metric-change.neutral {
    color: var(--text-secondary);
}

/* Color coding for change values inside metric-change */
.metric-change span.positive {
    color: var(--success);
}

.metric-change span.negative {
    color: var(--danger);
}

.metric-change span.neutral {
    color: var(--text-secondary);
}

/* ETF Section */
.etf-section {
    margin-top: 20px;
}

.etf-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.etf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.etf-item {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* ETF Tabs */
.etf-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 8px;
}

.etf-tab {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.etf-tab:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.etf-tab.active {
    background: var(--accent);
    color: white;
}

/* Coin Selector */
.coin-selector {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.coin-selector:hover {
    background: var(--bg-primary);
}

/* ETF Table */
.etf-table-container {
    margin-top: 16px;
}

.etf-table {
    width: 100%;
    border-collapse: collapse;
}

.etf-table th {
    text-align: left;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border);
}

.etf-table th:not(:first-child) {
    text-align: center;
}

.etf-table th:last-child {
    border-right: none;
}

.etf-table td {
    padding: 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.etf-table td:first-child {
    background: rgba(0, 0, 0, 0.15);
}

.etf-table td:last-child {
    border-right: none;
    background: rgba(0, 0, 0, 0.15);
}

.etf-table tr:last-child td {
    border-bottom: none;
}

.etf-table tr:hover {
    background: var(--bg-secondary);
}

.etf-date {
    color: var(--text-primary);
    font-weight: 500;
}

.etf-flow {
    font-weight: 600;
    text-align: right;
}

.etf-flow.positive {
    color: var(--success);
}

.etf-flow.negative {
    color: var(--danger);
}

/* Calendar Sections */
.calendar-section {
    margin-bottom: 30px;
}

.calendar-section:last-child {
    margin-bottom: 0;
}

.calendar-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* Events Table */
.events-table {
    width: 100%;
    border-collapse: collapse;
}

.events-table th,
.events-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.events-table th {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.events-table td {
    font-size: 14px;
}

.event-date {
    font-weight: 600;
    color: var(--text-primary);
}

.impact-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.impact-red {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.impact-ora,
.impact-orange {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    color: white;
}

/* Forex Factory Event Table */
.event-date {
    font-weight: 600;
    vertical-align: middle;
    border-right: 2px solid rgba(255, 255, 255, 0.1);
}

.event-actual {
    font-weight: 600;
    color: #60a5fa;
}

.event-actual-empty {
    font-weight: 600;
    color: inherit; /* Match normal table text color */
}

.event-actual-higher {
    font-weight: 600;
    color: #22c55e;
}

.event-actual-lower {
    font-weight: 600;
    color: #ef4444;
}

/* Highlight today's row */
.today-highlight {
    background: rgba(96, 165, 250, 0.35) !important;
}

.today-highlight:hover {
    background: rgba(96, 165, 250, 0.45) !important;
}

/* Timezone Selector */
.timezone-selector {
    position: relative;
}

.timezone-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    margin-top: 4px;
    min-width: 80px;
}

.timezone-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    background: transparent;
    color: #e2e8f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: background 0.2s;
}

.timezone-dropdown button:hover {
    background: rgba(96, 165, 250, 0.2);
}

/* Polymarket */
#polymarket {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.market-item {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 20px;
    border-radius: 12px;
    border: none;
}

.market-title {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    min-height: 40px;
}

.market-title a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    line-height: 1.4;
}

.market-title a:hover {
    color: var(--accent);
}

.market-odds {
    margin-top: 10px;
}

.odds-container {
    display: flex;
    gap: 10px;
}

.odds-yes,
.odds-no {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 12px;
    border-radius: 8px;
    border: none;
}

.odds-yes {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.odds-no {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.odds-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 6px;
}

.odds-value {
    font-size: 22px;
    font-weight: 700;
    color: white;
}

/* Responsive for Polymarket grid */
@media (max-width: 768px) {
    #polymarket {
        grid-template-columns: 1fr;
    }
}

/* Tokens Grid */
.tokens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.token-card {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.token-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

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

.token-name {
    font-size: 16px;
    font-weight: 600;
}

.token-chain {
    font-size: 11px;
    background: var(--bg-primary);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
}

.token-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 13px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 11px;
}

.stat-value {
    font-weight: 600;
    margin-top: 2px;
}

/* To Do Section */
.todo-section {
    margin: 30px auto;
    max-width: 1200px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.todo-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 15px 0;
}

.todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.todo-list li {
    padding: 10px 0;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    position: relative;
    padding-left: 25px;
}

.todo-list li:last-child {
    border-bottom: none;
}

.todo-list li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: var(--accent);
    font-weight: bold;
    font-size: 18px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Data Sections with Time Selectors */
.data-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

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

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Time Selector Buttons */
.time-selector {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 8px;
}

.time-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.time-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.time-btn.active {
    background: var(--accent);
    color: white;
}

/* Time Label (for fixed intervals) */
.time-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 6px 12px;
    border-radius: 6px;
}

/* Liquidations Table */
.liquidations-table-container {
    margin-top: 16px;
}

.liquidations-table {
    width: 100%;
    border-collapse: collapse;
}

.liquidations-table th {
    text-align: center;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border);
}

.liquidations-table thead tr:first-child th:first-child {
    text-align: left;
}

.liquidations-table th:last-child {
    border-right: none;
}

.liquidations-table td {
    padding: 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.liquidations-table td:last-child {
    border-right: none;
}

.liquidations-table tr:last-child td {
    border-bottom: none;
}

.liquidations-table tr:hover {
    background: var(--bg-secondary);
}

.liq-coin {
    color: var(--text-primary);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.coin-logo-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.liq-long {
    color: var(--danger);
    font-size: 14px;
    text-align: center;
}

.liq-short {
    color: var(--success);
    font-size: 14px;
    text-align: center;
}

/* Long/Short Table */
.longshort-table-container {
    margin-top: 16px;
}

.longshort-table {
    width: 100%;
    border-collapse: collapse;
}

.longshort-table th {
    text-align: center;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border);
}

.longshort-table th:first-child {
    text-align: left;
}

.longshort-table th:last-child {
    border-right: none;
}

.longshort-table td {
    padding: 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.longshort-table td:last-child {
    border-right: none;
}

.longshort-table tr:last-child td {
    border-bottom: none;
}

.longshort-table tr:hover {
    background: var(--bg-secondary);
}

.ls-coin {
    color: var(--text-primary);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.exchange-logo-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.ls-ratio-cell {
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.ls-ratio-cell.ls-long {
    color: var(--success);
}

.ls-ratio-cell.ls-short {
    color: var(--danger);
}

/* Long/Short Grid (old styles kept for compatibility) */
.longshort-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.ls-item {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.ls-token {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ls-ratio {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.ls-exchanges {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.ls-exchange {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.ls-exchange:last-child {
    border-bottom: none;
}

.ls-exchange-name {
    color: var(--text-secondary);
}

.ls-exchange-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .metrics-grid,
    .tokens-grid {
        grid-template-columns: 1fr;
    }

    .events-table {
        font-size: 12px;
    }

    .events-table th,
    .events-table td {
        padding: 8px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

/* Ratio Bar Styles */
.ls-ratio {
    padding: 8px 12px;
}

.ratio-bar-container {
    width: 100%;
}

.ratio-bar {
    display: flex;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.ratio-long {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ratio-short {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ratio-label {
    color: white;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: absolute;
    white-space: nowrap;
}
