/* ═══════════════════════════════════════════════════════════════
   MT Account Monitor — Dark Theme Dashboard
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2333;
    --bg-card-hover: #222d3f;
    --border-color: #30363d;
    --border-light: #21262d;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    --green: #3fb950;
    --green-dim: #238636;
    --green-bg: rgba(63, 185, 80, 0.15);
    --red: #f85149;
    --red-dim: #da3633;
    --red-bg: rgba(248, 81, 73, 0.15);
    --blue: #58a6ff;
    --blue-bg: rgba(88, 166, 255, 0.15);
    --yellow: #d29922;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --radius: 8px;
    --radius-sm: 4px;
    --transition: 0.2s ease;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 16px 24px;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    outline: none;
}

.btn-primary {
    background: var(--blue-bg);
    color: var(--blue);
    border-color: rgba(88, 166, 255, 0.3);
}

.btn-primary:hover {
    background: rgba(88, 166, 255, 0.25);
    border-color: var(--blue);
}

.btn-accent {
    background: var(--green-bg);
    color: var(--green);
    border-color: rgba(63, 185, 80, 0.3);
}

.btn-accent:hover {
    background: rgba(63, 185, 80, 0.25);
    border-color: var(--green);
}

.btn-danger {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 4px 8px;
    font-size: 12px;
}

.btn-danger:hover {
    color: var(--red);
}

/* ── Summary Bar ───────────────────────────────────────────── */
.summary-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    white-space: nowrap;
}

.summary-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    margin: 0 6px;
}

.highlight-green {
    color: var(--green) !important;
    font-weight: 700 !important;
    background: var(--green-bg);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

/* ── Account Section ───────────────────────────────────────── */
.account-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.account-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.server-status {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Account Card ──────────────────────────────────────────── */
.account-card {
    display: grid;
    grid-template-columns: 130px 60px 170px 200px 180px 180px 180px;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.account-card:hover {
    background: var(--bg-card-hover);
}

.account-card:last-child {
    border-bottom: none;
}

.cell {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-account {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.cell-status {
    font-size: 12px;
    font-weight: 600;
}

.status-online {
    color: var(--green);
}

.status-offline {
    color: var(--red);
}

.cell-date {
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-mono);
}

.cell-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.label-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    background: var(--blue-bg);
    color: var(--blue);
    border: 1px solid rgba(88, 166, 255, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.cell-balance {
    line-height: 1.5;
}

.balance-main {
    font-weight: 700;
    font-size: 14px;
}

.balance-equity {
    font-size: 12px;
    color: var(--text-muted);
}

.cell-ip {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    padding: 3px 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    text-align: center;
}

.cell-pl {
    font-weight: 600;
    font-size: 13px;
}

.cell-pl-group {
    line-height: 1.6;
}

.positive {
    color: var(--green);
}

.negative {
    color: var(--red);
}

.pl-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Percentage annotation after P&L value */
.pct {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.7;
    margin-left: 2px;
}


/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state-text {
    font-size: 15px;
    margin-bottom: 8px;
}

.empty-state-hint {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1500px) {
    .account-card {
        grid-template-columns: 110px 50px 150px 180px 160px 160px 160px;
        gap: 6px;
        padding: 14px 16px;
    }
}

@media (max-width: 1100px) {
    body {
        padding: 12px;
    }

    .account-card {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 16px;
    }

    .cell-ip {
        display: inline-block;
    }

    .summary-bar {
        gap: 6px;
    }

    .summary-divider {
        display: none;
    }
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.account-card {
    animation: fadeIn 0.3s ease;
}

/* pulse animation for online indicator */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-online::before {
    content: '●';
    margin-right: 4px;
    animation: pulse 2s ease-in-out infinite;
}

.status-offline::before {
    content: '●';
    margin-right: 4px;
}