/* ==========================================================================
   SUPER PLATFORM - Premium Dark Theme Design System
   ========================================================================== */

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

/* ==========================================================================
   1. Design Tokens (CSS Custom Properties)
   ========================================================================== */
:root {
  /* Backgrounds */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a28;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.1);
  --bg-overlay: rgba(0, 0, 0, 0.6);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(139, 92, 246, 0.5);

  /* Text */
  --text-primary: #f1f1f4;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;
  --text-inverse: #0a0a0f;

  /* Accent Colors */
  --color-primary: #8b5cf6;
  --color-primary-hover: #7c3aed;
  --color-primary-glow: rgba(139, 92, 246, 0.25);
  --color-primary-soft: rgba(139, 92, 246, 0.15);

  --color-success: #22c55e;
  --color-success-soft: rgba(34, 197, 94, 0.15);
  --color-warning: #f59e0b;
  --color-warning-soft: rgba(245, 158, 11, 0.15);
  --color-danger: #ef4444;
  --color-danger-soft: rgba(239, 68, 68, 0.15);
  --color-info: #3b82f6;
  --color-info-soft: rgba(59, 130, 246, 0.15);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  --gradient-bg: linear-gradient(135deg, #0a0a0f 0%, #1a103a 50%, #0a0a0f 100%);
  --gradient-card-border: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(59, 130, 246, 0.1));
  --gradient-header: linear-gradient(90deg, rgba(139, 92, 246, 0.08), transparent);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
  --shadow-glow-lg: 0 0 40px rgba(139, 92, 246, 0.2);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --container-max: 1280px;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-primary-hover);
}

img {
  max-width: 100%;
  display: block;
}

/* ==========================================================================
   3. Animations & Keyframes
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.4); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-slide-up { animation: slideUp 0.5s ease forwards; }
.animate-scale-in { animation: scaleIn 0.3s ease forwards; }

/* ==========================================================================
   4. Layout & Container
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: var(--space-xl) 0;
}

/* ==========================================================================
   5. Header / Navbar
   ========================================================================== */
.header {
  height: var(--header-height);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  animation: slideDown 0.4s ease;
}

.header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.header-brand .brand-icon {
  font-size: 1.5rem;
}

.header-brand .brand-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.header-user .user-name {
  font-weight: 600;
  color: var(--text-primary);
}

.header-user .user-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* ==========================================================================
   6. Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.97);
}

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

/* Primary */
.btn-primary {
  background: var(--gradient-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm), 0 0 16px rgba(139, 92, 246, 0.2);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md), 0 0 24px rgba(139, 92, 246, 0.35);
  transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-light);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Danger */
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: var(--shadow-sm), 0 0 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  box-shadow: var(--shadow-md), 0 0 20px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}

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

/* Success */
.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff;
}

.btn-success:hover {
  box-shadow: var(--shadow-md), 0 0 20px rgba(34, 197, 94, 0.3);
}

/* Sizes */
.btn-sm { padding: 0.375rem 0.75rem; font-size: var(--font-size-xs); }
.btn-lg { padding: 0.875rem 1.75rem; font-size: var(--font-size-md); }
.btn-icon { padding: 0.5rem; width: 36px; height: 36px; }

/* Loading state */
.btn-loading {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ==========================================================================
   7. Form Inputs
   ========================================================================== */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  outline: none;
}

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

.form-input:hover {
  border-color: var(--border-light);
}

.form-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.form-input.is-invalid {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px var(--color-danger-soft);
}

.form-error {
  display: block;
  margin-top: var(--space-xs);
  font-size: var(--font-size-xs);
  color: var(--color-danger);
}

.input-wrapper {
  position: relative;
}

.input-wrapper .input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input-wrapper .form-input {
  padding-left: 2.75rem;
}

.input-wrapper .input-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--font-size-lg);
  padding: 4px;
  transition: color var(--transition-base);
}

