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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  padding: 1rem;
}

/* ========== CARD ========== */
.card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  animation: fadeUp 0.5s ease both;
}

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

/* ========== HEADER ========== */
.logo {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 0.75rem;
}

h1 {
  color: #ffffff;
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
}

.subtitle {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 0.25rem;
  margin-bottom: 2rem;
}

/* ========== FORM FIELDS ========== */
.field {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

input:focus {
  border-color: #6c63ff;
  background: rgba(108, 99, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

input.invalid {
  border-color: #ff5c5c;
  background: rgba(255, 92, 92, 0.08);
}

/* ========== PASSWORD TOGGLE ========== */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 3rem;
}

.toggle-pass {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
  line-height: 1;
  padding: 0;
}

.toggle-pass:hover {
  opacity: 1;
}

/* ========== ERROR MESSAGES ========== */
.error-msg {
  display: block;
  color: #ff5c5c;
  font-size: 0.78rem;
  margin-top: 0.3rem;
  min-height: 1rem;
}

/* ========== OPTIONS ROW ========== */
.options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.remember {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  cursor: pointer;
}

.remember input[type="checkbox"] {
  width: auto;
  accent-color: #6c63ff;
}

.forgot {
  color: #a29bfe;
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.2s;
}

.forgot:hover {
  color: #ffffff;
}

/* ========== SUBMIT BUTTON ========== */
.btn-login {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, #6c63ff, #a29bfe);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.45);
  letter-spacing: 0.02em;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(108, 99, 255, 0.6);
}

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

.btn-login:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ========== LOADING SPINNER ========== */
.btn-login.loading::after {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

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

/* ========== REGISTER LINK ========== */
.register-link {
  text-align: center;
  margin-top: 1.5rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.875rem;
}

.register-link a {
  color: #a29bfe;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.register-link a:hover {
  color: #ffffff;
}

/* ========== TOAST NOTIFICATION ========== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #2d2d2d;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999;
  white-space: nowrap;
}

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

.toast.success { border-left: 4px solid #00b894; }
.toast.error   { border-left: 4px solid #ff5c5c; }
