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

:root {
  /* Deep dark premium background */
  --bg-primary: #0a0a0f; 
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-border: rgba(255, 255, 255, 0.05);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.08);
  
  /* Typography */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-placeholder: #475569;
  
  /* Vibrant Accents */
  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --accent-secondary: #ec4899;
  --button-primary-bg: #8B5CF6;
  --button-primary-bg-hover: #7C3AED;
  --button-primary-text: #FFFFFF;
  --button-secondary-bg: rgba(255, 255, 255, 0.04);
  --button-secondary-bg-hover: rgba(255, 255, 255, 0.08);
  --button-secondary-border: rgba(255, 255, 255, 0.10);
  --button-secondary-text: #F8FAFC;
  --button-ghost-bg-hover: rgba(255, 255, 255, 0.06);
  --button-danger-bg: #DC2626;
  --button-danger-bg-hover: #B91C1C;
  --button-danger-subtle-bg: rgba(239, 68, 68, 0.13);
  --button-danger-subtle-bg-hover: rgba(239, 68, 68, 0.20);
  --button-danger-subtle-border: rgba(239, 68, 68, 0.25);
  --button-danger-subtle-text: #FECACA;
  --button-focus-ring: rgba(139, 92, 246, 0.45);
  --button-disabled-bg: rgba(148, 163, 184, 0.16);
  --button-disabled-text: #94A3B8;
  --button-radius: 8px;
  
  /* Status Colors */
  --error: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  
  /* Spatial */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ===== Light Theme ===== */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-border: rgba(0, 0, 0, 0.08);
  --bg-input: rgba(0, 0, 0, 0.03);
  --bg-input-focus: rgba(0, 0, 0, 0.06);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-placeholder: #94a3b8;
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-glow: rgba(79, 70, 229, 0.3);
  --accent-secondary: #d946ef;
  --button-primary-bg: #4F46E5;
  --button-primary-bg-hover: #4338CA;
  --button-primary-text: #FFFFFF;
  --button-secondary-bg: #FFFFFF;
  --button-secondary-bg-hover: #F1F5F9;
  --button-secondary-border: #CBD5E1;
  --button-secondary-text: #334155;
  --button-ghost-bg-hover: #F8FAFC;
  --button-danger-bg: #DC2626;
  --button-danger-bg-hover: #B91C1C;
  --button-danger-subtle-bg: #FEF2F2;
  --button-danger-subtle-bg-hover: #FEE2E2;
  --button-danger-subtle-border: #FECACA;
  --button-danger-subtle-text: #B91C1C;
  --button-focus-ring: rgba(79, 70, 229, 0.35);
  --button-disabled-bg: #CBD5E1;
  --button-disabled-text: #64748B;
  --error: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

[data-theme="light"] .shape {
  opacity: 0.15;
}

[data-theme="light"] .login-card {
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 0 20px rgba(255, 255, 255, 0.5);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ===== Animated Background ===== */
.background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.4;
  animation: float 20s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
  transition: opacity 0.5s ease;
  will-change: transform;
}

.shape-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent), transparent 60%);
  top: -20%;
  left: -10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-secondary), transparent 60%);
  bottom: -20%;
  right: -10%;
  animation-delay: -5s;
}

.shape-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #3b82f6, transparent 60%);
  top: 40%;
  left: 60%;
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  25% {
    transform: translate(30px, -40px) scale(1.05);
  }

  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }

  75% {
    transform: translate(15px, 35px) scale(1.03);
  }
}

/* ===== Login Container ===== */
.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 1rem;
  animation: fadeInUp 0.6s ease-out both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Login Card (Glassmorphism) ===== */
.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem 2.5rem;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 32px rgba(255, 255, 255, 0.02);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  z-index: 1;
}

/* ===== Header ===== */
.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  display: inline-flex;
  margin-bottom: 1rem;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    filter: drop-shadow(0 0 6px var(--accent-glow));
  }

  50% {
    filter: drop-shadow(0 0 18px var(--accent-glow));
  }
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== Form ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== Input Wrapper ===== */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-placeholder);
  pointer-events: none;
  transition: color var(--transition);
}

