/* login.css – TaskFlow2 Authentication Page */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(145deg, #0f0c29, #302b63, #24243e);
  min-height: 100vh;
  color: #e0e0e0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Animated background orbs ---- */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
  animation: floatOrb 8s ease-in-out infinite alternate;
}
body::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #6c5ce7, transparent);
  top: -100px;
  left: -100px;
}
body::after {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #00b894, transparent);
  bottom: -80px;
  right: -80px;
  animation-delay: -4s;
}

@keyframes floatOrb {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.1); }
}

/* ---- Loader ---- */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 41, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #6c5ce7;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  background: rgba(30, 28, 58, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 20px;
  color: #fff;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}
.toast.success { border-left: 4px solid #2ecc71; }
.toast.error   { border-left: 4px solid #e74c3c; }
.toast.info    { border-left: 4px solid #6c5ce7; }
.toast i { font-size: 1.1rem; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Auth Container ---- */
.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 16px;
  animation: cardEntrance 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(32px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Auth Card ---- */
.auth-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  padding: 40px 36px;
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

/* ---- Brand ---- */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.auth-brand-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: 0 8px 20px rgba(108, 92, 231, 0.4);
}
.auth-brand-text h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.auth-brand-text p {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
}

/* ---- Tabs ---- */
.auth-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
}
.auth-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-tab.active {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.35);
}
.auth-tab:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* ---- Forms ---- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: formFadeIn 0.25s ease both;
}
.auth-form.hidden {
  display: none;
}

@keyframes formFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.3px;
}

/* Input wrapper for icon support */
.input-wrapper {
  position: relative;
}
/* Left-side decorative icon (direct child only, NOT the eye inside the toggle button) */
.input-wrapper > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.9rem;
  pointer-events: none;
  transition: color 0.2s;
}
.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
}
.input-wrapper input:focus {
  border-color: #6c5ce7;
  background: rgba(108, 92, 231, 0.08);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.18);
}
.input-wrapper input:focus + i,
.input-wrapper input:focus ~ i,
.input-wrapper:focus-within > i {
  color: #a29bfe;
}
.input-wrapper input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

/* Password toggle */
.input-wrapper .toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  /* Must be 'all' so the button itself receives clicks */
  pointer-events: all;
  transition: color 0.2s;
  z-index: 2;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.input-wrapper .toggle-password:hover {
  color: rgba(255, 255, 255, 0.7);
}
/* The <i> INSIDE the toggle button: reset any inherited absolute positioning
   and prevent pointer events from swallowing clicks before the button gets them */
.input-wrapper .toggle-password i {
  position: static;
  transform: none;
  left: auto;
  top: auto;
  pointer-events: none;
}
/* Adjust right padding when toggle button is present so text doesn't overlap it */
.input-wrapper input.has-toggle {
  padding-right: 44px;
}

/* ---- Error message ---- */
.auth-error {
  display: none;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-left: 4px solid #e74c3c;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: #ff8a80;
  align-items: center;
  gap: 10px;
  animation: formFadeIn 0.2s ease;
}
.auth-error.show {
  display: flex;
}
.auth-error i {
  flex-shrink: 0;
  font-size: 1rem;
}

/* ---- Submit button ---- */
.btn-auth {
  width: 100%;
  padding: 13px 24px;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s, opacity 0.2s;
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}
.btn-auth:hover {
  box-shadow: 0 8px 28px rgba(108, 92, 231, 0.55);
  transform: translateY(-1px);
}
.btn-auth:active {
  transform: scale(0.98);
}
.btn-auth:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-auth .spinner-sm {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none;
}
.btn-auth.loading .spinner-sm { display: block; }
.btn-auth.loading .btn-text   { display: none; }

/* ---- Footer note ---- */
.auth-footer-note {
  text-align: center;
  margin-top: 20px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.28);
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .auth-card {
    padding: 28px 22px;
    border-radius: 22px;
  }
  .auth-brand-icon {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    border-radius: 13px;
  }
  .auth-brand-text h1 {
    font-size: 1.2rem;
  }
}
