/* ── Binance Bot Dashboard v4.0 ── */
/* Dark theme, modern, clean */

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-hover: #22252f;
    --bg-input: #13151d;
    --border: #2a2d3a;
    --text: #e2e8f0;
    --text-dim: #64748b;
    --text-muted: #475569;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.15);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.15);
    --yellow: #eab308;
    --yellow-dim: rgba(234, 179, 8, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --transition: all 0.2s ease;
}

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

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

/* ── Navbar ── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo { font-size: 24px; }
.brand-text { font-size: 18px; font-weight: 700; }
.brand-version { font-size: 11px; color: var(--text-dim); background: var(--bg); padding: 2px 6px; border-radius: 4px; }

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover { color: var(--text); background: var(--bg-hover); }
.nav-link.active { color: var(--primary); background: rgba(59, 130, 246, 0.1); }
.nav-icon { font-size: 16px; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge { font-size: 13px; color: var(--text-dim); }

/* ── Container ── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 { font-size: 24px; font-weight: 700; }

.bot-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-dim);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--red);
}

.status-dot.online {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.uptime { font-size: 12px; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.stat-card:hover { border-color: var(--primary); }
.stat-card.positive { border-left: 3px solid var(--green); }
.stat-card.negative { border-left: 3px solid var(--red); }

.stat-icon { font-size: 32px; }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-sub { font-size: 12px; color: var(--text-muted); }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

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

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

/* ── Tables ── */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(42, 45, 58, 0.5);
    white-space: nowrap;
}

.table tbody tr:hover { background: var(--bg-hover); }
.row-win { background: var(--green-dim); }
.row-loss { background: var(--red-dim); }

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

.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-dim { background: var(--bg); color: var(--text-dim); }

/* ── Text Colors ── */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-dim { color: var(--text-dim); }
.font-bold { font-weight: 700; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    color: var(--text);
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn-outline:hover { border-color: var(--text); color: var(--text); }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: #d97706; color: white; }
.btn-warning:hover { background: #b45309; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.bot-controls-card { margin-bottom: 16px; }

/* ── Forms ── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: block; }

/* ── Settings Grid ── */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.settings-form .card { margin-bottom: 24px; }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* ── Toggle ── */
.toggle-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    width: 40px;
    height: 22px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.toggle-label input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-label input[type="checkbox"]:checked {
    background: var(--primary);
}

.toggle-label input[type="checkbox"]:checked::after {
    left: 21px;
    background: white;
}

/* ── Filter Card ── */
.filter-card { margin-bottom: 20px; }

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 16px 20px;
    flex-wrap: wrap;
}

.filter-form .form-group { margin-bottom: 0; min-width: 150px; }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 0;
}

.page-info { font-size: 14px; color: var(--text-dim); }

/* ── Login ── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f1117 0%, #1a1d27 100%);
}

.login-container { width: 100%; max-width: 400px; padding: 20px; }

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo { font-size: 48px; display: block; margin-bottom: 12px; }
.login-header h1 { font-size: 28px; font-weight: 700; }
.login-header p { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

.login-form .form-group { margin-bottom: 20px; }
.login-form .btn { margin-top: 8px; padding: 12px; font-size: 16px; }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-size: 14px;
}

/* ── Error Page ── */
.error-page {
    text-align: center;
    padding: 80px 20px;
}

.error-page h1 { font-size: 72px; color: var(--primary); }
.error-page p { color: var(--text-dim); margin: 12px 0 24px; }

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.3); }

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ── Flash Messages ── */
.flash-messages { margin-bottom: 16px; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 8px;
    }

    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .nav-link { padding: 6px 12px; font-size: 13px; }

    .container { padding: 16px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

    .stat-card { padding: 14px; }
    .stat-value { font-size: 18px; }
    .stat-icon { font-size: 24px; }

    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }

    .filter-form { flex-direction: column; }
    .filter-form .form-group { min-width: 100%; }

    .settings-grid { grid-template-columns: 1fr; }

    .form-actions { flex-direction: column; }
}
