/* Login Page Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Arial, sans-serif;
  background: var(--bg-surface);
  transition: background 0.3s ease, color 0.3s ease;
}

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.login-app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--bg-gradient-start, #f8fafc) 0%, var(--bg-gradient-mid, #e2e8f0) 50%, var(--bg-gradient-end, #cbd5e1) 100%);
  position: relative;
  overflow: hidden;
}

/* AI Background Effects - Enhanced */
.login-app::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 140%;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 15% 20%, var(--primary-alpha-30, rgba(59, 130, 246, 0.3)) 0%, transparent 40%),
    radial-gradient(circle at 85% 30%, var(--accent-purple-alpha-25, rgba(168, 85, 247, 0.25)) 0%, transparent 50%),
    radial-gradient(circle at 25% 80%, var(--accent-cyan-alpha-25, rgba(6, 182, 212, 0.25)) 0%, transparent 45%),
    radial-gradient(circle at 70% 70%, var(--accent-green-alpha-20, rgba(16, 185, 129, 0.2)) 0%, transparent 55%),
    conic-gradient(from 45deg at 50% 50%, transparent, var(--primary-alpha-10, rgba(59, 130, 246, 0.1)), transparent);
  animation: aiGradientFlow 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes aiGradientFlow {
  0%, 100% {
    transform: scale(1.05) rotate(0deg) translate(-50%, -50%);
    opacity: 0.7;
  }
  25% {
    transform: scale(1.15) rotate(2deg) translate(-48%, -52%);
    opacity: 1;
  }
  50% {
    transform: scale(1.08) rotate(-1deg) translate(-52%, -48%);
    opacity: 0.8;
  }
  75% {
    transform: scale(1.12) rotate(1.5deg) translate(-48%, -50%);
    opacity: 0.9;
  }
}


/* Enhanced AI Data Grid & Security Matrix */
.circuit-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.15;
  background-image:
    /* Data nodes - representing database connections */
    radial-gradient(circle at 20% 20%, var(--primary) 3px, transparent 3px),
    radial-gradient(circle at 80% 20%, var(--accent-green) 2px, transparent 2px),
    radial-gradient(circle at 20% 80%, var(--accent-cyan) 2.5px, transparent 2.5px),
    radial-gradient(circle at 80% 80%, var(--accent-purple) 2px, transparent 2px),
    radial-gradient(circle at 50% 50%, var(--primary) 1.5px, transparent 1.5px),

    /* Security grid lines */
    linear-gradient(90deg, var(--primary-alpha-10, rgba(59, 130, 246, 0.1)) 1px, transparent 1px),
    linear-gradient(0deg, var(--primary-alpha-10, rgba(59, 130, 246, 0.1)) 1px, transparent 1px),

    /* Report data visualization dots */
    radial-gradient(circle at 35% 35%, var(--accent-green) 1px, transparent 1px),
    radial-gradient(circle at 65% 35%, var(--accent-cyan) 1px, transparent 1px),
    radial-gradient(circle at 35% 65%, var(--accent-purple) 1px, transparent 1px),
    radial-gradient(circle at 65% 65%, var(--primary) 1px, transparent 1px);

  background-size:
    120px 120px,   /* Main data nodes */
    140px 140px,   /* Secondary nodes */
    160px 160px,   /* Tertiary nodes */
    100px 100px,   /* Quaternary nodes */
    80px 80px,     /* Center node */
    40px 40px,     /* Grid horizontal */
    40px 40px,     /* Grid vertical */
    60px 60px,     /* Report dots 1 */
    70px 70px,     /* Report dots 2 */
    65px 65px,     /* Report dots 3 */
    55px 55px;     /* Report dots 4 */

  animation: dataMatrixFlow 18s ease-in-out infinite;
}

@keyframes dataMatrixFlow {
  0%, 100% {
    opacity: 0.1;
    transform: scale(1) rotate(0deg) translateX(0);
  }
  20% {
    opacity: 0.2;
    transform: scale(1.02) rotate(0.5deg) translateX(2px);
  }
  40% {
    opacity: 0.25;
    transform: scale(1.01) rotate(-0.3deg) translateX(-1px);
  }
  60% {
    opacity: 0.18;
    transform: scale(1.03) rotate(0.8deg) translateX(3px);
  }
  80% {
    opacity: 0.22;
    transform: scale(1) rotate(-0.6deg) translateX(-2px);
  }
}

