/* Admin Panel specific styles */
:root {
  --admin-sidebar: #1e1e2d;
  --admin-sidebar-text: #a2a3b7;
  --admin-sidebar-active: #ffffff;
  --admin-bg: #f3f6f9;
  --admin-card: #ffffff;
  --admin-border: #ebedf3;
  --admin-primary: #3699ff;
  --admin-danger: #f64e60;
  --admin-success: #1bc5bd;
  --admin-warning: #ffa800;
  --admin-text-dark: #3f4254;
  --admin-text-muted: #b5b5c3;
}

.admin-body {
  margin: 0;
  padding: 0;
  background-color: var(--admin-bg);
  font-family: 'Nunito', sans-serif;
  color: var(--admin-text-dark);
  overflow: hidden;
}

/* Login Screen */
.admin-login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, var(--admin-sidebar) 0%, #11111a 100%);
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header .logo {
  font-size: 28px;
  font-weight: 900;
  color: var(--admin-primary);
  margin-bottom: 5px;
}

.login-header p {
  color: var(--admin-text-muted);
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--admin-text-dark);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: var(--admin-primary);
}

.login-btn {
  width: 100%;
  background: var(--admin-primary);
  color: white;
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}

.error-text {
  color: var(--admin-danger);
  font-size: 13px;
  text-align: center;
  margin-top: 15px;
  min-height: 20px;
}

/* App Layout */
.admin-app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--admin-sidebar);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-header .logo {
  color: white;
  font-size: 20px;
  font-weight: 900;
}

.mobile-close {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

.nav-links {
  list-style: none;
  padding: 20px 0;
  margin: 0;
  flex: 1;
}

.nav-links li {
  padding: 12px 25px;
  color: var(--admin-sidebar-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.nav-links li:hover, .nav-links li.active {
  background: rgba(255,255,255,0.05);
  color: var(--admin-sidebar-active);
}

.nav-links li.active {
  border-left: 3px solid var(--admin-primary);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.logout-btn {
  width: 100%;
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.logout-btn:hover {
  background: var(--admin-danger);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Important for preventing flex children from overflowing */
}

.topbar {
  background: white;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.05);
  z-index: 10;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  margin-right: 15px;
  cursor: pointer;
  color: var(--admin-text-dark);
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  flex: 1;
}

.admin-badge {
  background: rgba(246, 78, 96, 0.1);
  color: var(--admin-danger);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--admin-card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--admin-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card.clickable {
  cursor: pointer;
}
.stat-card.clickable:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.stat-card.highlight {
  background: var(--admin-primary);
  color: white;
  border-color: var(--admin-primary);
}

.stat-card.highlight .stat-title,
.stat-card.highlight .stat-sub {
  color: rgba(255,255,255,0.8);
}

.stat-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 5px;
}

.stat-sub {
  font-size: 12px;
  color: var(--admin-text-muted);
}

/* Tables */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  gap: 10px;
}

.table-toolbar input {
  flex: 1;
  max-width: 300px;
  padding: 8px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 4px;
}

.btn-outline {
  background: white;
  border: 1px solid var(--admin-border);
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  color: var(--admin-text-dark);
}

.table-responsive {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.admin-table th {
  text-align: left;
  padding: 15px;
  border-bottom: 1px solid var(--admin-border);
  font-size: 12px;
  font-weight: 800;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  background: #fcfcfc;
}

.admin-table td {
  padding: 15px;
  border-bottom: 1px solid var(--admin-border);
  font-size: 13px;
  font-weight: 600;
}

.admin-table tbody tr:hover {
  background: #f9f9f9;
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-success { background: rgba(27, 197, 189, 0.1); color: var(--admin-success); }
.badge-danger { background: rgba(246, 78, 96, 0.1); color: var(--admin-danger); }
.badge-warning { background: rgba(255, 168, 0, 0.1); color: var(--admin-warning); }
.badge-primary { background: rgba(54, 153, 255, 0.1); color: var(--admin-primary); }

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  margin-right: 5px;
}

.btn-ban { color: var(--admin-danger); background: rgba(246,78,96,0.1); }
.btn-unban { color: var(--admin-success); background: rgba(27,197,189,0.1); }
.btn-del { color: white; background: var(--admin-danger); }

/* Global Search */
.search-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.massive-search {
  flex: 1;
  padding: 15px 20px;
  font-size: 16px;
  border-radius: 8px;
  border: 2px solid var(--admin-border);
}
.massive-search:focus {
  border-color: var(--admin-primary);
  outline: none;
}
.search-results-area {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.result-card {
  background: white;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Error Feed */
.error-feed {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.error-item {
  background: white;
  border-left: 4px solid var(--admin-danger);
  padding: 15px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.error-time {
  font-size: 11px;
  color: var(--admin-text-muted);
  margin-bottom: 5px;
}
.error-ep {
  font-weight: 800;
  font-family: monospace;
  margin-bottom: 5px;
}
.error-msg {
  color: var(--admin-danger);
  font-size: 13px;
  font-weight: 600;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: white;
  padding: 25px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
}
.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 15px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    height: 100%;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-close, .mobile-menu-btn {
    display: block;
  }
}
body.dark-mode { --admin-bg: #151521; --admin-card: #1e1e2d; --admin-border: #2b2b40; --admin-text-dark: #ffffff; --admin-text-muted: #a2a3b7; }
body.dark-mode .topbar, body.dark-mode .sidebar-header, body.dark-mode .result-card, body.dark-mode .error-item, body.dark-mode .table-responsive, body.dark-mode .admin-table th, body.dark-mode .modal-content, body.dark-mode input.massive-search, body.dark-mode .table-toolbar input, body.dark-mode .stat-card { background: var(--admin-card); color: var(--admin-text-dark); border-color: var(--admin-border); }
body.dark-mode .admin-table tbody tr:hover { background: #2b2b40; }
body.dark-mode .form-group input { background: var(--admin-card); color: var(--admin-text-dark); border-color: var(--admin-border); }