/* login.php - tokens come from css/style.css, loaded before this file.
 *
 * ============================================================
 * DELIBERATE EXCEPTION - read before "fixing" this to var(--bg)
 * ============================================================
 * Every other page in the app shares one flat --bg per the site-wide
 * "one consistent background" rule. Login and signup are the ONE
 * explicit, requested exception: they keep their pre-redesign dark
 * gradient + blurred-photo "glass" background on purpose, restored
 * after the redesign because that's what the client actually wanted
 * for these two pages specifically. Do NOT change body/.login-wrapper
 * back to var(--bg) in a future pass - that would silently undo an
 * intentional design decision, not fix a bug.
 *
 * This gradient/collage/glass treatment is DELIBERATELY IDENTICAL to
 * signup.css (same hex values, same blur/opacity numbers) - login and
 * signup are meant to look like one matched flow, not two similar-but-
 * different ones. If you change one side, change the other the same way.
 *
 * Everything below the background (card radius/shadow language via
 * tokens, inputs, buttons, Fraunces/Inter typography) still comes from
 * the shared design system - only the page background and the card's
 * glass treatment (plus a few text colors that need to stay light to
 * stay readable on that dark glass) are the exception.
 */

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1c2c 0%, #312e81 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
}

.login-wrapper {
  min-height: 100vh;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Blurred product-photo backdrop + tint mask - identical treatment to
   signup.css's .signup-wrapper::before/::after (uploads/preloader_bg.png,
   blurred/dimmed, then tinted navy so it reads as part of the gradient). */
.login-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url('../uploads/preloader_bg.png') center/cover no-repeat;
  filter: blur(12px) brightness(0.4) saturate(1.3);
  opacity: 0.6;
  z-index: 1;
}

.login-wrapper::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(30, 27, 75, 0.6);
  z-index: 2;
}

.login-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(25px) saturate(200%);
  -webkit-backdrop-filter: blur(25px) saturate(200%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  padding: 3rem 2.5rem;
  max-width: 420px;
  width: 90%;
  position: relative;
  z-index: 10;
  animation: slideUp 0.5s ease-out;
}

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

/* Sits directly on the translucent glass (not inside a light input box),
   so it needs to stay light/white regardless of the --ink token used
   for headings everywhere else - dark text here would be unreadable
   against the dark gradient + photo behind the glass. */
.login-title {
  text-align: center;
  margin-bottom: 2rem;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.form-alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  text-align: center;
  position: relative;
  z-index: 10;
}

.form-alert-error {
  background: rgba(245, 101, 101, 0.2);
  border: 1px solid rgba(245, 101, 101, 0.4);
  color: #ffd7d7;
}

.form-alert-success {
  background: rgba(72, 187, 120, 0.2);
  border: 1px solid rgba(72, 187, 120, 0.4);
  color: #d7ffe4;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  position: relative;
}

/* Label sits on the glass, not inside the (still-light) input box below
   it, so it needs the same light-text exception as .login-title. */
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 0.95rem;
}

.input-wrapper {
  position: relative;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 185, 252, 0.15);
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.05rem;
  transition: color 0.2s ease;
}

.form-group:focus-within .input-icon {
  color: var(--accent);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a7a68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.2em;
  padding-right: 3rem;
}

.login-submit {
  background: var(--accent);
  color: #04283a;
  border: none;
  padding: 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 0.25rem;
  box-shadow: 0 10px 24px rgba(46, 185, 252, 0.3);
}

.login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(46, 185, 252, 0.4);
}

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

.login-links {
  text-align: center;
  margin-top: 1.5rem;
}

.login-links a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}

.login-links a:hover {
  color: #fff;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .login-card {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }
}

/* Loading State */
.login-submit:disabled {
  opacity: 0.8;
  cursor: not-allowed;
  transform: none !important;
}

.login-loading {
  position: relative;
}

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