/* =============================================
   Stock Trading Dashboard — Base Styles
   ============================================= */

:root {
    --bg-primary:     #0f1117;
    --bg-secondary:   #1a1d27;
    --bg-card:        #21253a;
    --border:         #2e3350;
    --text-primary:   #e8eaf0;
    --text-secondary: #8b8fa8;
    --accent:         #4f8ef7;
    --accent-hover:   #6aa0ff;
    --green:          #2ecc71;
    --red:            #e74c3c;
    --yellow:         #f39c12;
    --font:           'Segoe UI', system-ui, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    min-height: 100vh;
}

/* ---- Layout ---- */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- Header / Nav ---- */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.05em;
}

.nav {
    display: flex;
    gap: 0.25rem;
}

.nav-item {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border: none;
    background: none;
    font-size: 0.9rem;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.auth-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--red);
}

.auth-status .dot.connected {
    background-color: var(--green);
}

/* ---- Main Content ---- */
.main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ---- Summary Cards ---- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
}

.card .card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.card .card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card .card-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ---- Tables ---- */
.table-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.table-section h2 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background-color: rgba(79, 142, 247, 0.05);
}

tbody td {
    padding: 0.7rem 0.75rem;
    font-size: 0.875rem;
}

/* ---- Value Colors ---- */
.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral  { color: var(--text-secondary); }

/* ---- Buttons ---- */
.btn {
    padding: 0.35rem 0.9rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.15s, opacity 0.15s;
}

.btn-buy {
    background-color: var(--accent);
    color: #fff;
}

.btn-buy:hover {
    background-color: var(--accent-hover);
}

.btn-login {
    background-color: var(--accent);
    color: #fff;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
}

/* ---- Badge / Status ---- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-buy    { background: rgba(46, 204, 113, 0.15); color: var(--green); }
.badge-filled { background: rgba(46, 204, 113, 0.15); color: var(--green); }
.badge-pending{ background: rgba(243, 156, 18, 0.15); color: var(--yellow); }
.badge-cancelled { background: rgba(231, 76, 60, 0.15); color: var(--red); }

/* ---- Loading / Empty states ---- */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .main { padding: 1rem; }
    .header { padding: 0 1rem; }
    .nav-item { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
}
