/* ========================================
   KEEDSMOVER - Main Stylesheet
   Theme: Cyber Modern (Light/Dark Mode)
   Primary: #03acef | Secondary: #f1a72a
======================================== */

/* CSS Variables - Light Mode (Default) */
:root {
  --primary: #03acef;
  --primary-dark: #0299d6;
  --primary-light: #35bdf3;
  --secondary: #f1a72a;
  --secondary-dark: #d99520;
  --secondary-light: #f4b94f;
  
  /* Light Mode Colors */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.95);
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-glow: rgba(3, 172, 239, 0.3);
  
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(3, 172, 239, 0.15);
  
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
  --bottom-nav-height: 70px;
}

/* Dark Mode - Navy Dark Theme */
[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #273449;
  --bg-sidebar: #0f172a;
  --bg-header: rgba(15, 23, 42, 0.95);
  
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --border-color: #334155;
  --border-glow: rgba(3, 172, 239, 0.5);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(3, 172, 239, 0.3);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  outline: none;
}

/* Cyber Grid Perspective Background Animation */
.cyber-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
  background: var(--bg-body);
}

/* Perspective Grid Container */
.cyber-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(#f1f4f9 1px, transparent 1px),
    linear-gradient(90deg, #f1f4f9 1px, transparent 1px);
  background-size: 40px 40px;
  transform: perspective(700px) rotateX(55deg);
  transform-origin: center top;
  animation: cyberGridFlow 20s linear infinite;
}

/* Glow overlay */
.cyber-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(3, 172, 239, 0.08) 0%, transparent 50%),
    linear-gradient(to bottom, transparent 0%, var(--bg-body) 100%);
  pointer-events: none;
}

/* Dark Mode - Navy cyber grid */
[data-theme="dark"] .cyber-bg::before {
  background-image: 
    linear-gradient(#162c4a 1px, transparent 1px),
    linear-gradient(90deg, #162c4a 1px, transparent 1px);
}

[data-theme="dark"] .cyber-bg::after {
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(3, 172, 239, 0.15) 0%, transparent 50%),
    linear-gradient(to bottom, transparent 0%, var(--bg-body) 100%);
}

@keyframes cyberGridFlow {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 50px;
  }
}

/* Legacy grid move animation (for other elements) */
@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding-top: var(--header-height);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

.page-content {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  animation: pageSlideIn 0.4s ease-out;
}

/* Page Transition Effects */
@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Loading skeleton animation */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card-hover) 25%, var(--bg-card) 50%, var(--bg-card-hover) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Page loading overlay */
.page-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.page-loading.fade-out {
  opacity: 0;
  pointer-events: none;
}

.page-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Smooth card entrance */
.stat-card, .card {
  animation: cardFadeIn 0.5s ease-out backwards;
}

.stat-card:nth-child(1), .card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2), .card:nth-child(2) { animation-delay: 0.15s; }
.stat-card:nth-child(3), .card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4), .card:nth-child(4) { animation-delay: 0.25s; }

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.3s ease, transform 0.3s ease;
  box-shadow: var(--shadow-md);
}

.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}

/* Sidebar Logo Swap */
.sidebar-logo-full {
  display: block;
  transition: opacity 0.3s ease;
}

.sidebar-logo-mini {
  display: none;
  transition: opacity 0.3s ease;
}

.sidebar-collapsed .sidebar-logo-full {
  display: none;
}

.sidebar-collapsed .sidebar-logo-mini {
  display: block;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(3, 172, 239, 0.3);
}

.sidebar-logo svg {
  width: 24px;
  height: 24px;
  color: white;
}

.sidebar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.sidebar-collapsed .sidebar-brand {
  opacity: 0;
  width: 0;
}

