/* ===== GCP SOCKS5 Proxy Manager — giao dien toi ===== */
:root {
  --bg: #0d1117;
  --bg-2: #131a24;
  --panel: #161d29;
  --panel-2: #1b2330;
  --border: #232c3b;
  --border-soft: #1e2635;
  --text: #e6edf6;
  --muted: #8b98ad;
  --primary: #3b82f6;
  --primary-dim: #1f4ea8;
  --success: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }
.flex1 { flex: 1; }
.row { display: flex; align-items: flex-start; }
.row.gap { gap: 12px; }
.end { display: flex; align-items: flex-end; }
a { color: var(--primary); text-decoration: none; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--border); }
.brand-logo { font-size: 22px; width: 38px; height: 38px; display: grid; place-items: center; background: var(--panel-2); border-radius: 10px; }
.brand-name { font-weight: 700; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav { padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; color: var(--muted);
  cursor: pointer; font-weight: 500; user-select: none;
}
.nav-item .ico { width: 16px; text-align: center; opacity: .9; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(59,130,246,.18), transparent); color: #fff; box-shadow: inset 2px 0 0 var(--primary); }
.nav-badge { margin-left: auto; background: var(--panel-2); color: var(--muted); font-size: 11px; padding: 1px 7px; border-radius: 20px; }
.nav-item.active .nav-badge { background: var(--primary-dim); color: #dbe9ff; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.conn-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-gray { background: #4b5563; }
.dot-green { background: var(--success); box-shadow: 0 0 8px rgba(34,197,94,.6); }
.dot-red { background: var(--danger); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  background: rgba(13,17,23,.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 19px; }
.crumb { font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.project-chip { background: var(--panel); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; font-size: 12px; }

.view { padding: 22px 24px 60px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: .12s ease; font-family: inherit;
}
.btn:hover { background: var(--panel-2); border-color: #2e3a4d; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #2f74e8; border-color: #2f74e8; }
.btn-danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35); color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 11px; border-radius: 8px; font-size: 13px; width: 100%;
  font-family: inherit; outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
textarea.input { resize: vertical; line-height: 1.45; }
select.input { cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0; cursor: pointer; }
input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .input { width: auto; }
.toolbar .search { min-width: 260px; }

/* ---------- Panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border-soft); }
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-body { padding: 16px; }
.panel-body.no-pad { padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } .layout { grid-template-columns: 68px 1fr; } .brand-name, .brand-sub, .nav-item span:not(.ico):not(.nav-badge) { display: none; } }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--primary); opacity: .8; }
.stat-card.success::after { background: var(--success); }
.stat-card.danger::after { background: var(--danger); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.2; margin: 4px 0; }
.stat-foot { font-size: 11.5px; color: var(--muted); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 11px 14px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); border-bottom: 1px solid var(--border);
  background: var(--panel-2); white-space: nowrap; font-weight: 600;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr:hover { background: rgba(59,130,246,.05); }
.table tbody tr.selected { background: rgba(59,130,246,.09); }
.table.compact td, .table.compact th { padding: 8px 14px; }
.w-check { width: 38px; }
.w-actions { width: 1%; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px !important; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--muted); }
.actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 13px;
  display: inline-grid; place-items: center; transition: .12s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { color: #fca5a5; border-color: rgba(239,68,68,.4); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-green { background: rgba(34,197,94,.13); color: #6ee7a0; }
.badge-red { background: rgba(239,68,68,.13); color: #fca5a5; }
.badge-gray { background: rgba(139,152,173,.13); color: var(--muted); }
.badge-blue { background: rgba(59,130,246,.14); color: #93c5fd; }
.badge-amber { background: rgba(245,158,11,.14); color: #fcd34d; }

.copyable { cursor: pointer; font-family: var(--mono); font-size: 12.5px; border-bottom: 1px dashed transparent; }
.copyable:hover { border-bottom-color: var(--muted); color: #fff; }
.secret { font-family: var(--mono); font-size: 12.5px; letter-spacing: .5px; }

/* ---------- Steps / lists ---------- */
.steps { margin: 0; padding-left: 20px; color: var(--muted); line-height: 2; }
.steps b { color: var(--text); }

.task-list { display: flex; flex-direction: column; max-height: 460px; overflow-y: auto; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.task-row:hover { background: rgba(59,130,246,.05); }
.task-title { font-weight: 500; }
.task-meta { font-size: 11.5px; color: var(--muted); }

/* ---------- Tabs (chon cach ket noi) ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 13px; font-size: 13px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-bottom-color: var(--primary); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 40;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px; display: none; box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.dropdown-menu.open { display: block; }
.dropdown-menu a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); font-size: 12.5px; cursor: pointer; font-family: var(--mono); }
.dropdown-menu a:hover { background: var(--panel); }

/* ---------- Overlay / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(3,7,14,.72); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 720px; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.modal-sm { max-width: 520px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { background: transparent; border: 0; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 20px; max-height: 65vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ---------- Login ---------- */
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 32px; width: 340px; text-align: center; }
.login-logo { font-size: 40px; }
.login-card h2 { margin: 8px 0 4px; }
.login-card p { margin: 0 0 18px; font-size: 13px; }
.login-card input { margin-bottom: 12px; }
.form-error { color: #fca5a5; font-size: 12.5px; margin-top: 10px; min-height: 16px; }

/* ---------- Result box ---------- */
.result-box {
  background: #0a0e14; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-family: var(--mono); font-size: 12px; color: #9fb3cc;
  white-space: pre-wrap; word-break: break-word; margin-top: 12px; max-height: 200px; overflow: auto;
}

/* ---------- Log drawer ---------- */
.drawer {
  position: fixed; right: 20px; bottom: 20px; width: min(680px, calc(100vw - 40px));
  background: #0a0e14; border: 1px solid var(--border); border-radius: 12px; z-index: 90;
  box-shadow: 0 20px 50px rgba(0,0,0,.65); display: flex; flex-direction: column; overflow: hidden;
}
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--panel-2); border-bottom: 1px solid var(--border); font-size: 13px; }
.drawer-status { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); animation: pulse 1.2s infinite; }
.drawer-status.done { background: var(--success); animation: none; }
.drawer-status.error { background: var(--danger); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.drawer-body {
  margin: 0; padding: 12px; font-family: var(--mono); font-size: 12px; line-height: 1.6;
  color: #93a7bf; height: 300px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.drawer.min .drawer-body { display: none; }
.drawer-body .ok { color: #6ee7a0; }
.drawer-body .err { color: #fca5a5; }
.drawer-body .hl { color: #93c5fd; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  padding: 11px 15px; border-radius: 8px; font-size: 13px; min-width: 240px; max-width: 380px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: slideIn .18s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3444; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a4658; }
