/* ============================================
   Telegram Bot Portal - Custom CSS
   Dark theme with Telegram blue accent
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --tg-blue: #2AABEE;
  --tg-blue-dark: #1a94d8;
  --tg-blue-light: #e8f4fd;
  --sidebar-bg: #1a1f2e;
  --sidebar-hover: #252d3f;
  --sidebar-active: #2AABEE;
  --sidebar-text: #b0bec5;
  --sidebar-text-active: #ffffff;
  --sidebar-width: 260px;
  --content-bg: #f0f4f8;
  --card-bg: #ffffff;
  --text-primary: #1a1f2e;
  --text-secondary: #6b7a8d;
  --border-color: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--content-bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===== WRAPPER ===== */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  box-shadow: 4px 0 24px rgba(0,0,0,0.18);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #2AABEE 0%, #1a94d8 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(42,171,238,0.35);
}

.sidebar-header h6 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  margin: 0;
}

.sidebar-header span {
  font-size: 11px;
  color: var(--sidebar-text);
  font-weight: 400;
}

.sidebar nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.sidebar .nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #4a5568;
  padding: 16px 20px 6px;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: all 0.2s;
  position: relative;
  border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
  border-left-color: rgba(42,171,238,0.4);
}

.sidebar .nav-link.active {
  background: rgba(42,171,238,0.12);
  color: var(--tg-blue);
  border-left-color: var(--tg-blue);
}

.sidebar .nav-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer .nav-link {
  color: #ef4444;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  border-left: none;
}
.sidebar-footer .nav-link:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-left: none; }

/* ===== MAIN CONTENT ===== */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 64px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  display: none;
  background: none; border: none;
  font-size: 20px; color: var(--text-primary);
  cursor: pointer; padding: 4px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2AABEE, #1a94d8);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}

.main-content {
  padding: 24px;
  flex: 1;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  background: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
}

.card-header h5, .card-header .card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}

.stat-icon.blue   { background: rgba(42,171,238,0.12); color: var(--tg-blue); }
.stat-icon.green  { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,0.12);  color: var(--danger); }
.stat-icon.purple { background: rgba(139,92,246,0.12); color: #8b5cf6; }

.stat-info h3 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-info p {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin: 0;
}

/* ===== TABLES ===== */
.table-wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.table {
  margin: 0;
  font-size: 13.5px;
}

.table thead th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

/* ===== BADGES ===== */
.badge-tg     { background: rgba(42,171,238,0.12); color: var(--tg-blue); }
.badge-online { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-offline{ background: rgba(107,122,141,0.12); color: var(--text-secondary); }
.badge-paid   { background: rgba(139,92,246,0.12); color: #8b5cf6; }

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 4px rgba(16,185,129,0.5); }
.status-dot.offline { background: #94a3b8; }

/* ===== BUTTONS ===== */
.btn-tg {
  background: linear-gradient(135deg, #2AABEE 0%, #1a94d8 100%);
  color: #fff; border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-tg:hover { opacity: 0.9; transform: translateY(-1px); color: #fff; }
.btn-tg:active { transform: translateY(0); }

.btn-outline-tg {
  background: transparent;
  color: var(--tg-blue);
  border: 1.5px solid var(--tg-blue);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all 0.2s;
}
.btn-outline-tg:hover {
  background: var(--tg-blue); color: #fff;
}

/* ===== FORMS ===== */
.form-control, .form-select {
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px rgba(42,171,238,0.12);
  outline: none;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f1724 0%, #1a2a3f 50%, #0f1724 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #2AABEE, #1a94d8);
  border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff;
  box-shadow: 0 8px 24px rgba(42,171,238,0.4);
  margin-bottom: 16px;
}

.login-logo h4 {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.login-logo p {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  margin: 4px 0 0;
}

.login-card .form-label { color: rgba(255,255,255,0.6); }
.login-card .form-control {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: #fff;
}
.login-card .form-control::placeholder { color: rgba(255,255,255,0.3); }
.login-card .form-control:focus {
  background: rgba(255,255,255,0.08);
  border-color: var(--tg-blue);
  color: #fff;
}

.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: none;
  display: flex; align-items: center; gap: 8px;
}
.alert-danger  { background: rgba(239,68,68,0.1);  color: #ef4444; }
.alert-success { background: rgba(16,185,129,0.1); color: var(--success); }
.alert-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.alert-info    { background: rgba(42,171,238,0.1);  color: var(--tg-blue); }

/* ===== TABS ===== */
.nav-tabs {
  border-bottom: 2px solid var(--border-color);
  gap: 4px;
}
.nav-tabs .nav-link {
  border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-secondary);
  font-weight: 500; font-size: 13px;
  padding: 10px 16px;
  border-radius: 0;
  transition: all 0.2s;
}
.nav-tabs .nav-link:hover { color: var(--tg-blue); }
.nav-tabs .nav-link.active {
  color: var(--tg-blue);
  border-bottom-color: var(--tg-blue);
  background: transparent;
  font-weight: 600;
}

/* ===== MODAL ===== */
.modal-content {
  border-radius: var(--radius);
  border: none;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
}
.modal-header .modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--border-color); padding: 12px 20px; }

/* ===== SEARCH INPUT ===== */
.search-input-wrap {
  position: relative;
}
.search-input-wrap i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-secondary); font-size: 14px; pointer-events: none;
}
.search-input-wrap .form-control { padding-left: 36px; }

/* ===== DROPDOWN ACTIONS ===== */
.action-btn {
  background: none; border: none;
  width: 30px; height: 30px;
  border-radius: 6px; cursor: pointer;
  color: var(--text-secondary); font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.action-btn:hover { background: var(--content-bg); color: var(--text-primary); }
.action-btn.red:hover { background: rgba(239,68,68,0.1); color: var(--danger); }
.action-btn.blue:hover { background: rgba(42,171,238,0.1); color: var(--tg-blue); }

/* ===== PAGINATION ===== */
.pagination .page-link {
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
  font-size: 13px;
  padding: 6px 12px;
}
.pagination .page-item.active .page-link {
  background: var(--tg-blue); border-color: var(--tg-blue); color: #fff;
}
.pagination .page-link:hover { background: var(--tg-blue-light); color: var(--tg-blue); }

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
  position: relative;
  width: 44px; height: 24px; display: inline-block;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: #d1d5db; border-radius: 24px; cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider:before {
  content: '';
  position: absolute; width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--tg-blue); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .content {
    margin-left: 0;
  }
  .topbar-toggle { display: block; }
  .main-content { padding: 16px; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
  .sidebar-overlay.show { display: block; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== UTILITIES ===== */
.text-tg   { color: var(--tg-blue) !important; }
.bg-tg     { background: var(--tg-blue) !important; }
.fw-600    { font-weight: 600; }
.gap-8     { gap: 8px; }
.d-flex-center { display: flex; align-items: center; justify-content: center; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; flex-shrink: 0;
  color: #fff;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h6 { font-size: 15px; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ===== PROGRESS BAR ===== */
.progress {
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
}
.progress-bar {
  background: linear-gradient(90deg, var(--tg-blue), #1a94d8);
  border-radius: 3px;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 9999;
}
.toast {
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 280px;
}
