/* ===== CSS Variables - Dark Mode ===== */
:root {
  --bg-dark: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-border: rgba(255, 255, 255, 0.1);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.1);
  --bg-select: rgba(20, 20, 28, 0.98);
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b7b;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #a855f7 100%);
  --glow-color: rgba(139, 92, 246, 0.4);
  --error: #ef4444;
  --success: #22c55e;
  --blur-amount: 24px;
  --card-radius: 28px;
}

/* ===== Dark mode – all dropdowns (select) ===== */
select {
  color-scheme: dark;
  background-color: var(--bg-select);
  color: var(--text-primary);
}

select option {
  background-color: #14141c;
  color: var(--text-primary);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Animated Gradient Circles ===== */
.gradient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  animation: float 20s ease-in-out infinite;
}

.circle-1 {
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  top: -15%;
  left: -10%;
  animation-delay: 0s;
}

.circle-2 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  top: 40%;
  right: -5%;
  animation-delay: -5s;
}

.circle-3 {
  width: 350px;
  height: 350px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  bottom: -10%;
  left: 20%;
  animation-delay: -10s;
}

.circle-4 {
  width: 250px;
  height: 250px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  top: 20%;
  right: 25%;
  animation-delay: -2s;
}

.circle-5 {
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
  bottom: 30%;
  left: -5%;
  animation-delay: -8s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(20px, 30px) scale(1.02); }
}

/* ===== Login Container ===== */
.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  animation: containerFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes containerFadeIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== Glassmorphism Card ===== */
.glass-card {
  position: relative;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--card-radius);
  padding: 2.75rem;
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 4px 6px -1px rgba(0, 0, 0, 0.3),
    0 24px 48px -12px rgba(0, 0, 0, 0.5),
    0 0 80px -20px rgba(139, 92, 246, 0.25),
    0 0 120px -40px rgba(59, 130, 246, 0.15);
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.4s ease,
              border-color 0.3s ease;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(139, 92, 246, 0.4) 50%,
    rgba(59, 130, 246, 0.3) 100%
  );
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.7;
  pointer-events: none;
}

.glass-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 12px 24px -8px rgba(0, 0, 0, 0.35),
    0 32px 64px -16px rgba(0, 0, 0, 0.5),
    0 0 100px -16px rgba(139, 92, 246, 0.35),
    0 0 140px -32px rgba(59, 130, 246, 0.2);
  border-color: rgba(255, 255, 255, 0.18);
}

.card-glow {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.6) 20%,
    rgba(139, 92, 246, 0.9) 50%,
    rgba(59, 130, 246, 0.6) 80%,
    transparent 100%
  );
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 24px rgba(139, 92, 246, 0.5);
}

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

.logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--accent-gradient);
  border-radius: 16px;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.35);
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: white;
}

.title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff 0%, #e0e0e8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* ===== Form Styles ===== */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.input-wrapper input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.25s ease;
}

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

.input-wrapper input:hover {
  background: var(--bg-input-focus);
  border-color: rgba(255, 255, 255, 0.15);
}

.input-wrapper input:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

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

/* Password toggle - icon is before the input in DOM, so we need different structure */
.input-wrapper .input-icon:first-of-type {
  left: 1rem;
}

.input-wrapper input[type="password"],
.input-wrapper input[type="email"] {
  padding-right: 3rem;
}

.toggle-password {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.toggle-password:hover {
  color: var(--accent-purple);
}

.eye-icon {
  width: 20px;
  height: 20px;
}

.input-error {
  font-size: 0.8rem;
  color: var(--error);
  min-height: 1.2em;
}

/* Form options */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-wrapper input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--bg-card-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.checkbox-wrapper input:checked + .checkmark {
  background: var(--accent-gradient);
  border-color: transparent;
}

.checkbox-wrapper input:checked + .checkmark::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.forgot-link {
  font-size: 0.875rem;
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.forgot-link:hover {
  color: var(--accent-purple);
}

/* Primary Button */
.btn-primary {
  position: relative;
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--accent-gradient);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.btn-primary .btn-loader {
  display: none;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-primary.loading .btn-text {
  opacity: 0;
}

.btn-primary.loading .btn-loader {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Sign up prompt */
.signup-prompt {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.signup-prompt a {
  color: var(--accent-purple);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.signup-prompt a:hover {
  color: var(--accent-blue);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  padding: 1rem 1.5rem;
  background: rgba(20, 20, 30, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: var(--error);
  color: #fca5a5;
}

.toast.success {
  border-color: var(--success);
  color: #86efac;
}

/* Responsive */
@media (max-width: 480px) {
  :root {
    --card-radius: 24px;
  }
  
  .glass-card {
    padding: 2rem;
  }
  
  .login-container {
    max-width: 100%;
  }
  
  .title {
    font-size: 1.5rem;
  }
  
  .form-options {
    flex-direction: column;
    align-items: flex-start;
  }
}
