/* ===== VPN Management Dashboard — Premium Glassmorphism Dark Theme ===== */
:root {
  --bg-primary: #05050a;
  --bg-secondary: #0c0f1a;
  --bg-card: rgba(18, 22, 38, 0.65);
  --bg-card-hover: rgba(26, 32, 53, 0.85);
  --bg-input: rgba(10, 13, 26, 0.8);
  --bg-overlay: rgba(0, 0, 0, 0.85);
  --border: rgba(42, 50, 80, 0.5);
  --border-light: rgba(62, 70, 100, 0.5);
  --border-focus: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.15);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.15);
  --orange: #f59e0b;
  --orange-bg: rgba(245, 158, 11, 0.15);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.15);
  --purple: #8b5cf6;
  --purple-bg: rgba(139, 92, 246, 0.15);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --glass-filter: blur(12px);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 260px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== LOGIN ===== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 60%),
              var(--bg-primary);
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.login-logo .material-symbols-rounded { font-size: 32px; color: #fff; }

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  transition: var(--transition);
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder { color: var(--text-muted); }

.form-group small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.error-text {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn .material-symbols-rounded { font-size: 18px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), #8b5cf6);
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.2); }
.btn-success:hover { background: var(--green); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-sm .material-symbols-rounded { font-size: 16px; }

.btn-icon { padding: 6px; border: none; }

.btn-full { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(12, 15, 26, 0.85);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 28px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  list-style: none;
  padding: 12px 8px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

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

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent-hover);
}

.nav-link .material-symbols-rounded { font-size: 20px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .btn { width: 100%; justify-content: center; }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px 32px;
  min-height: 100vh;
}

.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-light); }

.stat-icon { font-size: 32px; opacity: 0.9; }
.stat-blue .stat-icon { color: var(--blue); }
.stat-green .stat-icon { color: var(--green); }
.stat-purple .stat-icon { color: var(--purple); }
.stat-orange .stat-icon { color: var(--orange); }

.stat-info { flex: 1; }
.stat-value { display: block; font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat-label { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.stat-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--green-bg);
  color: var(--green);
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(42, 48, 80, 0.5);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-card-hover); }

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-online { background: var(--green-bg); color: var(--green); }
.badge-offline { background: rgba(100, 116, 139, 0.12); color: var(--text-muted); }
.badge-revoked { background: var(--red-bg); color: var(--red); }

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-online::before {
  animation: pulse 2s infinite;
}

/* ===== CONNECTIONS LIST ===== */
.connections-list { display: flex; flex-direction: column; gap: 8px; }

.connection-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(42, 48, 80, 0.4);
}

.connection-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.connection-icon.network { background: var(--blue-bg); color: var(--blue); }
.connection-icon.technician { background: var(--purple-bg); color: var(--purple); }

.connection-info { flex: 1; }
.connection-name { font-weight: 600; font-size: 14px; }
.connection-details { font-size: 12px; color: var(--text-muted); }

.connection-traffic {
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
}

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

.copy-text {
  cursor: pointer;
  padding: 2px 8px;
  background: var(--bg-input);
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  transition: var(--transition);
  border: 1px solid transparent;
}
.copy-text:hover { border-color: var(--accent); color: var(--accent); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 17px; font-weight: 600; }

.modal-body { padding: 24px; }

.modal-body .form-group:last-of-type { margin-bottom: 20px; }

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideInRight 0.3s ease;
  min-width: 280px;
}

.toast-success { background: #065f46; color: #a7f3d0; border: 1px solid rgba(34, 197, 94, 0.3); }
.toast-error { background: #7f1d1d; color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.3); }
.toast-info { background: #1e3a5f; color: #bfdbfe; border: 1px solid rgba(59, 130, 246, 0.3); }

.toast .material-symbols-rounded { font-size: 20px; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(80px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(100, 116, 139, 0.3);
  transition: .4s;
  border-radius: 34px;
}
.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .slider {
  background-color: var(--accent);
}
.toggle-switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* ===== PASSWORD FIELD & CREDENTIALS ===== */
.credentials-box {
  background: rgba(0, 0, 0, 0.15);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.password-input {
  background: transparent !important;
  border: none !important;
  color: var(--text-muted) !important;
  font-family: monospace;
  padding: 0 !important;
  font-size: 13px !important;
  width: 120px;
  box-shadow: none !important;
}
.password-input:focus { box-shadow: none !important; }

/* ===== SIMPLE DATATABLES OVERRIDES ===== */
.dataTable-wrapper {
  color: var(--text-primary);
  font-family: var(--font);
}
.dataTable-selector, .dataTable-input {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm);
  padding: 8px 12px !important;
}
.dataTable-table > thead > tr > th {
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
}
.dataTable-table > tbody > tr > td {
  border-bottom: 1px solid rgba(42, 50, 80, 0.5) !important;
}
.dataTable-pagination a {
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm) !important;
}
.dataTable-pagination a:hover {
  background: var(--bg-card-hover) !important;
}
.dataTable-pagination .active a, .dataTable-pagination .active a:hover {
  background: var(--accent) !important;
  color: white !important;
}
.dataTable-info { color: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-title, .nav-link span:not(.material-symbols-rounded), .sidebar-footer span:not(.material-symbols-rounded) { display: none; }
  .sidebar-header { justify-content: center; padding: 16px 8px; }
  .nav-link { justify-content: center; padding: 10px; }
  .sidebar-footer .btn { padding: 8px; justify-content: center; }
  .main-content { margin-left: 60px; padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal { margin: 16px; max-width: calc(100% - 32px); }
}
