@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-primary: #050508;
  --card-bg: rgba(15, 12, 30, 0.35);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.35);
  
  /* Cyber Neon Accents */
  --accent-purple: #7b2cbf;
  --accent-cyan: #00f2fe;
  --accent-pink: #ff007f;
  --accent-glow: rgba(123, 44, 191, 0.5);
  
  /* Status Colors */
  --success-color: #00f5d4;
  --success-glow: rgba(0, 245, 212, 0.5);
  --error-color: #ff0055;
  --error-glow: rgba(255, 0, 85, 0.5);

  /* Fonts */
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* --- Animated Glowing Backdrop --- */
.background-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: radial-gradient(circle at 50% 50%, #0d0b21, #050508);
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  mix-blend-mode: screen;
  pointer-events: none;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-purple);
  top: -10%;
  left: -10%;
  animation: float-blob-1 25s infinite alternate ease-in-out;
}

.blob-2 {
  width: 600px;
  height: 600px;
  background: var(--accent-cyan);
  bottom: -20%;
  right: -10%;
  animation: float-blob-2 30s infinite alternate ease-in-out;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: var(--accent-pink);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: float-blob-3 20s infinite alternate ease-in-out;
}

@keyframes float-blob-1 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(100px, 80px) scale(1.2) rotate(180deg); }
  100% { transform: translate(-50px, 150px) scale(0.9) rotate(360deg); }
}

@keyframes float-blob-2 {
  0% { transform: translate(0, 0) scale(1.1) rotate(0deg); }
  50% { transform: translate(-120px, -100px) scale(0.85) rotate(-180deg); }
  100% { transform: translate(60px, 80px) scale(1.05) rotate(-360deg); }
}

@keyframes float-blob-3 {
  0% { transform: translate(-50%, -50%) translate(0, 0) scale(0.9); }
  50% { transform: translate(-50%, -50%) translate(-80px, 120px) scale(1.2); }
  100% { transform: translate(-50%, -50%) translate(100px, -60px) scale(1); }
}

/* Subtle tech grid overlay */
.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* --- Container and Card --- */
.login-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
  transition: 
    transform var(--transition-normal), 
    box-shadow var(--transition-normal), 
    border-color var(--transition-normal),
    opacity var(--transition-slow);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  transform: skewX(-25deg);
  transition: 0.75s;
  pointer-events: none;
}

.login-card:hover::before {
  left: 120%;
}

