/* Auth screens (admin panel + group portals). Bootstrap 5 base, custom brand layer.
   Auto Insights palette (Manual de identidad): purple #50368D, deep purple #3D2966,
   lime #BFC760, gray #6F706A, black #1C1D18.
   --accent is the brand purple on the admin panel and the group's color on portals. */
:root {
  --bs-font-sans-serif: "Maven Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ai-purple: #50368d;
  --ai-purple-deep: #3d2966;
  --ai-lime: #bfc760;
  --ai-gray: #6f706a;
  --ai-black: #1c1d18;
  --accent: var(--ai-purple);
  --accent-hover: color-mix(in srgb, var(--accent) 76%, var(--ai-black));
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  /* Highlight on the dark hero: brand lime everywhere. */
  --accent-light: var(--ai-lime);
  --ink: var(--ai-black);
  --muted: var(--ai-gray);
  --line: #d0d5dd;
  --surface: #f4f3f8;
  --radius: 12px;
}

* { -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--bs-font-sans-serif);
  color: var(--ink);
  background: var(--ai-black);
  min-height: 100vh;
}

/* ---------- Background photo (slow zoom) ---------- */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.auth-bg::before {
  content: "";
  position: absolute;
  inset: -2%;
  background-image: var(--auth-bg);
  background-size: cover;
  background-position: center;
  animation: auth-zoom 28s ease-in-out infinite alternate;
}
.auth-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(28, 29, 24, .1) 0%, rgba(28, 29, 24, .5) 60%, rgba(28, 29, 24, .9) 100%),
    linear-gradient(100deg, rgba(61, 41, 102, .92) 0%, rgba(61, 41, 102, .72) 40%, rgba(61, 41, 102, .3) 75%),
    radial-gradient(circle at 10% 100%, rgba(191, 199, 96, .22) 0%, transparent 40%);
}
@keyframes auth-zoom {
  from { transform: scale(1); }
  to   { transform: scale(1.08) translate(-1%, -1%); }
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

/* ---------- Hero (left, desktop only) ---------- */
.auth-hero {
  flex: 1 1 auto;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 3rem;
  color: #fff;
}
.auth-hero-top {
  display: flex;
  align-items: center;
}
.auth-hero-top img { height: 40px; width: auto; }
.auth-hero-body { max-width: 560px; animation: auth-rise .7s ease-out both; }
.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .8rem;
  margin-bottom: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--ai-lime) 60%, transparent);
  color: var(--ai-lime);
  border-radius: 999px;
  background: rgba(191, 199, 96, .1);
  backdrop-filter: blur(6px);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.auth-hero h1 {
  font-size: clamp(2rem, 3.2vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1rem;
}
.auth-hero h1 span { color: var(--accent-light); }
.auth-hero p.lead { color: rgba(255, 255, 255, .8); font-size: 1.1rem; margin-bottom: 1.75rem; }
.auth-features { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.auth-features li { display: flex; align-items: center; gap: .7rem; color: rgba(255, 255, 255, .88); }
.auth-features svg { flex: none; width: 20px; height: 20px; color: var(--ai-lime); }
.auth-hero-foot { font-size: .85rem; color: rgba(255, 255, 255, .6); }
.auth-powered {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .9rem;
}
.auth-powered img { height: 16px; width: auto; opacity: .75; }

/* ---------- Form panel (right) ---------- */
.auth-panel {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 20px;
  padding: 2.25rem 1.75rem 1.75rem;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .45);
  animation: auth-rise .5s ease-out both;
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 1.75rem; }
.auth-logo img { max-width: 260px; max-height: 80px; width: auto; height: auto; object-fit: contain; }
.auth-card-foot {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid #eef0f3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--muted);
}
.auth-card-foot svg { width: 14px; height: 14px; }

/* Undo the old per-view horizontal padding; the card already pads. */
.auth-card .px-4 { padding-left: 0 !important; padding-right: 0 !important; }
.auth-card .mx-4 { margin-left: 0 !important; margin-right: 0 !important; }

.auth-heading { text-align: center; margin-bottom: 1.5rem; }
.auth-heading h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: .3rem; }
.auth-heading p { color: var(--muted); font-size: .95rem; margin: 0; }
.auth-heading p strong { color: var(--ink); }