.input-wrapper .input-toggle:hover {
  color: var(--text-primary);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.form-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.375rem 0.75rem;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
}

.form-checkbox-label:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.form-checkbox-label input[type="checkbox"] {
  display: none;
}

.form-checkbox-label input[type="checkbox"]:checked + span {
  color: var(--color-primary);
}

.form-checkbox-label:has(input:checked) {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ==========================================================================
   8. Cards (Glassmorphism)
   ========================================================================== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   9. Login Page
   ========================================================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-bg);
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
  position: relative;
  overflow: hidden;
}

.login-page #particleCanvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: var(--space-lg);
  background: rgba(18, 18, 26, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: scaleIn 0.5s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo .logo-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: var(--space-sm);
  animation: float 3s ease-in-out infinite;
}

.login-logo .logo-title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo .logo-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.login-card .btn-primary {
  width: 100%;
  padding: 0.875rem;
  font-size: var(--font-size-md);
  margin-top: var(--space-sm);
}

.login-error {
  background: var(--color-danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  color: var(--color-danger);
  font-size: var(--font-size-sm);
  text-align: center;
  display: none;
  animation: slideUp 0.3s ease;
}

.login-error.visible {
  display: block;
}

.login-rate-limit {
  background: var(--color-warning-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  color: var(--color-warning);
  font-size: var(--font-size-sm);
  text-align: center;
  display: none;
  animation: slideUp 0.3s ease;
}

.login-rate-limit.visible {
  display: block;
}

/* ==========================================================================
   10. Dashboard
   ========================================================================== */
.dashboard-welcome {
  margin-bottom: var(--space-2xl);
  animation: slideUp 0.5s ease;
}

.dashboard-welcome h1 {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  margin-bottom: var(--space-xs);
}

.dashboard-welcome h1 .wave {
  display: inline-block;
  animation: float 2s ease-in-out infinite;
}

.dashboard-welcome .meta-info {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.modules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 640px) {
  .modules-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .modules-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.module-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--module-color, var(--color-primary));
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: all var(--transition-base);
  opacity: 0;
  animation: slideUp 0.5s ease forwards;
  cursor: default;
}

.module-card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg), 0 0 24px rgba(var(--module-color-rgb, 139, 92, 246), 0.1);
  transform: translateY(-2px) scale(1.02);
}

.module-card .module-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.module-card .module-icon {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
}

