/* Leo2API admin overrides on top of Tabler (MIT) — dark theme */
:root {
  --leo-accent: #2cc7aa;
  --leo-accent-2: #33a1ff;
  --leo-danger: #e16068;
  --leo-warn: #f0c040;
  --leo-muted: #a8bfd8;
  --leo-dim: #7f96ad;
}

body {
  background: radial-gradient(circle at 15% 0%, #132a42 0%, #0b131e 45%, #080d14 100%);
  background-attachment: fixed;
}

/* ── Navbar ─────────────────────────────── */
.leo-navbar {
  background: rgba(10, 18, 28, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(142, 181, 221, 0.14);
}
.leo-brand-mark {
  font-size: 20px;
  filter: drop-shadow(0 0 8px rgba(44, 199, 170, 0.5));
}
.leo-brand-sub {
  color: var(--leo-muted);
  font-size: 13px;
  margin-left: 8px;
}
.leo-nav-link {
  color: var(--leo-muted) !important;
  border-radius: 8px;
  padding: 0.5rem 0.75rem !important;
}
.leo-nav-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.06);
}

/* ── Tabs ───────────────────────────────── */
.leo-tabs .nav-link,
.leo-config-tabs .nav-link {
  color: var(--leo-muted);
  border: 1px solid rgba(142, 181, 221, 0.18);
  background: rgba(13, 25, 38, 0.5);
  border-radius: 10px;
  padding: 0.5rem 1.1rem;
  font-weight: 600;
}
.leo-tabs .nav-link.active,
.leo-config-tabs .nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(44, 199, 170, 0.9), rgba(51, 161, 255, 0.85));
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(44, 199, 170, 0.28);
}

/* Tab panes */
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.config-cat-pane { display: none; }
.config-cat-pane.active { display: block; }