.input-wrapper input {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 2.8rem;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.input-wrapper input::placeholder {
  color: var(--text-placeholder);
  transition: opacity var(--transition);
}

.input-wrapper input:focus {
  background: var(--bg-input-focus);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
  transform: translateY(-1px);
}

.input-wrapper input:focus::placeholder {
  opacity: 0.5;
}

.input-wrapper input:focus~.input-icon,
.input-wrapper input:focus+.input-icon {
  color: var(--accent);
}

/* Focus icon color — using :has */
.input-wrapper:has(input:focus) .input-icon {
  color: var(--accent);
}

/* ===== Toggle Password ===== */
.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-placeholder);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

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

/* ===== Error Message ===== */
.error-message {
  display: block;
  min-height: 1.2rem;
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 0.3rem;
  transition: opacity var(--transition);
}

/* ===== Animations ===== */
.stagger-1 { animation: fadeInUp 0.5s ease-out 0.1s both; }
.stagger-2 { animation: fadeInUp 0.5s ease-out 0.2s both; }
.stagger-3 { animation: fadeInUp 0.5s ease-out 0.3s both; }
.stagger-4 { animation: fadeInUp 0.5s ease-out 0.4s both; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-6px); }
}

.shake {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

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

/* ===== Form Alert ===== */
.form-alert {
  display: none;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: center;
}

.form-alert.error {
  display: block;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--error);
  animation: slideDownAlert 0.3s ease-out both;
}

.form-alert.success {
  display: block;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: var(--success);
  animation: slideDownAlert 0.3s ease-out both;
}

/* ===== Submit Button ===== */
.btn-submit {
  width: 100%;
  gap: 0.5rem;
}

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

.btn-submit:disabled {
  background: var(--button-disabled-bg);
  color: var(--button-disabled-text);
  cursor: not-allowed;
  transform: none;
}

/* ===== Ripple Effect ===== */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 0.6s linear;
  background-color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ===== Spinner ===== */
.spinner {
  animation: spin 0.8s linear infinite;
}

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

/* ===== Input Error State ===== */
.form-group.has-error .input-wrapper input {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--button-radius);
  background: var(--button-secondary-bg);
  border: 1px solid var(--button-secondary-border);
  color: var(--button-secondary-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 100;
  flex-shrink: 0;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.4s ease;
}

.theme-toggle-icon-enter {
  animation: theme-toggle-icon-enter 0.4s ease;
}

@keyframes theme-toggle-icon-enter {
  from { opacity: 0; transform: rotate(-90deg) scale(0.5); }
  to { opacity: 1; transform: rotate(0deg) scale(1); }
}

.theme-toggle:hover {
  background: var(--button-secondary-bg-hover);
  transform: translateY(-1px);
  box-shadow: none;
}

.theme-toggle:active {
  transform: translateY(0);
}

.theme-toggle--fixed {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .login-card {
    padding: 2rem 1.25rem 1.5rem;
  }

  .login-header h1 {
    font-size: 1.3rem;
  }

  .theme-toggle--fixed {
    top: 0.75rem;
    right: 0.75rem;
    width: 36px;
    height: 36px;
  }

  .theme-toggle--fixed svg {
    width: 18px;
    height: 18px;
  }
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--button-radius);
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--button-focus-ring);
}

.btn-lg {
  min-height: 48px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 700;
}

.btn-icon-md {
  width: 40px;
  height: 40px;
  padding: 0;
}

.btn-icon-md svg {
  width: 20px;
  height: 20px;
}

.btn-primary {
  background: var(--button-primary-bg);
  border-color: transparent;
  color: var(--button-primary-text);
}

.btn-primary:hover:not(:disabled) {
  background: var(--button-primary-bg-hover);
  color: var(--button-primary-text);
}

.btn-secondary {
  background: var(--button-secondary-bg);
  border-color: var(--button-secondary-border);
  color: var(--button-secondary-text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--button-secondary-bg-hover);
  color: var(--button-secondary-text);
}
#login-form .btn.btn-primary {
  min-height: 48px !important;
  padding: 0 20px !important;
  border-radius: var(--button-radius) !important;
  background: var(--button-primary-bg) !important;
  color: var(--button-primary-text) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

#login-form .btn.btn-primary:hover {
  background: var(--button-primary-bg-hover) !important;
}
#toggle-password.btn-icon-md {
  width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  border-radius: var(--button-radius) !important;
  background: transparent !important;
}
