/* CSS Variables */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-ultralight: #dbeafe;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* Background Animation */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 80%,
      rgba(120, 119, 198, 0.3) 0%,
      transparent 50%),
    radial-gradient(circle at 80% 20%,
      rgba(255, 119, 198, 0.15) 0%,
      transparent 50%),
    radial-gradient(circle at 40% 40%,
      rgba(120, 219, 255, 0.2) 0%,
      transparent 50%);
  z-index: -1;
  animation: float 20s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-20px) rotate(1deg);
  }
}

/* Container */
.container {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

/* Brand Header */
.brand-header {
  text-align: center;
  margin-bottom: 2rem;
  animation: slideDown 0.8s ease-out;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg,
      var(--primary) 0%,
      var(--primary-light) 100%);
  border-radius: 16px;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-lg);
}

.brand-logo i {
  font-size: 24px;
  color: white;
}

.brand-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.brand-header p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
}

/* Form Container */
.form-container {
  background: var(--surface);
  padding: 3rem 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
  animation: slideUp 0.6s ease-out 0.2s both;
  position: relative;
  overflow: hidden;
}

.form-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg,
      var(--primary) 0%,
      var(--primary-light) 100%);
}

.form-container h2 {
  color: var(--text-primary);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 2rem;
  text-align: center;
  letter-spacing: -0.5px;
}

/* Form Groups */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition);
}

.input-wrapper {
  position: relative;
}

.input-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: var(--transition);
  z-index: 1;
}

.form-group input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  padding-left: 3.2rem;
}

.form-group input:focus+i {
  color: var(--primary);
  transform: translateY(-50%) scale(1.1);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

/* Button */
.btn {
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg,
      var(--primary) 0%,
      var(--primary-light) 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.2),
      transparent);
  transition: left 0.7s;
}

.btn:hover::before {
  left: 100%;
}

/* Form Switch */
.switch-form {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.switch-form a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  margin-left: 0.25rem;
}

.switch-form a:hover {
  color: var(--primary-dark);
}

.switch-form a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.switch-form a:hover::after {
  width: 100%;
}

/* Password Strength Indicator */
.password-strength {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
  position: relative;
}

.password-strength::before {
  content: "";
  position: absolute;
  height: 100%;
  width: 0;
  background: var(--error);
  transition: all 0.5s ease;
  border-radius: 2px;
}

#signup-password:focus~.password-strength::before {
  width: 25%;
  background: var(--error);
}

#signup-password:valid~.password-strength::before {
  width: 50%;
  background: var(--warning);
}

#signup-password:valid[data-strength="strong"]~.password-strength::before {
  width: 100%;
  background: var(--success);
}

/* Error and Success States */
.error-message {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.form-group.error .error-message {
  display: flex;
}

.form-group.error input {
  border-color: var(--error);
}

.form-group.success input {
  border-color: var(--success);
}

/* Loading State */
.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

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

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

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

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 480px) {
  .container {
    max-width: 100%;
  }

  .form-container {
    padding: 2.5rem 1.5rem;
    margin: 0 10px;
  }

  .form-container h2 {
    font-size: 1.5rem;
  }

  .brand-header h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 320px) {
  .form-container {
    padding: 2rem 1rem;
  }

  body {
    padding: 10px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --background: #0f172a;
    --surface: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-light: #1e293b;
  }

  body {
    background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
  }
}

/* Floating Elements */
.floating-elements {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.floating-element {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: floatElement 15s infinite linear;
}

.floating-element:nth-child(1) {
  width: 80px;
  height: 80px;
  top: 10%;
  left: 10%;
  animation-duration: 20s;
}

.floating-element:nth-child(2) {
  width: 120px;
  height: 120px;
  top: 60%;
  right: 10%;
  animation-duration: 25s;
  animation-direction: reverse;
}

.floating-element:nth-child(3) {
  width: 60px;
  height: 60px;
  bottom: 20%;
  left: 20%;
  animation-duration: 18s;
}

@keyframes floatElement {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-20px) rotate(180deg);
  }

  100% {
    transform: translateY(0) rotate(360deg);
  }
}