:root {
  --bg-1: #0b1020;
  --bg-2: #0f172a;
  --bg-3: #111827;
  --bg-4: rgba(15, 23, 42, 0.65);
  --card-bg: rgba(30, 41, 59, 0.8);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --text-main: #e5e7eb;
  --text-muted: #9aa3b2;
  --border: rgba(148, 163, 184, 0.2);
  --input-bg: rgba(15, 23, 42, 0.45);
  --input-bg-focus: rgba(48, 75, 131, 0.65);
 
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.28) 0%, transparent 45%),
    radial-gradient(circle at 80% 60%, rgba(236, 72, 153, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 65% 85%, rgba(59, 130, 246, 0.2) 0%, transparent 45%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  min-height: 100vh;
  color: var(--text-main);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 480px;
  background: var(--bg-4);
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  padding: 34px 30px 28px;
  box-sizing: border-box;
  backdrop-filter: blur(18px);
}

.login-card .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
  gap: 8px;
}

/* Images */
.brand-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin-bottom: 4px;
}

img.image-error {
  max-width: 350px;
  width: 350px !important;
  height: auto !important;
  object-fit: contain;
  margin-bottom: 12px;
  display: block;
}

.brand-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.login-heading {
  margin: 8px 0 18px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  color: var(--text-main);
}

.login-card form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* Bloque de error */
.login-card .error-message {
  grid-column: 1 / -1;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  visibility: hidden;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
}

.login-card .error-message.active {
  visibility: visible;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 6px 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  background: var(--input-bg);
  width: 100%;
  min-height: 44px;
}

.field-password {
  padding-right: 4px;
}

.field-with-toggle {
  padding-right: 46px;
}

.field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
  background: var(--input-bg-focus);
  color: var(--text-main) !important;
}

.field .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.field input {
  border: none;
  outline: none;
  flex: 1;
  width: 100%;
  font-size: 14px;
  color: var(--text-main);
  padding: 8px;
  background: transparent !important;
  -webkit-text-fill-color: var(--text-main);
}

.field input.form-control {
  background: transparent !important;
  color: var(--text-main) !important;
}

input#id_username.form-control {
  max-width: 85% !important;
}

.field input.form-control:focus {
  background: transparent !important;
  color: var(--text-main);
}

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

.field input:focus {
  color: var(--text-main);
  background: transparent !important;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);

}

/* Chrome autofill */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field input:-webkit-autofill:active {
  -webkit-transition: background-color 9999s ease-out 0s;
  transition: background-color 9999s ease-out 0s;
  background-color: transparent !important;
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
  box-shadow: 0 0 0 1000px var(--input-bg) inset;
  -webkit-text-fill-color: var(--text-main);
  caret-color: var(--text-main);
}

.field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg-focus) inset;
  box-shadow: 0 0 0 1000px var(--input-bg-focus) inset;
}

input#id_username.form-control {
  max-width: 85% !important;
}

.toggle-password {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.toggle-password:hover {
  color: var(--text-main);
}

.btn-login {
  margin-top: 6px;
  width: 100%;
  border: none;
  background: var(--primary);
  color: #ffffff;
  padding: 12px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.3);
}

a.btn-login {
  text-align: center;
  display: block;
  text-decoration: none;
}

.btn-login:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

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

.forgot {
  display: block;
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

.forgot:hover {
  text-decoration: underline;
}

.login-heading {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.recovery-instructions {
  font-size: 14px;
  color: var(--text-muted);
  padding: 14px;
  text-align: center;
}

@media (max-width: 480px) {
  .login-card {
    padding: 24px 18px 20px;
    border-radius: 18px;
    width: 100%;
  }

  .brand-logo {
    width: 72px;
    height: 72px;
  }
}