.login-card:hover {
  border-color: rgba(123, 44, 191, 0.35);
  box-shadow: 
    0 25px 60px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(123, 44, 191, 0.15),
    inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

/* --- Header Section --- */
.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.logo-container {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
  position: relative;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.logo-container svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: url(#logo-grad);
  stroke-width: 2;
  transition: filter var(--transition-normal);
}

.logo-container::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.login-card:hover .logo-container {
  transform: translateY(-5px);
  border-color: transparent;
}

.login-card:hover .logo-container::after {
  opacity: 1;
}

.login-card:hover .logo-container svg {
  stroke: #ffffff;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.6));
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(to right, var(--text-primary), rgba(255,255,255,0.7));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-header p {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* --- Form Fields --- */
.form-group {
  position: relative;
  margin-bottom: 24px;
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.form-input {
  width: 100%;
  padding: 18px 20px;
  background: rgba(0, 0, 0, 0.25);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-primary);
  font-family: var(--font-family);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 
    0 0 20px rgba(0, 242, 254, 0.15),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

/* Floating Labels */
.form-label {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  pointer-events: none;
  transition: all var(--transition-normal);
}

/* When input is focused or has value, move the label up */
.form-input:focus ~ .form-label,
.form-input:not(:placeholder-shown) ~ .form-label {
  top: 0;
  transform: translateY(-50%) scale(0.85);
  left: 15px;
  padding: 0 8px;
  background: #110e20;
  color: var(--accent-cyan);
  font-weight: 600;
  border-radius: 4px;
}

.form-input:focus ~ .form-label {
  color: var(--accent-cyan);
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
}

/* Password eye toggle */
.password-toggle {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  outline: none;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.password-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* --- Error Notification Panel --- */
.error-panel {
  background: rgba(255, 0, 85, 0.08);
  border: 1px solid rgba(255, 0, 85, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  transform: translateY(-10px);
  opacity: 0;
  visibility: hidden;
  height: 0;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.error-panel.show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  height: auto;
  margin-bottom: 24px;
}

.error-panel svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--error-color);
  stroke-width: 2;
  flex-shrink: 0;
}

.error-panel span {
  font-size: 13px;
  font-weight: 500;
  color: #ffccd5;
  line-height: 1.4;
}

/* --- Interactive Submit Button --- */
.submit-btn {
  width: 100%;
  padding: 18px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #7b2cbf, #ff007f);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  z-index: 1;
  box-shadow: 
    0 4px 15px rgba(123, 44, 191, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  transition: all var(--transition-normal);
}

.submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ff007f, #7b2cbf);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 25px rgba(255, 0, 127, 0.5),
    0 0 20px rgba(123, 44, 191, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.submit-btn:hover::before {
  opacity: 1;
}

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

.submit-btn-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

/* --- Access States Animations --- */

/* Shaking Error State */
.shake-card {
  animation: shake 0.6s cubic-bezier(.36,.07,.19,.97) both;
  border-color: rgba(255, 0, 85, 0.45) !important;
  box-shadow: 
    0 25px 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(255, 0, 85, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.15) !important;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
  40%, 60% { transform: translate3d(8px, 0, 0); }
}

/* Loading/Success state on Button */
.submit-btn.loading {
  pointer-events: none;
  background: #151128;
  color: var(--text-secondary);
}

.submit-btn.loading::before {
  opacity: 0;
}

.submit-btn.loading .submit-btn-content {
  opacity: 0;
}

.submit-btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: calc(50% - 10px);
  left: calc(50% - 10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}

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

/* Access Granted (Success Animation) */
.submit-btn.success {
  background: var(--success-color) !important;
  box-shadow: 0 0 30px var(--success-glow) !important;
  color: #050508 !important;
  pointer-events: none;
}

.submit-btn.success::before {
  display: none;
}

.submit-btn.success .submit-btn-content {
  opacity: 1;
  color: #050508;
  font-weight: 700;
}

.submit-btn.success::after {
  display: none;
}

/* Dissolve / Zoom out card animation */
.card-granted {
  opacity: 0;
  transform: scale(0.92) translateY(15px);
  box-shadow: 
    0 0 100px rgba(0, 245, 212, 0.4),
    0 20px 50px rgba(0, 0, 0, 0.5) !important;
  border-color: rgba(0, 245, 212, 0.3) !important;
  pointer-events: none;
}

/* Dynamic scanning laser line */
.laser-scanner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--success-color), transparent);
  box-shadow: 
    0 0 15px var(--success-color),
    0 0 8px var(--success-color);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
}

.laser-scanner.scanning {
  animation: scan-vertical 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  opacity: 1;
}

@keyframes scan-vertical {
  0% { top: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Portal Success Display */
.portal-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(13, 11, 33, 0.95), #050508);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

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

.portal-loader {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 24px;
}

.portal-ring {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--success-color);
  border-radius: 50%;
  animation: spin-portal 1.5s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.portal-ring:nth-child(2) {
  inset: 10px;
  border-top-color: var(--accent-cyan);
  animation-duration: 1.2s;
  animation-direction: reverse;
}

.portal-ring:nth-child(3) {
  inset: 20px;
  border-top-color: var(--accent-pink);
  animation-duration: 0.9s;
}

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

.portal-overlay h2 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--success-color);
  margin-bottom: 12px;
  text-shadow: 0 0 20px var(--success-glow);
  text-transform: uppercase;
}

.portal-overlay p {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.5px;
}

.portal-terminal {
  width: 90%;
  max-width: 480px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 245, 212, 0.25);
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 30px;
  font-family: monospace;
  font-size: 13px;
  color: var(--success-color);
  text-align: left;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.portal-terminal-line {
  overflow: hidden;
  white-space: nowrap;
  border-right: .15em solid transparent;
}

/* Footer Credits */
.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.login-footer a:hover {
  color: var(--accent-cyan);
}

/* --- Floating Home Button --- */
.home-btn {
  position: absolute;
  top: 30px;
  left: 30px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 
    0 4px 15px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
  
  /* Modern CSS transitions with identity transforms for performance */
  translate: 0 0;
  scale: 1;
  transition: 
    translate var(--transition-fast),
    scale var(--transition-fast),
    color var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.home-btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-secondary);
  stroke-width: 2.5;
  translate: 0 0;
  transition: 
    translate var(--transition-fast), 
    stroke var(--transition-fast);
}

.home-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
  box-shadow: 
    0 8px 20px rgba(0, 242, 254, 0.15),
    0 0 10px rgba(0, 242, 254, 0.05),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
  translate: 0 -2px;
}

.home-btn:hover svg {
  stroke: var(--accent-cyan);
  translate: -3px 0;
}

.home-btn:active {
  translate: 0 0;
  scale: 0.98;
}

/* Adjust floating button position for tablet screens */
@media (max-width: 768px) {
  .home-btn {
    top: 20px;
    left: 20px;
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* Responsive Scaling tweaks */
@media (max-width: 480px) {
  .login-card {
    padding: 36px 24px;
    border-radius: 20px;
  }
  .login-header h1 {
    font-size: 24px;
  }
}