.module-card .module-name {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.module-card .module-description {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  flex: 1;
}

.module-card .module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.module-card .module-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.module-card .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.module-card .status-dot.online {
  background: var(--color-success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.module-card .status-dot.offline {
  background: var(--color-danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: none;
}

.module-card .status-text.online { color: var(--color-success); }
.module-card .status-text.offline { color: var(--color-danger); }

.module-card .btn-access {
  font-size: var(--font-size-sm);
}

/* ==========================================================================
   11. Admin Layout
   ========================================================================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-xl) 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  transition: transform var(--transition-slow);
}

.admin-sidebar .sidebar-brand {
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-2xl);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.admin-sidebar .sidebar-brand .brand-icon {
  font-size: 1.5rem;
}

.admin-sidebar .sidebar-brand .brand-name {
  font-size: var(--font-size-lg);
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-sidebar .sidebar-label {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.75rem var(--space-lg);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: all var(--transition-base);
  border-left: 3px solid transparent;
}

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

.sidebar-nav a.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-left-color: var(--color-primary);
}

.sidebar-nav a .nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-xl) var(--space-2xl);
  min-height: 100vh;
}

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.admin-page-header h1 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  transition: all var(--transition-base);
}

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 1.5rem;
}

.stat-card .stat-icon.purple { background: var(--color-primary-soft); }
.stat-card .stat-icon.green { background: var(--color-success-soft); }
.stat-card .stat-icon.blue { background: var(--color-info-soft); }
.stat-card .stat-icon.orange { background: var(--color-warning-soft); }

.stat-card .stat-value {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--text-primary);
}

.stat-card .stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* ==========================================================================
   12. Tables
   ========================================================================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table thead {
  background: rgba(255, 255, 255, 0.03);
}

.table th {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition-base);
}

.table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.table .actions-cell {
  display: flex;
  gap: var(--space-xs);
}

/* ==========================================================================
   13. Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.6rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary { background: var(--color-primary-soft); color: var(--color-primary); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }
.badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* ==========================================================================
   14. Modals
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  padding: var(--space-lg);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition-base);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   15. Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  min-width: 300px;
  max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease;
  font-size: var(--font-size-sm);
}

.toast.removing {
  animation: toastSlideOut 0.3s ease forwards;
}

.toast-icon { font-size: 1.25rem; flex-shrink: 0; }
.toast-message { flex: 1; color: var(--text-primary); }
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
}

.toast.success { border-left: 4px solid var(--color-success); }
.toast.error { border-left: 4px solid var(--color-danger); }
.toast.warning { border-left: 4px solid var(--color-warning); }
.toast.info { border-left: 4px solid var(--color-info); }

/* ==========================================================================
   16. Pagination
   ========================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-xl);
}

.pagination .page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.pagination .page-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.pagination .page-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
}

.pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   17. Module Loading Screen
   ========================================================================== */
.loading-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.loading-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  animation: fadeIn 0.5s ease;
}

.loading-spinner {
  width: 64px;
  height: 64px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-icon {
  font-size: 3rem;
  animation: float 2s ease-in-out infinite;
}

.loading-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.loading-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.loading-progress {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

/* ==========================================================================
   18. Empty States
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) * 2;
  text-align: center;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state .empty-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state .empty-description {
  font-size: var(--font-size-sm);
  max-width: 360px;
}

/* ==========================================================================
   19. Filters Bar
   ========================================================================== */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.filters-bar .form-input,
.filters-bar .form-select {
  flex: 1;
  min-width: 160px;
}

/* ==========================================================================
   20. Utility Classes
   ========================================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-primary { color: var(--color-primary); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   21. Search Input
   ========================================================================== */
.search-wrapper {
  position: relative;
  max-width: 300px;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrapper .form-input {
  padding-left: 2.5rem;
  background: var(--bg-card);
}

/* ==========================================================================
   22. Responsive / Mobile
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .admin-sidebar {
    transform: translateX(-100%);
    width: 260px;
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
    padding: var(--space-lg);
  }

  .header .container {
    padding: 0 var(--space-md);
  }

  .header-user .user-meta {
    display: none;
  }

  .modal {
    margin: var(--space-md);
    padding: var(--space-xl);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .toast-container {
    top: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
  }

  .toast {
    min-width: unset;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: var(--space-xl);
    margin: var(--space-md);
  }

  .filters-bar {
    flex-direction: column;
  }
}

/* ==========================================================================
   23. Scrollbar Styling
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   24. Module Badge Icons (in tables)
   ========================================================================== */
.module-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.module-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  font-size: var(--font-size-xs);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   25. Action Badges (Logs)
   ========================================================================== */
.action-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.6rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
}

.action-badge.login_success { background: var(--color-success-soft); color: var(--color-success); }
.action-badge.login_failed { background: var(--color-danger-soft); color: var(--color-danger); }
.action-badge.access_module { background: var(--color-info-soft); color: var(--color-info); }
.action-badge.admin_action { background: var(--color-primary-soft); color: var(--color-primary); }
.action-badge.client_locked { background: var(--color-warning-soft); color: var(--color-warning); }
.action-badge.password_reset { background: var(--color-info-soft); color: var(--color-info); }
.action-badge.module_toggled { background: var(--color-primary-soft); color: var(--color-primary); }

/* ==========================================================================
   26. Mobile Sidebar Toggle
   ========================================================================== */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 60;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
