/* CCC Trading Dashboard — main stylesheet */

:root {
    --bg: #0f1117;
    --surface: #1a1d28;
    --surface-hover: #232735;
    --border: #2e3344;
    --text: #e0e0e0;
    --text-dim: #888899;
    --accent: #4a9eff;
    --accent-hover: #6bb0ff;
    --green: #4caf50;
    --red: #ef5350;
    --yellow: #ffc107;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.hidden { display: none !important; }

/* Login */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 360px;
    text-align: center;
}
.login-card h1 { margin-bottom: 1.5rem; color: var(--accent); font-size: 1.5rem; }
.login-card input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 14px;
}
.login-card input:focus { border-color: var(--accent); outline: none; }
.login-card button {
    width: 100%;
    padding: 0.6rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.login-card button:hover { background: var(--accent-hover); }
.error-msg { color: var(--red); margin-top: 0.5rem; font-size: 13px; }

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    height: 50px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand { font-weight: 700; color: var(--accent); font-size: 1.1rem; }
.nav-links { display: flex; gap: 0.5rem; flex: 1; }
.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: all 0.15s;
    font-size: 14px;
}
.nav-link:hover { background: var(--surface-hover); color: var(--text); }
.nav-link.active { background: var(--surface-hover); color: var(--accent); }
.nav-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.nav-logout:hover { border-color: var(--red); color: var(--red); }

/* Content */
.content { padding: 1.5rem; max-width: 1400px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

/* Filter bar */
.filters-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filters-bar select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}
.btn-refresh {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 0.35rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.btn-refresh:hover { background: var(--surface-hover); }

/* Tables */
.table-wrapper { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    background: var(--surface);
    color: var(--text-dim);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.data-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tr:hover td { background: var(--surface-hover); }

/* Tags */
.tag { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.tag-long { background: rgba(76,175,80,0.2); color: var(--green); }
.tag-short { background: rgba(239,83,80,0.2); color: var(--red); }
.tag-active { background: rgba(74,158,255,0.2); color: var(--accent); }
.tag-cancel { background: rgba(239,83,80,0.2); color: var(--red); }
.tag-pass { color: var(--green); }
.tag-fail { color: var(--red); }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}
.pagination button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.3rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination span { color: var(--text-dim); font-size: 13px; }

/* Sub tabs */
.sub-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.sub-tab {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.35rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.sub-tab.active { color: var(--accent); border-color: var(--accent); }
.sub-content { display: none; }
.sub-content.active { display: block; }

/* Totals bar */
.totals-bar {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    display: flex;
    gap: 2rem;
    font-size: 13px;
}
.totals-bar .stat-val { font-weight: 700; }

/* Source cards */
.source-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.source-card .src-name { font-weight: 700; font-size: 1.1rem; min-width: 120px; }
.source-card .src-info { flex: 1; color: var(--text-dim); font-size: 13px; }
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    border-radius: 12px;
    transition: 0.2s;
}
.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}
input:checked + .toggle-slider { background: var(--green); }
input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Health */
.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}
.health-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.health-card h3 { color: var(--text-dim); font-size: 13px; margin-bottom: 0.5rem; text-transform: uppercase; }
.health-card .big-val { font-size: 1.6rem; font-weight: 700; }
.health-ok { color: var(--green); }
.health-err { color: var(--red); }

/* Links */
.tg-link { color: var(--accent); text-decoration: none; }
.tg-link:hover { text-decoration: underline; }
.filter-link { color: var(--accent); cursor: pointer; text-decoration: underline; }