/* ── Cards ──────────────────────────────── */
.card {
  background: rgba(13, 25, 38, 0.78);
  border: 1px solid rgba(142, 181, 221, 0.16);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.card-header {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(142, 181, 221, 0.12);
}

/* ── Status badges ──────────────────────── */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
}
.status-active { background: rgba(44, 199, 170, 0.14); color: #4de2c4; border-color: rgba(44, 199, 170, 0.35); }
.status-disabled { background: rgba(127, 150, 173, 0.14); color: #a8bfd8; border-color: rgba(127, 150, 173, 0.3); }
.status-exhausted { background: rgba(240, 192, 64, 0.12); color: #ffca58; border-color: rgba(240, 192, 64, 0.3); }
.status-invalid { background: rgba(225, 96, 104, 0.14); color: #ffb4bc; border-color: rgba(225, 96, 104, 0.35); }
.status-error { background: rgba(225, 96, 104, 0.14); color: #ffb4bc; border-color: rgba(225, 96, 104, 0.35); }
.status-abnormal { background: rgba(225, 96, 104, 0.14); color: #ffb4bc; border-color: rgba(225, 96, 104, 0.35); }
.status-pending { background: rgba(51, 161, 255, 0.14); color: #7cc0ff; border-color: rgba(51, 161, 255, 0.35); }
.status-temporary_unavailable { background: rgba(240, 192, 64, 0.12); color: #ffca58; border-color: rgba(240, 192, 64, 0.3); }
.status-reserved { background: rgba(51, 161, 255, 0.14); color: #7cc0ff; border-color: rgba(51, 161, 255, 0.35); }
.status-succeeded { background: rgba(44, 199, 170, 0.14); color: #4de2c4; border-color: rgba(44, 199, 170, 0.35); }

/* ── Token row controls ─────────────────── */
.switch-btn {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(127, 150, 173, 0.35);
  background: rgba(127, 150, 173, 0.15);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.switch-btn.on { background: rgba(44, 199, 170, 0.55); border-color: rgba(44, 199, 170, 0.6); }
.switch-btn.off { background: rgba(127, 150, 173, 0.12); }
.switch-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch-btn.on .switch-knob { left: 20px; }
.switch-text { margin-left: 8px; font-size: 12px; color: var(--leo-muted); }

.action-mini {
  background: rgba(51, 161, 255, 0.12);
  color: #7cc0ff;
  border: 1px solid rgba(51, 161, 255, 0.3);
  border-radius: 8px;
  padding: 3px 9px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 4px;
  white-space: nowrap;
}
.action-mini:hover { background: rgba(51, 161, 255, 0.25); }
.action-mini.danger { background: rgba(225, 96, 104, 0.12); color: #ffb4bc; border-color: rgba(225, 96, 104, 0.3); }
.action-mini.danger:hover { background: rgba(225, 96, 104, 0.25); }
.action-mini:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Logs ───────────────────────────────── */
.log-row-running td { background: rgba(51, 161, 255, 0.05) !important; }
.log-state-btn {
  background: rgba(44, 199, 170, 0.12);
  color: #4de2c4;
  border: 1px solid rgba(44, 199, 170, 0.3);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}
.log-state-btn.failed {
  background: rgba(225, 96, 104, 0.12);
  color: #ffb4bc;
  border-color: rgba(225, 96, 104, 0.3);
}
.log-prompt-btn {
  background: none;
  border: none;
  color: var(--leo-accent-2);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  text-align: left;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.log-prompt-btn:hover { text-decoration: underline; }
.preview-btn { cursor: pointer; }

.stats-grid .stat-value { color: #e7f1fd; }
.logs-pagination { align-items: center; }

/* ── Task report ────────────────────────── */
.task-report-status { font-weight: 600; color: var(--leo-accent); }
.task-report-progress-bar { background: linear-gradient(90deg, var(--leo-accent), var(--leo-accent-2)); }
.task-report-items { max-height: 320px; overflow-y: auto; font-size: 13px; }
.task-report-current { color: var(--leo-muted); font-size: 13px; }
.refresh-status { color: var(--leo-muted); font-size: 13px; }
.task-report-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(127, 150, 173, 0.14);
  color: var(--leo-muted);
}
.task-report-badge.success, .task-report-badge.succeeded { background: rgba(44, 199, 170, 0.14); color: #4de2c4; }
.task-report-badge.failed, .task-report-badge.error { background: rgba(225, 96, 104, 0.14); color: #ffb4bc; }
.task-report-badge.pending, .task-report-badge.running { background: rgba(51, 161, 255, 0.14); color: #7cc0ff; }

/* ── Dialogs / modals ───────────────────── */
.dialog-modal,
.preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1050;
  overflow-y: auto;
  padding: 6vh 16px 40px;
}
.dialog-modal.open,
.preview-modal.open { display: flex; }
.dialog-card {
  width: 100%;
  max-width: 640px;
  background: #101b2b;
  border: 1px solid rgba(142, 181, 221, 0.2);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  padding: 22px;
}
.preview-modal-dialog {
  width: 100%;
  max-width: 860px;
  background: #101b2b;
  border: 1px solid rgba(142, 181, 221, 0.2);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  padding: 22px;
}
.preview-content video, .preview-content img {
  max-width: 100%;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}
.preview-close { float: right; }
.error-detail-content, .prompt-detail-content {
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 13px;
  color: var(--leo-muted);
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 12px;
  max-height: 420px;
  overflow-y: auto;
  margin-top: 10px;
}

/* ── Toast ──────────────────────────────── */
.leo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #101b2b;
  border: 1px solid rgba(142, 181, 221, 0.25);
  color: #e7f1fd;
  padding: 12px 22px;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 1200;
  font-size: 14px;
  max-width: 80vw;
}
.leo-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.leo-toast.success { border-color: rgba(44, 199, 170, 0.5); }
.leo-toast.error { border-color: rgba(225, 96, 104, 0.5); }

/* ── Misc ───────────────────────────────── */
.help { color: var(--leo-muted); }
.msg { color: var(--leo-muted); font-size: 13px; }
.leo-pre {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  color: var(--leo-muted);
}
.leo-hint { color: var(--leo-warn); }
.leo-footer { border-top: 1px solid rgba(142, 181, 221, 0.1); }
.leo-footer a { color: var(--leo-accent-2); text-decoration: none; }
.leo-footer a:hover { text-decoration: underline; }

.empty-state { color: var(--leo-dim); }

/* Tabler form-check inside label needs pointer */
.checkbox-label { cursor: pointer; user-select: none; }

/* ── JS-injected config inputs (built with .input-text / plain label / .help) ── */
.input-text {
  display: block;
  width: 100%;
  padding: 0.4375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.4285714286;
  color: var(--tblr-body-color, #e7f1fd);
  background-color: var(--tblr-bg-forms, #0b1522);
  background-clip: padding-box;
  border: var(--tblr-border-width, 1px) solid var(--tblr-border-color, #2a3b52);
  border-radius: var(--tblr-border-radius, 8px);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.input-text:focus {
  border-color: #3f6f9e;
  box-shadow: 0 0 0 0.25rem rgba(51, 161, 255, 0.15);
  outline: none;
}
.input-select {
  background-color: var(--tblr-bg-forms, #0b1522);
  color: var(--tblr-body-color, #e7f1fd);
}
.form-group > label:not(.form-label) {
  display: inline-block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--tblr-body-color, #e7f1fd);
}
.form-group .form-label { margin-bottom: 0.25rem; }

/* Table tweaks */
.table-vcenter td { vertical-align: middle; }
.card-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

/* Responsive */
@media (max-width: 768px) {
  .leo-brand-sub { display: none !important; }
  .card-header { align-items: flex-start; }
}
