@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --sidebar-width: 272px;
  --sidebar-bg: rgba(15, 18, 32, 0.92);
  --main-bg: #080b14;
  --card-bg: rgba(22, 28, 45, 0.88);
  --card-bg-hover: rgba(28, 36, 58, 0.95);
  --border-color: rgba(255, 255, 255, 0.07);
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --text-muted: rgba(255, 255, 255, 0.52);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--main-bg);
  color: #eef2ff;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.18), transparent 28%),
    radial-gradient(circle at 85% 0%, rgba(139, 92, 246, 0.12), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(16, 185, 129, 0.08), transparent 30%);
  pointer-events: none;
  z-index: 0;
}

.admin-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px var(--accent-glow);
  font-size: 1.25rem;
  color: #fff;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-title {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.sidebar-brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-section {
  padding: 18px 16px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav {
  padding: 0 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: all 0.18s ease;
  font-weight: 500;
  font-size: 0.92rem;
  position: relative;
  z-index: 1;
}

.sidebar-link i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  transform: translateX(2px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(139, 92, 246, 0.14));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  background: var(--sidebar-bg);
}

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px 32px 40px;
  min-width: 0;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.92rem;
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: visible;
}

.glass-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
}

.glass-card .card-body {
  padding: 20px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px;
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.28);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  font-size: 1.1rem;
}

.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.stat-icon.red { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.table-wrap {
  border-radius: var(--radius);
  overflow: hidden;
}

.table {
  margin-bottom: 0;
  --bs-table-color: #eef2ff;
  --bs-table-bg: transparent;
  --bs-table-hover-bg: rgba(255, 255, 255, 0.03);
  --bs-table-border-color: var(--border-color);
}

.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.18);
}

.table tbody td {
  padding: 14px 16px;
  vertical-align: middle;
  font-size: 0.88rem;
}

.badge-soft {
  padding: 0.35em 0.65em;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-soft.success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-soft.danger { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-soft.secondary { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.65); }
.badge-soft.info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-soft.warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.form-control,
.form-select,
select.form-control {
  background-color: #161d30;
  border: 1px solid var(--border-color);
  color: #eef2ff;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23a5b4fc'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px 10px;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-select option,
.form-control option,
select option {
  background-color: #1a2236;
  color: #eef2ff;
  padding: 8px;
}

.form-control:focus,
.form-select:focus {
  background-color: #1c2438;
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
  color: #eef2ff;
  outline: none;
}

.form-control::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.form-label {
  font-weight: 600;
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.form-text {
  color: var(--text-muted) !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  font-weight: 700;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  box-shadow: 0 8px 20px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.08);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.btn-outline-light {
  border-color: var(--border-color);
  color: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.nav-pills .nav-link {
  color: var(--text-muted);
  border-radius: 10px;
  font-weight: 600;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border: none;
  background: transparent;
}

.nav-pills .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-pills .nav-link.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.18));
  color: #fff;
}

.info-banner {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.82);
}

.info-banner i {
  color: #60a5fa;
  margin-right: 8px;
}

.hidden {
  display: none !important;
}

code {
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.12);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85em;
}

.modal-backdrop {
  z-index: 1050 !important;
}

.modal {
  z-index: 1055 !important;
}

.modal.show {
  pointer-events: auto;
}

.modal-content {
  background: #12182a !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  pointer-events: auto;
  overflow: visible;
}

.modal-dialog {
  pointer-events: auto;
}

.modal-body {
  overflow: visible;
}

.btn-close {
  filter: invert(1) grayscale(1);
  opacity: 0.7;
}

.btn-close:hover {
  opacity: 1;
}

.alert {
  border-radius: 10px;
}

.bot-control-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.bot-control-panel .badge-soft.running {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.bot-control-panel .badge-soft.stopped {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
}

.bot-log-panel {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.bot-log-view {
  background: #0a0e17;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  height: 280px;
  overflow-y: auto;
  padding: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
}

.bot-log-line {
  display: flex;
  gap: 0.65rem;
  padding: 0.15rem 0;
  word-break: break-word;
}

.bot-log-time {
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.bot-log-msg {
  color: rgba(255, 255, 255, 0.82);
}

.bot-log-line.info .bot-log-msg {
  color: #dbeafe;
}

.bot-log-line.warn .bot-log-msg {
  color: #fcd34d;
}

.bot-log-line.error .bot-log-msg {
  color: #fca5a5;
}

.bot-log-line.system .bot-log-msg {
  color: #86efac;
}

.bot-log-empty {
  text-align: center;
  padding: 2rem 1rem;
}

.admin-dialog-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.admin-dialog-content .modal-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.lang-switch-btn {
  font-size: 0.82rem;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-wrapper {
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color) !important;
  border-radius: 20px !important;
  backdrop-filter: blur(16px);
}

.login-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 30px var(--accent-glow);
  font-size: 1.8rem;
  color: #fff;
}

.refresh-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
}

@media (max-width: 991px) {
  .admin-sidebar {
    width: 78px;
  }

  .sidebar-brand-text,
  .sidebar-section,
  .sidebar-link span,
  .sidebar-footer .btn span {
    display: none;
  }

  .admin-main {
    margin-left: 78px;
    padding: 18px;
  }

  .sidebar-brand {
    justify-content: center;
    padding: 18px 10px;
  }

  .sidebar-link {
    justify-content: center;
    padding: 12px;
  }
}
