/* ── TravelBests Panel — White Theme ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --bg-sidebar-hover: #334155;
  --bg-sidebar-active: #3b82f6;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #1e293b;
  --text-light: #475569;
  --text-muted: #94a3b8;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;
  --primary: #3b82f6;
  --primary-light: #eff6ff;
  --primary-dark: #2563eb;
  --success: #22c55e;
  --success-light: #f0fdf4;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #06b6d4;
  --info-light: #ecfeff;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 240px;
  background: var(--bg-sidebar); color: var(--text-sidebar);
  display: flex; flex-direction: column; z-index: 200;
  transition: transform .2s;
}
.sidebar-logo {
  padding: 24px 20px; font-size: 18px; font-weight: 700;
  color: #fff; letter-spacing: -0.3px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo span { color: var(--primary); }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-sidebar); font-size: 13.5px; font-weight: 500;
  transition: all .15s;
}
.sidebar-nav a:hover { background: var(--bg-sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--bg-sidebar-active); color: var(--text-sidebar-active); }
.sidebar-nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 8px 4px; }
.sidebar-bottom {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px; color: var(--text-muted);
}
.sidebar-bottom a { color: var(--text-sidebar); }

/* ── Main Content ────────────────────────────────────────────────────────── */
.main { margin-left: 240px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  padding: 12px 28px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
}
.topbar-title { font-size: 18px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-light); }
.content { padding: 24px 28px; max-width: 1400px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-card .stat-icon svg { width: 20px; height: 20px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.icon-blue { background: var(--primary-light); color: var(--primary); }
.icon-green { background: var(--success-light); color: var(--success); }
.icon-yellow { background: var(--warning-light); color: var(--warning); }
.icon-red { background: var(--danger-light); color: var(--danger); }

/* ── Grid Layouts ────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.grid-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }
.grid-2-1 { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; margin-bottom: 24px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: #16a34a; }
.badge-yellow { background: var(--warning-light); color: #d97706; }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: var(--bg-card); color: var(--text);
  transition: all .15s;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border: none; background: none; cursor: pointer; color: var(--text-muted); }
.btn-icon:hover { color: var(--text); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-light); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; color: var(--text);
  background: var(--bg-card); outline: none; transition: border-color .15s;
  font-family: inherit;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-section { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light); }
.form-section-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 12px; }

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 20px; padding: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.filter-bar .form-control { width: auto; min-width: 180px; }
.filter-bar select.form-control { min-width: 140px; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; font-size: 13px; color: var(--text-muted);
}
.pagination-pages { display: flex; gap: 4px; }
.pagination-pages a, .pagination-pages span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; color: var(--text-light);
}
.pagination-pages a:hover { background: #f8fafc; text-decoration: none; }
.pagination-pages .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Notes Timeline ──────────────────────────────────────────────────────── */
.note-item {
  padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.note-item:last-child { border-bottom: none; }
.note-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.note-meta strong { color: var(--text-light); }
.note-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.note-actions { float: right; }

/* ── PDF List ────────────────────────────────────────────────────────────── */
.pdf-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.pdf-item:last-child { border-bottom: none; }
.pdf-icon { color: var(--danger); flex-shrink: 0; }
.pdf-info { flex: 1; }
.pdf-name { font-size: 13px; font-weight: 500; color: var(--text); }
.pdf-date { font-size: 11px; color: var(--text-muted); }

/* ── Upload Area ─────────────────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-area input[type="file"] { display: none; }

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 400px; padding: 40px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 24px; font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo span { color: var(--primary); }
.login-error {
  background: var(--danger-light); color: var(--danger); padding: 10px 14px;
  border-radius: var(--radius); font-size: 13px; margin-bottom: 16px;
}

/* ── Detail Page ─────────────────────────────────────────────────────────── */
.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.detail-header h1 { font-size: 22px; font-weight: 700; }
.detail-actions { display: flex; gap: 8px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-item label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.info-item p { font-size: 14px; color: var(--text); margin-top: 2px; }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px;
  font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--success-light); color: #16a34a; border: 1px solid #bbf7d0; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-info { background: var(--info-light); color: #0891b2; border: 1px solid #a5f3fc; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3-1, .grid-2-1 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-control, .filter-bar select.form-control { width: 100%; min-width: unset; }
}

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ── System Page ─────────────────────────────────────────────────────────── */
.bot-status-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-card);
  margin-bottom: 20px; box-shadow: var(--shadow);
}
.bot-indicator { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.bot-indicator.running { background: var(--success); box-shadow: 0 0 0 4px rgba(34,197,94,0.2); animation: pulse 2s infinite; }
.bot-indicator.stopped { background: var(--danger); }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 4px rgba(34,197,94,0.2)} 50%{box-shadow:0 0 0 8px rgba(34,197,94,0.08)} }
.bot-status-info { flex:1; }
.bot-status-name { font-weight: 600; font-size: 14px; }
.bot-status-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.bot-actions { display: flex; gap: 8px; }

.log-box {
  background: #0f172a; color: #94a3b8; font-family: 'Courier New', monospace;
  font-size: 11.5px; line-height: 1.6; border-radius: var(--radius);
  padding: 14px; height: 320px; overflow-y: auto;
  border: 1px solid #1e293b;
}
.log-box .log-line { white-space: pre-wrap; word-break: break-all; }
.log-box .log-line.err { color: #f87171; }
.log-box .log-line.warn { color: #fbbf24; }
.log-box .log-line.ok { color: #4ade80; }

.proxy-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.proxy-socks5 { background: #ede9fe; color: #7c3aed; }
.proxy-http   { background: var(--primary-light); color: var(--primary); }
.proxy-https  { background: var(--success-light); color: #16a34a; }

.attempt-result-success { color: var(--success); font-weight: 600; }
.attempt-result-rate_limited { color: var(--warning); font-weight: 600; }
.attempt-result-cf_fail { color: var(--danger); font-weight: 600; }
.attempt-result-error { color: var(--text-muted); }
.attempt-result-account_restricted { color: #7c3aed; font-weight: 600; }

.chart-wrapper { position: relative; height: 180px; }

/* toggle switch */
.toggle-switch { position:relative; display:inline-block; width:42px; height:24px; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-slider { position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background:#cbd5e1; border-radius:24px; transition:.3s; }
.toggle-slider:before { position:absolute; content:""; height:18px; width:18px; left:3px; bottom:3px; background:#fff; border-radius:50%; transition:.3s; }
input:checked + .toggle-slider { background: var(--success); }
input:checked + .toggle-slider:before { transform: translateX(18px); }

.site-select-row { display:flex; gap:8px; align-items:center; }
.site-select-row select { flex:1; }
