/* MaxBot Admin — custom styles */
:root {
  --sidebar-bg:    #0f1117;
  --sidebar-w:     240px;
  --accent:        #4f8ef7;
  --accent-hover:  #3d7de8;
  --topbar-h:      56px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: #f0f2f5; font-family: 'Segoe UI', system-ui, sans-serif; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
#layout { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform .25s;
}

.sidebar-brand {
  padding: 18px 20px 14px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  border-bottom: 1px solid #1e2130;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sidebar-brand .bot-icon { font-size: 1.35rem; }

.sidebar-nav { padding: 10px 0; flex: 1; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #8b93a7;
  text-decoration: none;
  font-size: .875rem;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.sidebar-nav a:hover  { background: #1a1e2b; color: #c8cdd8; }
.sidebar-nav a.active { background: #1a1e2b; color: #fff; border-left-color: var(--accent); }
.sidebar-nav a i      { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid #1e2130;
  flex-shrink: 0;
}
.sidebar-footer a {
  color: #5a6070;
  text-decoration: none;
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-footer a:hover { color: #e05a5a; }

/* ── Main ─────────────────────────────────────────────────────────────────── */
#main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e4e6ed;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; color: #1a1d23; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: .82rem; color: #6b7280; }
.topbar-right a { color: #6b7280; text-decoration: none; }
.topbar-right a:hover { color: #e05a5a; }

/* Hamburger (mobile only) */
.burger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #1a1d23;
  cursor: pointer;
  padding: 4px 8px;
  margin-right: 8px;
}

/* ── Content ──────────────────────────────────────────────────────────────── */
.content { padding: 24px; flex: 1; min-width: 0; }

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .18s, transform .18s;
}
a.stat-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  transform: translateY(-2px);
  color: inherit;
}

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #eff4ff; color: #4f8ef7; }
.stat-icon.green  { background: #edfbf4; color: #22c55e; }
.stat-icon.purple { background: #f5f0ff; color: #8b5cf6; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-icon.teal   { background: #e8fdfb; color: #14b8a6; }
.stat-icon.red    { background: #fff1f2; color: #ef4444; }

.stat-value { font-size: 1.65rem; font-weight: 700; color: #1a1d23; line-height: 1; }
.stat-label { font-size: .78rem; color: #6b7280; margin-top: 4px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.card-header {
  background: none;
  border-bottom: 1px solid #f0f2f5;
  padding: 14px 18px;
  font-weight: 600;
  font-size: .9rem;
  color: #1a1d23;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table      { margin: 0; min-width: 600px; }

.table thead th {
  background: #f8f9fc;
  border-bottom: 1px solid #e8eaf0;
  color: #6b7280;
  font-size: .73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 9px 14px;
  white-space: nowrap;
}
.table tbody td {
  padding: 9px 14px;
  vertical-align: middle;
  font-size: .855rem;
  border-bottom: 1px solid #f3f4f8;
  color: #374151;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td      { background: #fafbff; }

/* Кликабельные строки платежей */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f0f5ff !important; }

/* ── Plan badges ─────────────────────────────────────────────────────────── */
.plan-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 600;
  white-space: nowrap;
}
.plan-free    { background: #f3f4f6; color: #6b7280; }
.plan-start   { background: #edfbf4; color: #16a34a; }
.plan-pro     { background: #eff4ff; color: #2563eb; }
.plan-premium { background: #fef9c3; color: #b45309; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary        { background: var(--accent);       border-color: var(--accent); }
.btn-primary:hover  { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-xs { padding: 2px 8px; font-size: .73rem; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f1117 0%, #1a1e2b 100%);
  padding: 16px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo  { font-size: 2rem; text-align: center; margin-bottom: 6px; }
.login-title { text-align: center; font-weight: 700; font-size: 1.2rem; color: #1a1d23; margin-bottom: 4px; }
.login-sub   { text-align: center; color: #6b7280; font-size: .84rem; margin-bottom: 28px; }

/* ── Log viewer ───────────────────────────────────────────────────────────── */
.log-box {
  background: #0f1117;
  color: #a8b3c8;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: .76rem;
  line-height: 1.6;
  padding: 14px;
  border-radius: 8px;
  max-height: 520px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-box .log-error   { color: #ef4444; }
.log-box .log-warning { color: #f59e0b; }
.log-box .log-info    { color: #60a5fa; }

/* ── Search ───────────────────────────────────────────────────────────────── */
.search-form { display: flex; gap: 8px; flex-wrap: wrap; }
.search-form input { max-width: 280px; min-width: 160px; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination .page-link { border-radius: 6px !important; margin: 0 2px; color: var(--accent); }
.pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); }

/* ── Overlay (mobile) ─────────────────────────────────────────────────────── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}

/* ── Detail page ──────────────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.detail-grid dt {
  padding: 10px 18px;
  font-size: .8rem;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid #f3f4f8;
}
.detail-grid dd {
  padding: 10px 18px;
  font-size: .875rem;
  color: #1a1d23;
  margin: 0;
  border-bottom: 1px solid #f3f4f8;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  #sidebar-overlay.open {
    display: block;
  }
  #main {
    margin-left: 0;
  }
  .burger-btn {
    display: block;
  }
  .content {
    padding: 16px;
  }
  .topbar {
    padding: 0 16px;
  }
  .stat-value {
    font-size: 1.4rem;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-grid dt, .detail-grid dd {
    padding: 8px 14px;
  }
  .detail-grid dt {
    border-bottom: none;
    padding-bottom: 2px;
  }
}