/* Vertical rhythm for the fields of every auth form. */
.auth-stack { display: grid; gap: .85rem; margin-bottom: 1.25rem; }
.auth-stack .form-floating { margin: 0 !important; }

.auth-back { margin-top: 1.25rem; text-align: center; font-size: .875rem; }
.auth-back a, .auth-back button { color: var(--muted); font-weight: 500; text-decoration: none; background: none; border: 0; padding: 0; }
.auth-back a:hover, .auth-back button:hover { color: var(--accent); }
.auth-back .sep { color: var(--line); margin: 0 .6rem; }

.btn-auth-outline {
  width: 100%;
  height: 3rem;
  margin-top: .75rem;
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 600;
}
.btn-auth-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* 2FA code input */
.otp-input { text-align: center; font-size: 1.6rem !important; letter-spacing: .5em; font-weight: 600; padding-left: 1.5em !important; }

@media (min-width: 992px) {
  .auth-hero { display: flex; }
  .auth-panel {
    flex: 0 0 520px;
    background: var(--surface);
    padding: 2rem 2.5rem;
    box-shadow: -20px 0 60px rgba(0, 0, 0, .25);
  }
  .auth-card { box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 12px 32px -8px rgba(16, 24, 40, .12); }
}
@media (min-width: 1400px) { .auth-panel { flex-basis: 580px; } }

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-bg::before, .auth-card, .auth-hero-body { animation: none; }
}

/* ---------- Form controls ---------- */
.form-control,
.form-select {
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.form-control.is-invalid:focus { box-shadow: 0 0 0 4px rgba(220, 53, 69, .15); }
.form-floating > .form-control,
.form-floating > .form-select { height: 3.5rem; min-height: 3.5rem; }
.form-floating > label { color: var(--muted); }
.form-label { font-size: .875rem; font-weight: 600; color: var(--ink); margin-bottom: .35rem; }
.auth-card .form-floating.mb-4, .auth-card .form-floating.my-4 { margin-top: 0 !important; margin-bottom: 1rem !important; }

/* Password show/hide toggle */
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 3rem; }
.pw-toggle {
  position: absolute;
  top: 0; right: 0;
  height: 3.5rem; width: 3rem;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: none;
  color: var(--muted);
  z-index: 5;
}
.pw-toggle:hover { color: var(--ink); }
.pw-toggle svg { width: 20px; height: 20px; }

/* ---------- Buttons ---------- */
.btn-alt-primary,
.btn-auth {
  color: #fff;
  background-color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: .65rem 1.4rem;
  font-weight: 600;
  transition: background-color .15s, transform .1s, box-shadow .15s;
}
.btn-alt-primary:hover,
.btn-alt-primary:focus-visible,
.btn-auth:hover,
.btn-auth:focus-visible {
  color: #fff;
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 8px 20px -8px var(--accent);
}
.btn-alt-primary:active, .btn-auth:active { transform: translateY(1px); color: #fff; background-color: var(--accent-hover); }
.btn-auth { width: 100%; height: 3.25rem; font-size: 1.05rem; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: #e4e7ec; }

.btn-google {
  width: 100%;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  background-color: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  transition: background-color .15s, border-color .15s;
}
.btn-google:hover { background-color: #f9fafb; border-color: #98a2b3; color: var(--ink); }
.btn-google img { width: 20px; height: 20px; }

.auth-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .25rem 0 1.25rem;
  font-size: .875rem;
}
.auth-links a { color: var(--muted); font-weight: 500; text-decoration: none; }
.auth-links a:hover { color: var(--accent); }

.link-fx {
  position: relative;
  text-decoration: none;
}
.link-fx::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 2px;
  background-color: var(--accent);
  transform: scaleX(0);
  transition: transform .12s ease-out;
}
.link-fx:hover::before { transform: scaleX(1); }

.alert { border-radius: 10px; font-size: .9rem; }
.invalid-feedback { display: block; }