/* Sidebar Collapse Toggle */
.sidebar-toggle {
  position: absolute;
  top: 20px;
  right: -14px;
  width: 28px;
  height: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 101;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.sidebar-collapsed .nav-section-title {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all 0.2s ease;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(3, 172, 239, 0.1);
  color: var(--primary);
  border-left: 3px solid var(--primary);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex-shrink: 0;
}

.nav-item span {
  font-size: 0.9rem;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.sidebar-collapsed .nav-item span {
  opacity: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  transition: opacity 0.3s ease;
}

.sidebar-collapsed .nav-badge {
  opacity: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
  transition: left 0.3s ease;
}

.sidebar-collapsed .header {
  left: var(--sidebar-collapsed-width);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: transparent;
  color: var(--text-primary);
  padding: 8px;
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-sun,
[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

.theme-toggle .icon-moon {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Header Button with Notification Badge */
.header-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.header-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.header-btn svg {
  width: 20px;
  height: 20px;
}

/* Clear Cache Button */
.clear-cache-btn {
  cursor: pointer;
}

.clear-cache-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.clear-cache-btn.loading svg,
.clear-cache-btn svg.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Fixed Notification Counter */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--bg-header);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

.notification-badge:empty {
  display: none;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-menu:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: white;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Profile Dropdown */
.profile-dropdown {
  position: relative;
}

.profile-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-dropdown-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  overflow: hidden;
  display: none;
}

.profile-dropdown.active .profile-dropdown-menu {
  display: block;
}

.profile-dropdown.active > .profile-dropdown-menu {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.profile-dropdown-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.profile-dropdown-header .user-avatar {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  font-size: 1.1rem;
}

.profile-dropdown-header .user-name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.profile-dropdown-header .user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
}

.profile-dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--primary);
}

.profile-dropdown-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.profile-dropdown-item:hover svg {
  opacity: 1;
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.profile-dropdown-item.logout {
  color: var(--danger);
}

.profile-dropdown-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Dropdown arrow indicator */
.dropdown-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  opacity: 0.5;
}

.profile-dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: visible;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 20px;
  overflow: visible;
}

/* Card body with no padding (for tables) */
.card-body[style*="padding: 0"],
.card-body[style*="padding:0"] {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card-hover);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.primary {
  background: rgba(3, 172, 239, 0.12);
  color: var(--primary);
}

.stat-icon.secondary {
  background: rgba(241, 167, 42, 0.12);
  color: var(--secondary);
}

.stat-icon.success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.stat-icon.danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.stat-icon.warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.stat-icon.info {
  background: rgba(59, 130, 246, 0.12);
  color: var(--info);
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  margin-top: 4px;
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--danger);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  white-space: nowrap;
  border: none;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(3, 172, 239, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: 0 6px 20px rgba(3, 172, 239, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(241, 167, 42, 0.3);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--secondary-light), var(--secondary));
  box-shadow: 0 6px 20px rgba(241, 167, 42, 0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--primary);
  background: rgba(3, 172, 239, 0.08);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  padding: 10px;
}

.btn-icon.btn-sm {
  padding: 6px;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(3, 172, 239, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(3, 172, 239, 0.1);
}

.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s ease;
}

.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(3, 172, 239, 0.1);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 6px;
}

/* Tables */
.table-container {
  display: block;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--bg-card-hover);
  position: relative;
}

/* Remove border when inline style sets border: none */
.table-container[style*="border: none"],
.table-container[style*="border:none"] {
  border: none !important;
}

.table-container::-webkit-scrollbar {
  height: 10px;
}

.table-container::-webkit-scrollbar-track {
  background: var(--bg-card-hover);
  border-radius: 5px;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 5px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

.table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  table-layout: auto;
  display: table;
}

.table th,
.table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background: var(--bg-card-hover);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  white-space: nowrap;
}

.table td {
  font-size: 0.9rem;
  background: var(--bg-card);
}

.table tr:hover td {
  background: var(--bg-card-hover);
}

.table tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
}

.badge-primary {
  background: rgba(3, 172, 239, 0.12);
  color: var(--primary);
}

.badge-secondary {
  background: rgba(241, 167, 42, 0.12);
  color: var(--secondary);
}

.badge-success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.badge-info {
  background: rgba(59, 130, 246, 0.12);
  color: var(--info);
}

/* Status Indicators */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.pending {
  background: var(--warning);
}

.status-dot.active,
.status-dot.delivered {
  background: var(--success);
}

.status-dot.cancelled,
.status-dot.failed {
  background: var(--danger);
}

.status-dot.in-transit {
  background: var(--primary);
}