/* Additional AI Processing Indicators */
.login-app::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 80%;
  pointer-events: none;
  background:
    conic-gradient(from 0deg at 15% 15%, transparent 340deg, var(--primary-alpha-10, rgba(59, 130, 246, 0.1)) 360deg),
    conic-gradient(from 90deg at 85% 15%, transparent 340deg, var(--accent-green-alpha-10, rgba(16, 185, 129, 0.1)) 360deg),
    conic-gradient(from 180deg at 85% 85%, transparent 340deg, var(--accent-cyan-alpha-10, rgba(6, 182, 212, 0.1)) 360deg),
    conic-gradient(from 270deg at 15% 85%, transparent 340deg, var(--accent-purple-alpha-10, rgba(168, 85, 247, 0.1)) 360deg);
  border-radius: 50%;
  animation: aiProcessingRings 25s linear infinite;
  opacity: 0.6;
}

@keyframes aiProcessingRings {
  0% {
    transform: rotate(0deg) scale(1);
    opacity: 0.4;
  }
  25% {
    transform: rotate(90deg) scale(1.05);
    opacity: 0.7;
  }
  50% {
    transform: rotate(180deg) scale(1.02);
    opacity: 0.5;
  }
  75% {
    transform: rotate(270deg) scale(1.08);
    opacity: 0.8;
  }
  100% {
    transform: rotate(360deg) scale(1);
    opacity: 0.4;
  }
}

/* Perspective Light Lines - Journey to Infinity */
.perspective-lights {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  perspective: 1000px;
  transform-style: preserve-3d;
}

.light-ray {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  background: rgba(255, 255, 255, 0.9);
  transform-origin: center center;
  opacity: 0;
  animation: lightJourney 8s infinite linear;
  filter: blur(0.5px) drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.light-ray:nth-child(1) {
  animation-delay: 0s;
  animation-duration: 6s;
}

.light-ray:nth-child(2) {
  animation-delay: -0.75s;
  animation-duration: 7s;
}

.light-ray:nth-child(3) {
  animation-delay: -1.5s;
  animation-duration: 5.5s;
}

.light-ray:nth-child(4) {
  animation-delay: -2.25s;
  animation-duration: 8s;
}

.light-ray:nth-child(5) {
  animation-delay: -3s;
  animation-duration: 6.5s;
}

.light-ray:nth-child(6) {
  animation-delay: -3.75s;
  animation-duration: 7.5s;
}

.light-ray:nth-child(7) {
  animation-delay: -4.5s;
  animation-duration: 5s;
}

.light-ray:nth-child(8) {
  animation-delay: -5.25s;
  animation-duration: 8.5s;
}

.light-ray:nth-child(9) {
  animation-delay: -6s;
  animation-duration: 6s;
}

.light-ray:nth-child(10) {
  animation-delay: -6.75s;
  animation-duration: 7s;
}

.light-ray:nth-child(11) {
  animation-delay: -7.5s;
  animation-duration: 5.5s;
}

.light-ray:nth-child(12) {
  animation-delay: -8.25s;
  animation-duration: 8s;
}

.light-ray:nth-child(13) {
  animation-delay: -9s;
  animation-duration: 6.5s;
}

.light-ray:nth-child(14) {
  animation-delay: -9.75s;
  animation-duration: 7.5s;
}

.light-ray:nth-child(15) {
  animation-delay: -10.5s;
  animation-duration: 5s;
}

.light-ray:nth-child(16) {
  animation-delay: -11.25s;
  animation-duration: 8.5s;
}

@keyframes lightJourney {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }
  10% {
    opacity: 0.6;
    transform: translate(-50%, -50%) translate(calc(var(--target-x) * 0.1), calc(var(--target-y) * 0.1)) scale(0.4);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) translate(calc(var(--target-x) * 0.3), calc(var(--target-y) * 0.3)) scale(0.8);
  }
  50% {
    opacity: 0.9;
    transform: translate(-50%, -50%) translate(calc(var(--target-x) * 0.6), calc(var(--target-y) * 0.6)) scale(1.2);
  }
  75% {
    opacity: 0.5;
    transform: translate(-50%, -50%) translate(calc(var(--target-x) * 0.8), calc(var(--target-y) * 0.8)) scale(1.8);
  }
  90% {
    opacity: 0.2;
    transform: translate(-50%, -50%) translate(calc(var(--target-x) * 0.95), calc(var(--target-y) * 0.95)) scale(2.4);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(var(--target-x), var(--target-y)) scale(3);
  }
}

