:root {
  --bg-dark: #0f172a;
  --bg-darker: #020617;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at top left, #1e1b4b, var(--bg-darker));
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Glassmorphism Utilities */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  border-radius: 16px;
}

/* Screens */
.screen {
  width: 100vw;
  height: 100vh;
  display: flex;
}
.hidden {
  display: none !important;
}

/* Login Screen */
#login-screen {
  justify-content: center;
  align-items: center;
}

.login-card {
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: slideUp 0.5s ease-out;
}

.icon-container {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.login-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}
.login-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 30px;
}

/* Forms */
.input-group {
  margin-bottom: 20px;
  text-align: left;
}
.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.input-group input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-main);
  font-family: monospace;
  font-size: 14px;
  transition: all 0.3s;
}
.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.input-group small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: var(--font-family);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  width: 100%;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}
.btn-outline:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: var(--danger);
  color: white;
}
.btn-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.btn-success:hover {
  background: var(--success);
  color: white;
}

/* Dashboard Layout */
#dashboard-screen {
  flex-direction: row;
}

.sidebar {
  width: 260px;
  border-radius: 0;
  border-left: none;
  border-top: none;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  margin-bottom: 40px;
}
.brand-icon {
  color: var(--primary);
}
.brand h1 {
  font-size: 20px;
  font-weight: 700;
}
.brand .highlight {
  color: var(--accent);
}

nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), transparent);
  color: var(--primary);
  border-left: 3px solid var(--primary);
}

.sidebar-footer {
  padding: 0 24px;
}
.sidebar-footer .btn {
  width: 100%;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 30px 40px;
  overflow-y: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}
.topbar h2 {
  font-size: 24px;
  font-weight: 600;
}
.topbar-actions {
  display: flex;
  gap: 12px;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.data-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px 20px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
}
.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 14px;
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tbody tr {
  transition: background 0.2s;
}
.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.code-font {
  font-family: monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--accent);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-active, .badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}
.badge-suspended {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}
.badge-expired {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* Actions in Table */
.td-actions {
  display: flex;
  gap: 8px;
}

/* States */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.loading-state {
  display: flex;
  justify-content: center;
  padding: 40px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}
.modal {
  width: 100%;
  max-width: 500px;
  animation: slideUp 0.3s ease-out;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  font-size: 18px;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Filters */
.filters {
  padding: 16px;
  display: flex;
  gap: 12px;
}
.filter-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  outline: none;
}
.filter-input:focus {
  border-color: var(--primary);
}
.mt-4 { margin-top: 16px; }

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 14px 20px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(8px);
  border-left: 4px solid var(--primary);
  color: white;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  animation: slideInRight 0.3s ease-out forwards, fadeOut 0.3s ease-in 3s forwards;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
