/* BeRich Dashboard Styles */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent: #e94560;
    --positive: #00d26a;
    --negative: #ff4757;
    --warning: #ffa502;
    --oversold: #00d26a;
    --overbought: #ff4757;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--bg-card);
}

header h1 {
    font-size: 1.8rem;
    color: var(--accent);
}

.status-bar {
    display: flex;
    gap: 15px;
    align-items: center;
}

.status-bar span {
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status.running {
    background: var(--positive);
    color: #000;
}

.status.stopped {
    background: var(--negative);
    color: #fff;
}

.mode.paper {
    background: var(--warning);
    color: #000;
}

.mode.real {
    background: var(--accent);
    color: #fff;
}

.warmup {
    background: var(--bg-card);
    color: var(--warning);
}

.update-time {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.logout-btn {
    background: var(--bg-card);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--accent);
    color: white;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

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

.card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.card .value {
    font-size: 1.8rem;
    font-weight: 700;
}

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

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

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.panel {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 20px;
}

.panel h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bg-card);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 10px;
    text-align: left;
}

th {
    background: var(--bg-card);
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

tr:nth-child(even) {
    background: rgba(15, 52, 96, 0.3);
}

tr:hover {
    background: rgba(233, 69, 96, 0.1);
}

td.symbol {
    font-weight: 600;
    color: var(--accent);
}

td.number {
    text-align: right;
    font-family: 'Consolas', monospace;
}

td.positive {
    color: var(--positive);
}

td.negative {
    color: var(--negative);
}

td.rsi.oversold {
    color: var(--oversold);
    font-weight: 600;
}

td.rsi.overbought {
    color: var(--overbought);
    font-weight: 600;
}

td.empty {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* RSI Panel */
.rsi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.rsi-item {
    background: var(--bg-card);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rsi-item.oversold {
    border-left: 3px solid var(--oversold);
}

.rsi-item.overbought {
    border-left: 3px solid var(--overbought);
}

.rsi-symbol {
    font-weight: 600;
    font-size: 0.9rem;
}

.rsi-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Consolas', monospace;
}

.rsi-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.rsi-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--oversold), var(--warning), var(--overbought));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Activity Section */
.activity-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.activity-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.activity-list li {
    padding: 10px;
    border-bottom: 1px solid var(--bg-card);
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 0.9rem;
}

.activity-list li:hover {
    background: rgba(233, 69, 96, 0.1);
}

.activity-list li.buy,
.activity-list li.entry_long {
    border-left: 3px solid var(--positive);
}

.activity-list li.sell,
.activity-list li.exit_long {
    border-left: 3px solid var(--negative);
}

.activity-list li.empty {
    color: var(--text-secondary);
    font-style: italic;
    justify-content: center;
}

.activity-list .time {
    color: var(--text-secondary);
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
}

.activity-list .type,
.activity-list .side {
    font-weight: 600;
    min-width: 80px;
}

.activity-list li.buy .side,
.activity-list li.entry_long .type {
    color: var(--positive);
}

.activity-list li.sell .side,
.activity-list li.exit_long .type {
    color: var(--negative);
}

.activity-list .symbol {
    font-weight: 600;
    color: var(--accent);
}

.activity-list .detail {
    color: var(--text-secondary);
    margin-left: auto;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

footer p {
    margin: 5px 0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

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

    .activity-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
    }

    .status-bar {
        flex-wrap: wrap;
        justify-content: center;
    }

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

/* Empty state */
.empty {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Symbol detail page */
.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.2rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.back-link:hover {
    color: var(--accent);
    background: var(--bg-card);
}

.symbol-info {
    margin-bottom: 30px;
}

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

.rsi-value.oversold {
    color: var(--oversold);
}

.rsi-value.overbought {
    color: var(--overbought);
}

/* Chart containers */
.chart-section {
    margin-bottom: 20px;
}

.chart-container {
    width: 100%;
    height: 400px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.chart-container-small {
    width: 100%;
    height: 200px;
    background: var(--bg-primary);
    border-radius: 8px;
}

/* Clickable rows */
tr[onclick]:hover {
    background: rgba(233, 69, 96, 0.2) !important;
}

.rsi-item[onclick]:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
    transition: all 0.2s;
}
