:root {
  --bg-color: #0b0f19;
  --panel-bg: rgba(17, 24, 39, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.15);

  --font-family: 'Vazirmatn', 'Outfit', system-ui, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Background Glowing Orbs */
.background-decor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  animation: float 20s infinite alternate ease-in-out;
}
.orb-1 {
  width: 400px;
  height: 400px;
  background-color: var(--primary-color);
  top: -100px;
  left: -100px;
}
.orb-2 {
  width: 500px;
  height: 500px;
  background-color: #ec4899;
  bottom: -150px;
  right: -100px;
  animation-delay: -5s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.15); }
}

/* Glassmorphism Styles */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: var(--transition);
}
.glass-card:hover {
  border-color: var(--border-hover);
}

/* Login Page Layout */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
}
.login-container {
  width: 100%;
  max-width: 480px;
  padding: 20px;
}
.login-card {
  padding: 40px 32px;
}
.logo-area {
  text-align: center;
  margin-bottom: 32px;
}
.logo-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.logo-area h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-area p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Forms styling */
.login-form .form-group {
  margin-bottom: 24px;
}
.form-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.form-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(255, 255, 255, 0.05);
}

/* Buttons and Action Elements */
.btn-primary {
  width: 100%;
  padding: 14px 20px;
  background: var(--primary-color);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 0 16px var(--primary-glow);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Alerts and Banners */
.error-banner {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 24px;
  text-align: center;
}
.hidden {
  display: none !important;
}

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  border-left: 1px solid var(--border-color);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 0 8px;
}
.sidebar-header .icon {
  font-size: 28px;
}
.sidebar-header h2 {
  font-size: 16px;
  font-weight: 700;
}
.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.menu-item:hover, .menu-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}
.menu-item.active {
  background: var(--primary-glow);
  border-right: 3px solid var(--primary-color);
}
.sidebar-footer {
  margin-top: auto;
}
.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fca5a5;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-family: var(--font-family);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.logout-btn:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 40px;
  max-width: 1400px;
  margin: 0 auto;
  width: calc(100% - 260px);
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 800;
}
.admin-info {
  font-size: 14px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.stat-card {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-info h3 {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 8px;
}
.stat-info .stat-value {
  font-size: 28px;
  font-weight: 800;
  font-family: 'Outfit', var(--font-family);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 22px;
}
.stat-card.total .stat-icon { background: var(--primary-glow); color: var(--primary-color); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.failed .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.waiting .stat-icon { background: var(--warning-bg); color: var(--warning); }

/* Monitored Sections Tables */
.section-card {
  padding: 24px;
  margin-bottom: 30px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.section-header h2 {
  font-size: 16px;
  font-weight: 700;
}

/* Tables design */
.table-wrapper {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 14px;
}
.data-table th, .data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}
.data-table th {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 13px;
}
.data-table tbody tr {
  transition: var(--transition);
}
.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

/* Badges for status */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.failed { background: var(--danger-bg); color: var(--danger); }
.badge.waiting { background: var(--warning-bg); color: var(--warning); }
.badge.pending { background: var(--info-bg); color: var(--info); }
.badge.blocked { background: rgba(239, 68, 68, 0.2); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge.active { background: rgba(16, 185, 129, 0.2); color: #6EE7B7; border: 1px solid rgba(16, 185, 129, 0.4); }
.badge.locked { background: rgba(245, 158, 11, 0.2); color: #FDE047; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge.unlocked { background: rgba(59, 130, 246, 0.2); color: #93C5FD; border: 1px solid rgba(59, 130, 246, 0.4); }

.action-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  transition: var(--transition);
}
.btn-sm:hover {
  background: rgba(255, 255, 255, 0.15);
}
.btn-sm.danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}
.btn-sm.danger:hover {
  background: rgba(239, 68, 68, 0.35);
}
.btn-sm.warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #FDE047;
}
.btn-sm.warning:hover {
  background: rgba(245, 158, 11, 0.35);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: var(--transition);
}
.modal-box {
  width: 100%;
  max-width: 750px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  animation: modalEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalEnter {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 20px;
  left: 20px;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}
.modal-close:hover {
  color: #fff;
}
.modal-box h3 {
  font-size: 18px;
  margin-bottom: 24px;
}

/* Code block styles */
pre.json-view {
  background: rgba(0, 0, 0, 0.4);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: #c4b5fd;
  overflow-x: auto;
  white-space: pre-wrap;
  margin-top: 12px;
}

.alert-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.alert-item {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
}
.alert-item.err {
  background: var(--danger-bg);
  border-right: 4px solid var(--danger);
  color: #fca5a5;
}
.alert-item.warn {
  background: var(--warning-bg);
  border-right: 4px solid var(--warning);
  color: #fde047;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}