.light-ray:nth-child(1) { --target-x: 180px; --target-y: -120px; }
.light-ray:nth-child(2) { --target-x: -200px; --target-y: 150px; }
.light-ray:nth-child(3) { --target-x: 250px; --target-y: 80px; }
.light-ray:nth-child(4) { --target-x: -150px; --target-y: -200px; }
.light-ray:nth-child(5) { --target-x: 120px; --target-y: 220px; }
.light-ray:nth-child(6) { --target-x: -280px; --target-y: -100px; }
.light-ray:nth-child(7) { --target-x: 300px; --target-y: -180px; }
.light-ray:nth-child(8) { --target-x: -100px; --target-y: 250px; }
.light-ray:nth-child(9) { --target-x: 220px; --target-y: -250px; }
.light-ray:nth-child(10) { --target-x: -250px; --target-y: 180px; }
.light-ray:nth-child(11) { --target-x: 160px; --target-y: 200px; }
.light-ray:nth-child(12) { --target-x: -180px; --target-y: -160px; }
.light-ray:nth-child(13) { --target-x: 270px; --target-y: 120px; }
.light-ray:nth-child(14) { --target-x: -220px; --target-y: -240px; }
.light-ray:nth-child(15) { --target-x: 140px; --target-y: -300px; }
.light-ray:nth-child(16) { --target-x: -300px; --target-y: 140px; }


.login-container {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated, rgba(255, 255, 255, 0.8));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light, rgba(255, 255, 255, 0.2));
  border-radius: var(--radius-xl, 16px);
  box-shadow: var(--shadow-xl, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
  padding: 2rem;
  transition: all 0.3s ease;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary, #3b82f6) 0%, var(--primary-light, #60a5fa) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
  box-shadow: 0 8px 32px var(--primary-alpha-20, rgba(59, 130, 246, 0.2));
}

.login-logo svg {
  width: 32px;
  height: 32px;
  fill: white;
}

.login-brand {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  font-weight: 500;
}

