/* Root Variables */
:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #06b6d4;
  
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Dark theme variables */
[data-bs-theme="dark"] {
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  
  --border-color: #334155;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* Global Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Flash Messages */
.flash-messages {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1050;
  max-width: 400px;
}

.flash-messages .alert {
  margin-bottom: 10px;
  border: none;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1040;
}

.theme-toggle .btn {
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  border: 2px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--primary-color);
  transition: all 0.3s ease;
}

.theme-toggle .btn:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: scale(1.05);
}

.theme-toggle .btn i {
  font-size: 1.2rem;
  color: inherit;
}

.theme-toggle .dropdown-menu {
  bottom: 60px;
  right: 0;
  top: auto;
  transform: translateY(0);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  background-color: var(--bg-primary);
}

.theme-toggle .dropdown-item {
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.theme-toggle .dropdown-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--primary-color);
}

.theme-toggle .dropdown-item.active,
.theme-toggle .dropdown-item:active {
  background-color: var(--primary-color);
  color: white;
}

.theme-toggle .dropdown-item i {
  color: inherit;
}

/* Authentication Styles */
.auth-container {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
}

.auth-form-container {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  background: var(--bg-primary);
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
}

.auth-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  box-shadow: var(--shadow-lg);
}

.auth-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.auth-form .form-floating {
  position: relative;
}

.auth-form .form-control {
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1rem 1rem 3rem;
  font-size: 1rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.auth-form .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
  background-color: var(--bg-primary);
}

.auth-form .form-floating > label {
  color: var(--text-secondary);
  font-weight: 500;
  padding-left: 3rem;
}

.auth-form .form-floating > label i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  z-index: 10;
}

.password-toggle:hover {
  color: var(--primary-color);
  background-color: var(--bg-tertiary);
}

.auth-btn {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  border: none;
  border-radius: 12px;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, var(--primary-hover), #7c3aed);
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
}

.auth-link:hover {
  color: var(--primary-hover);
  background-color: var(--bg-tertiary);
  text-decoration: none;
}

.auth-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

/* Hero Section */
.auth-hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.auth-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%236366f1" fill-opacity="0.05" fill-rule="nonzero"><path d="m36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/></g></g></svg>') repeat;
  opacity: 0.3;
}

.auth-hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 500px;
  color: white;
}

.hero-icon {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.hero-icon i {
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.hero-icon i:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.2);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: white;
}

.hero-description {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 3rem;
  color: rgba(255, 255, 255, 0.9);
}

.hero-features {
  display: grid;
  gap: 1.5rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.feature-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(5px);
}

.feature-item i {
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.9);
  min-width: 2rem;
}

.feature-item span {
  font-weight: 500;
  color: white;
}

/* Dashboard Styles */
.dashboard-container {
  min-height: 100vh;
  background-color: var(--bg-secondary);
}

/* Form Validation */
.form-control:invalid {
  border-color: var(--danger-color);
}

.form-control:valid {
  border-color: var(--success-color);
}

.password-strength {
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .auth-form-container {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  .auth-title {
    font-size: 1.75rem;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-icon {
    gap: 1rem;
  }
  
  .hero-icon i {
    font-size: 2rem;
    padding: 1rem;
  }
  
  .theme-toggle {
    bottom: 100px;
    right: 15px;
  }
  
  .flash-messages {
    left: 15px;
    right: 15px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .auth-form-container {
    border-radius: 16px;
  }
  
  .auth-logo {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
  
  .hero-icon {
    flex-direction: column;
    gap: 1rem;
  }
  
  .feature-item {
    padding: 0.75rem;
  }
}

/* Custom Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.auth-form-container {
  animation: fadeInUp 0.6s ease-out;
}

.auth-hero-content {
  animation: slideInRight 0.8s ease-out 0.2s both;
}

/* Smooth transitions for theme switching */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Focus styles for accessibility */
.form-control:focus,
.btn:focus,
.auth-link:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
  }
  
  [data-bs-theme="dark"] {
    --border-color: #ffffff;
  }
}

/* Table Styling */
.table-current-user {
  background-color: rgba(99, 102, 241, 0.08) !important;
  border-left: 4px solid var(--primary-color);
}

.table-current-user td {
  color: var(--text-primary);
  font-weight: 500;
}

.table-current-user .text-muted {
  color: var(--text-secondary) !important;
  font-weight: 600;
}

[data-bs-theme="dark"] .table-current-user {
  background-color: rgba(99, 102, 241, 0.15) !important;
  border-left: 4px solid var(--primary-color);
}

[data-bs-theme="dark"] .table-current-user td {
  color: var(--text-primary);
}

[data-bs-theme="dark"] .table-current-user .text-muted {
  color: #cbd5e1 !important;
  font-weight: 600;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}