/* Mobile Bottom Navigation */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  padding: 8px 16px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item.active {
  background: rgba(3, 172, 239, 0.1);
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav-item span {
  font-size: 0.7rem;
  font-weight: 500;
}

/* Search */
.search-box {
  position: relative;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.search-box input:focus {
  border-color: var(--primary);
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.tab {
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s ease;
  background: transparent;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  color: var(--text-muted);
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
  color: white;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.25rem;
}

.avatar-xl {
  width: 80px;
  height: 80px;
  font-size: 1.75rem;
}

/* List Items */
.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.list-item:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.list-item-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.list-item-actions {
  display: flex;
  gap: 8px;
}

/* Progress Bar */
.progress {
  height: 8px;
  background: var(--bg-card-hover);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-bar.success {
  background: linear-gradient(90deg, var(--success), #4ade80);
}

.progress-bar.warning {
  background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.progress-bar.danger {
  background: linear-gradient(90deg, var(--danger), #f87171);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-body);
}

.timeline-dot.completed {
  background: var(--success);
}

.timeline-dot.pending {
  background: var(--warning);
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.timeline-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  margin-top: 8px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 50;
}

.dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 0;
}

/* Utility Classes */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.bg-primary { background-color: var(--primary); }
.bg-secondary { background-color: var(--secondary); }
.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }
.bg-danger { background-color: var(--danger); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 32px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-5 { margin-bottom: 32px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }
.block { display: block; }

/* Responsive */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  
  .sidebar-toggle {
    display: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    z-index: 200;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  /* Fix sidebar text visibility in light mode mobile */
  .sidebar .nav-item span,
  .sidebar .nav-section-title,
  .sidebar .sidebar-brand {
    opacity: 1 !important;
    color: var(--text-primary);
  }
  
  .sidebar .nav-item {
    color: var(--text-secondary);
  }
  
  .sidebar .nav-item.active {
    color: var(--primary);
  }
  
  .sidebar-collapsed .sidebar {
    width: var(--sidebar-width);
  }
  
  /* Reset collapsed state on mobile */
  .sidebar-collapsed .sidebar .nav-item span,
  .sidebar-collapsed .sidebar .nav-section-title,
  .sidebar-collapsed .sidebar .sidebar-brand,
  .sidebar-collapsed .sidebar .nav-badge {
    opacity: 1 !important;
  }
  
  .main-content,
  .sidebar-collapsed .main-content {
    margin-left: 0;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  
  .header,
  .sidebar-collapsed .header {
    left: 0;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .page-title {
    font-size: 0.9rem;
  }
  
  .bottom-nav {
    display: block;
  }
  
  /* Mobile cyber grid - smaller perspective */
  .cyber-bg::before {
    background-size: 40px 40px;
    transform: perspective(300px) rotateX(55deg);
  }
  
  .page-content {
    padding: 16px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
  }
  
  /* Fix table horizontal scroll on mobile */
  .card {
    overflow: visible;
    width: 100%;
    max-width: 100%;
  }
  
  .stat-card {
    width: 100%;
    max-width: 100%;
  }
  
  /* Card body with table needs scroll */
  .card-body {
    overflow: visible;
  }
  
  .card-body[style*="padding: 0"],
  .card-body[style*="padding:0"] {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Table container scroll fix - ENHANCED */
  .table-container {
    display: block !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: scroll !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: auto;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    position: relative;
    margin: 0 !important;
    /* Scroll shadow indicators */
    background: 
      linear-gradient(to right, var(--bg-card) 30%, rgba(255,255,255,0)),
      linear-gradient(to right, rgba(255,255,255,0), var(--bg-card) 70%) 100% 0,
      radial-gradient(farthest-side at 0 50%, rgba(3, 172, 239, 0.2), transparent),
      radial-gradient(farthest-side at 100% 50%, rgba(3, 172, 239, 0.2), transparent) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  
  [data-theme="dark"] .table-container {
    background: 
      linear-gradient(to right, var(--bg-card) 30%, rgba(0,0,0,0)),
      linear-gradient(to right, rgba(0,0,0,0), var(--bg-card) 70%) 100% 0,
      radial-gradient(farthest-side at 0 50%, rgba(3, 172, 239, 0.3), transparent),
      radial-gradient(farthest-side at 100% 50%, rgba(3, 172, 239, 0.3), transparent) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  
  .table-container::-webkit-scrollbar {
    height: 12px;
  }
  
  .table-container::-webkit-scrollbar-track {
    background: var(--bg-card-hover);
    border-radius: 6px;
    margin: 0 4px;
  }
  
  .table-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 6px;
    border: 2px solid var(--bg-card-hover);
  }
  
  .table-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
  }
  
  .table {
    min-width: 700px;
    width: max-content;
    display: table;
  }
  
  .table th,
  .table td {
    padding: 12px 14px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  
  .table th {
    font-size: 0.72rem;
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-card-hover);
  }
  
  /* Ensure badges don't wrap */
  .table .badge {
    white-space: nowrap;
  }
  
  /* Ensure buttons in table don't wrap */
  .table .btn {
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  
  /* Visual scroll indicator with animation */
  .card:has(.table-container) {
    position: relative;
  }
  
  .card:has(.table-container)::after {
    content: '👉 Swipe to scroll';
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: 6px;
    opacity: 0.9;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    animation: scrollHintPulse 2s ease-in-out infinite;
  }
  
  @keyframes scrollHintPulse {
    0%, 100% { opacity: 0.9; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(3px); }
  }
  
  .user-info {
    display: none;
  }
  
  .header-right {
    gap: 8px;
  }
  
  .sidebar-toggle {
    display: none;
  }
  
  /* Mobile sidebar overlay */
  .sidebar.active::before {
    content: '';
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 0.9rem;
  }
  
  .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
  
  .card-header,
  .card-body {
    padding: 16px;
  }
}


/* Login Page Specific */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

/* Login Cyber Background - Light Mode Enhanced */
.login-cyber-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f0fdf4 100%);
}

.login-cyber-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(90deg, transparent 49%, rgba(3, 172, 239, 0.15) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(3, 172, 239, 0.15) 50%, transparent 51%);
  background-size: 40px 40px;
  animation: loginGridMove 20s linear infinite;
}

.login-cyber-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(3, 172, 239, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(241, 167, 42, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(3, 172, 239, 0.08) 0%, transparent 60%);
  animation: loginPulse 8s ease-in-out infinite;
}

/* Animated Lines */
.cyber-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.cyber-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(3, 172, 239, 0.4), transparent);
  height: 1px;
  animation: lineMove 8s linear infinite;
}

.cyber-line:nth-child(1) { top: 20%; animation-delay: 0s; width: 60%; }
.cyber-line:nth-child(2) { top: 40%; animation-delay: 2s; width: 80%; }
.cyber-line:nth-child(3) { top: 60%; animation-delay: 4s; width: 50%; }
.cyber-line:nth-child(4) { top: 80%; animation-delay: 6s; width: 70%; }

.cyber-line-v {
  position: absolute;
  background: linear-gradient(180deg, transparent, rgba(241, 167, 42, 0.3), transparent);
  width: 1px;
  height: 100%;
  animation: lineVMove 10s linear infinite;
}

.cyber-line-v:nth-child(5) { left: 15%; animation-delay: 0s; }
.cyber-line-v:nth-child(6) { left: 35%; animation-delay: 2.5s; }
.cyber-line-v:nth-child(7) { left: 65%; animation-delay: 5s; }
.cyber-line-v:nth-child(8) { left: 85%; animation-delay: 7.5s; }

@keyframes loginGridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(40px, 40px); }
}

@keyframes loginPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes lineMove {
  0% { transform: translateX(-100%); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateX(200%); opacity: 0; }
}

@keyframes lineVMove {
  0% { transform: translateY(-100%); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(200%); opacity: 0; }
}

/* Dark mode login background */
[data-theme="dark"] .login-cyber-bg {
  background: linear-gradient(135deg, #0a0f1a 0%, #111827 50%, #0d1321 100%);
}

[data-theme="dark"] .login-cyber-bg::before {
  background: 
    linear-gradient(90deg, transparent 49%, rgba(3, 172, 239, 0.08) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(3, 172, 239, 0.08) 50%, transparent 51%);
}

[data-theme="dark"] .login-cyber-bg::after {
  background: 
    radial-gradient(circle at 20% 30%, rgba(3, 172, 239, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(241, 167, 42, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(3, 172, 239, 0.05) 0%, transparent 60%);
}

[data-theme="dark"] .cyber-line {
  background: linear-gradient(90deg, transparent, rgba(3, 172, 239, 0.5), transparent);
}

[data-theme="dark"] .cyber-line-v {
  background: linear-gradient(180deg, transparent, rgba(241, 167, 42, 0.4), transparent);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(3, 172, 239, 0.1);
  position: relative;
  z-index: 1;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(3, 172, 239, 0.35);
}

.login-logo svg {
  width: 40px;
  height: 40px;
  color: white;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-form {
  margin-bottom: 24px;
}

.login-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--primary);
  font-weight: 500;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* Checkbox */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-wrapper input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-wrapper label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.divider span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Role Selection Cards */
.role-card {
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.role-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.role-card h4 {
  margin-bottom: 4px;
  font-weight: 600;
}

.role-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
}


/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 400px;
  transform: translateX(120%);
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-danger {
  border-left: 4px solid var(--danger);
}

.toast-info {
  border-left: 4px solid var(--info);
}

.toast button {
  background: transparent;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.toast button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}


/* Mobile table scroll enhancement - integrated above in main @media (max-width: 768px) */

/* Responsive table - smaller screens */
@media (max-width: 480px) {
  .table {
    min-width: 600px;
  }
  
  .table th,
  .table td {
    padding: 10px 12px;
    font-size: 0.75rem;
  }
  
  .table th {
    font-size: 0.68rem;
  }
  
  .table .btn-sm {
    padding: 5px 10px;
    font-size: 0.7rem;
  }
  
  .table .badge {
    padding: 3px 8px;
    font-size: 0.65rem;
  }
  
  .table-container::-webkit-scrollbar {
    height: 10px;
  }
  
  .card:has(.table-container)::after {
    content: '👉 Scroll';
    font-size: 0.65rem;
    padding: 3px 8px;
    bottom: 8px;
    right: 8px;
  }
}


/* ========================================
   PWA Install Popup
======================================== */
.pwa-install-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pwa-install-popup.show {
  opacity: 1;
  visibility: visible;
}

.pwa-install-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.pwa-install-modal {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(3, 172, 239, 0.2);
  border: 1px solid var(--border-color);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}

.pwa-install-popup.show .pwa-install-modal {
  transform: scale(1) translateY(0);
}

.pwa-install-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-card-hover);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.pwa-install-close:hover {
  background: var(--danger);
  color: white;
}

.pwa-install-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(3, 172, 239, 0.3);
}

.pwa-install-icon img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.pwa-install-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.pwa-install-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.pwa-install-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-body);
  border-radius: var(--radius-md);
}

.pwa-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pwa-feature svg {
  color: var(--primary);
  flex-shrink: 0;
}

.pwa-install-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-btn {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pwa-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(3, 172, 239, 0.3);
}

.pwa-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(3, 172, 239, 0.4);
}

.pwa-btn-secondary {
  background: transparent;
  color: var(--text-muted);
}

.pwa-btn-secondary:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .pwa-install-modal {
    padding: 24px 20px;
    margin: 10px;
  }
  
  .pwa-install-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }
  
  .pwa-install-icon img {
    width: 40px;
    height: 40px;
  }
  
  .pwa-install-title {
    font-size: 1.1rem;
  }
}


/* PWA Manual Instructions */
.pwa-manual-instructions {
  background: linear-gradient(135deg, rgba(3, 172, 239, 0.1), rgba(241, 167, 42, 0.1));
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.pwa-manual-instructions p {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.5;
}

.pwa-manual-instructions strong {
  color: var(--primary);
}


/* Dispatcher Action Menu */
.dispatcher-action-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px;
  min-width: 160px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-top: 4px;
}

.dispatcher-action-menu .menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  color: var(--text-color);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.875rem;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dispatcher-action-menu .menu-item:hover {
  background: var(--bg-hover);
}

.dispatcher-action-menu button.menu-item {
  font-family: inherit;
}