.login-description {
  font-size: 0.75rem;
  color: var(--text-tertiary, #9ca3af);
  margin-top: 0.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.login-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
}

.login-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-surface, #ffffff);
  color: var(--text-primary, #1f2937);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.login-input::placeholder {
  color: var(--text-tertiary, #9ca3af);
}

.login-input:focus {
  outline: none;
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 3px var(--primary-alpha-10, rgba(59, 130, 246, 0.1));
  background: var(--bg-elevated, #ffffff);
}

.login-forgot-password {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.login-forgot-link {
  font-size: 0.875rem;
  color: var(--primary, #3b82f6);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.login-forgot-link:hover {
  color: var(--primary-dark, #2563eb);
  text-decoration: underline;
}

.login-button {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--primary, #3b82f6);
  color: white;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-button:hover:not(:disabled) {
  background: var(--primary-dark, #2563eb);
  box-shadow: 0 4px 12px var(--primary-alpha-20, rgba(59, 130, 246, 0.2));
  transform: translateY(-1px);
}

.login-button:active:not(:disabled) {
  transform: translateY(0);
}

.login-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--accent-red, #ef4444);
  border-radius: var(--radius-md, 8px);
  padding: 0.75rem 1rem;
  color: var(--accent-red, #ef4444);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.login-error-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.login-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light, #e5e7eb);
}

.login-footer-text {
  font-size: 0.75rem;
  color: var(--text-tertiary, #9ca3af);
  font-weight: 500;
}

/* Forgot Password Specific Styles */
.forgot-password-info {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.5rem 0;
}

.forgot-password-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-orange, #f59e0b) 0%, var(--accent-red, #ef4444) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.3);
}

.forgot-password-icon i {
  font-size: 1.5rem;
  color: white;
}

.forgot-password-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  margin: 0 0 0.75rem 0;
}

.forgot-password-description {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  line-height: 1.6;
  margin: 0;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.login-back-to-login {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light, #e5e7eb);
}

.login-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.login-back-link:hover {
  color: var(--primary, #3b82f6);
}

.login-back-link i {
  font-size: 0.75rem;
}

.login-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-surface, rgba(255, 255, 255, 0.8));
  border: 1px solid var(--border-light, rgba(255, 255, 255, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary, #6b7280);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10001;
}

.login-theme-toggle:hover {
  background: var(--hover-bg, #f3f4f6);
  color: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
}

.login-theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.theme-icon-light {
  display: block;
}

.theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-dark {
  display: block;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-surface: #0f172a;
  --bg-elevated: rgba(30, 41, 59, 0.8);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --border-light: rgba(148, 163, 184, 0.2);
  --hover-bg: #1e293b;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --primary-alpha-10: rgba(59, 130, 246, 0.1);
  --primary-alpha-20: rgba(59, 130, 246, 0.2);
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  --accent-purple: #a855f7;
  --accent-cyan: #06b6d4;
  --accent-purple-alpha-10: rgba(168, 85, 247, 0.1);
  --accent-cyan-alpha-10: rgba(6, 182, 212, 0.1);
  --accent-purple-alpha-20: rgba(168, 85, 247, 0.2);
  --accent-cyan-alpha-20: rgba(6, 182, 212, 0.2);
  --radius-md: 8px;
  --radius-xl: 16px;
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --bg-gradient-start: #0f172a;
  --bg-gradient-mid: #1e293b;
  --bg-gradient-end: #334155;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-surface: #ffffff;
  --bg-elevated: rgba(255, 255, 255, 0.8);
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border-light: rgba(229, 231, 235, 0.6);
  --hover-bg: #f3f4f6;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --primary-alpha-10: rgba(59, 130, 246, 0.1);
  --primary-alpha-20: rgba(59, 130, 246, 0.2);
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  --accent-purple: #a855f7;
  --accent-cyan: #06b6d4;
  --accent-purple-alpha-10: rgba(168, 85, 247, 0.1);
  --accent-cyan-alpha-10: rgba(6, 182, 212, 0.1);
  --accent-purple-alpha-20: rgba(168, 85, 247, 0.2);
  --accent-cyan-alpha-20: rgba(6, 182, 212, 0.2);
  --radius-md: 8px;
  --radius-xl: 16px;
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --bg-gradient-start: #f8fafc;
  --bg-gradient-mid: #e2e8f0;
  --bg-gradient-end: #cbd5e1;
}

/* Password Requirements */
.password-requirements {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: rgba(var(--primary-rgb), 0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.requirements-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.requirements-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.requirements-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.requirements-icon {
  font-size: 0.75rem;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  transition: color 0.2s;
}

.requirements-icon--invalid {
  color: var(--accent-red);
}

.requirements-icon--valid {
  color: var(--accent-green);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .login-app {
    padding: 1rem 0.75rem;
  }

  .login-container {
    padding: 1.5rem;
  }

  .login-logo {
    width: 56px;
    height: 56px;
  }

  .login-logo svg {
    width: 28px;
    height: 28px;
  }

  .login-title {
    font-size: 1.25rem;
  }

  .login-theme-toggle {
    top: 0.75rem;
    right: 0.75rem;
  }

  .password-requirements {
    padding: 1rem;
  }

  .requirements-item {
    font-size: 0.75rem;
  }

  .perspective-lights .light-ray {
    animation-duration: 4s;
    width: 1px;
    height: 1px;
  }
}