@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-darkest: #06060a;
  --bg-dark: #0f0f1a;
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.06);
  --primary-purple: #7c3aed;
  --primary-blue: #3b82f6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-dim: #71717a;
  --sidebar-width: 260px;
  --gradient-primary: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-darkest);
  background: linear-gradient(180deg, var(--bg-darkest) 0%, var(--bg-dark) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darkest);
}
::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 3px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 { font-weight: 600; }
a { color: var(--primary-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login Page */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.15), transparent 40%),
              radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.15), transparent 40%),
              var(--bg-darkest);
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.6s ease-out;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

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

.login-logo {
  font-size: 48px;
  margin-bottom: 10px;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid var(--card-border);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.sidebar-logo {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
}

.nav-menu {
  list-style: none;
  flex: 1;
}

.nav-item { margin-bottom: 8px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  border-radius: 10px;
  transition: all 0.3s;
}

.nav-link:hover, .nav-link.active {
  background: var(--card-bg);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-link.active {
  border-left: 4px solid var(--primary-purple);
  padding-left: 12px;
  background: rgba(124, 58, 237, 0.1);
}

.bot-status-container {
  padding: 15px;
  background: var(--card-bg);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}
.status-dot.active {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2s infinite;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 30px;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(20px);
  transition: transform 0.3s, box-shadow 0.3s;
  animation: slideUp 0.5s backwards;
}

.card:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  display: flex;
  flex-direction: column;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 15px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: white;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-purple);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.3s;
  color: white;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
}

.btn-primary:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}

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

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-primary { background: rgba(124, 58, 237, 0.2); color: #a78bfa; }

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .4s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider { background-image: var(--gradient-primary); }
input:checked + .slider:before { transform: translateX(26px); }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-dark);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  padding: 30px;
  transform: translateY(20px);
  transition: transform 0.3s;
}
.modal-overlay.active .modal {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}
.toast {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--primary-blue);
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  margin-top: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideLeft 0.3s ease-out;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes slideLeft {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
}
@media (max-width: 768px) {
  .mobile-toggle { display: block; }
}
