/* Tokens just for login (independent of main base.html) */
:root {
  --bg: #f7f9fc;
  --bg-shell: #eef2ff;
  --panel: #ffffff;
  --ink: #0b1220;
  --muted: #6b7280;
  --border-subtle: rgba(148, 163, 184, 0.4);

  --brand: #63b446;
  --brand-600: #4f9737;

  --radius-lg: 24px;
  --radius-md: 12px;
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.3);

  --error-bg: rgba(239, 68, 68, 0.08);
  --error-border: rgba(248, 113, 113, 0.7);
  --error-ink: #b91c1c;
}

:root.dark {
  --bg: #020617;
  --bg-shell: #020617;
  --panel: rgba(15, 23, 42, 0.98);
  --ink: #f9fafb;
  --muted: #9ca3af;
  --border-subtle: rgba(148, 163, 184, 0.3);

  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.85);

  --error-bg: rgba(239, 68, 68, 0.14);
  --error-border: rgba(248, 113, 113, 0.7);
  --error-ink: #fee2e2;
}

/* Base layout */

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(140% 200% at 0% 0%, rgba(59, 130, 246, 0.12), transparent 60%),
    radial-gradient(140% 200% at 100% 0%, rgba(99, 180, 70, 0.16), transparent 60%),
    var(--bg);
  color: var(--ink);
}

main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}

/* Forgot-password modal */
.fp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
}
.fp-overlay[hidden] { display: none; }
.fp-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
}
.fp-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}
.fp-close:hover { color: var(--ink); }
.fp-title {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}
.fp-desc {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.fp-msg {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.fp-msg[hidden] { display: none; }
.fp-msg.is-success {
  background: rgba(99, 180, 70, 0.12);
  border: 1px solid rgba(99, 180, 70, 0.5);
  color: #2d6a1a;
}
:root.dark .fp-msg.is-success { color: #86efac; }
.fp-msg.is-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-ink);
}

/* Utilities */

.visually-hidden {
  position: absolute;
  clip: rect(0 0 0 0);
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
}

/* Page shell */

.login-page {
  width: 100%;
  max-width: 1080px;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 2.5rem;
  padding: 2.5rem;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.96));
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
}

:root.dark .login-shell {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.99));
}

/* Hero side */

.login-hero {
  position: relative;
  padding-right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  justify-content: center;
  align-items: center;
}

.login-hero::after {
  content: "";
  position: absolute;
  right: -1.25rem;
  top: 10%;
  bottom: 10%;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(148, 163, 184, 0.35),
    transparent
  );
}

/* Top Pestana logo – centered, dark in light mode, white in dark mode */
.login-logo {
  width: min(100%, 270px);
  height: auto;
  display: block;
  margin: 0 auto 0.35rem;
  object-fit: contain;
  object-position: center;
  filter: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.login-logo--light,
.login-logo--dark {
  width: min(100%, 270px);
  height: auto;
}

.login-logo--dark { display: none; }
:root:not(.dark) .login-logo--light {
  mix-blend-mode: multiply;
  filter: brightness(1.03) contrast(1.05) drop-shadow(0 1px 8px rgba(15, 23, 42, 0.10));
}
:root.dark .login-logo--light { display: none; }
:root.dark .login-logo--dark {
  display: block;
  mix-blend-mode: screen;
  filter: brightness(1.06) contrast(1.06) drop-shadow(0 0 10px rgba(120, 180, 255, 0.16));
}


/* Hero slider with dynamic height */

.hero-slider {
  position: relative;
  width: 100%;
  max-width: 460px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #020617;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.6);
  margin-bottom: 0.9rem;
}

/* Maintain aspect ratio so height is stable while slides fade */
.hero-slider::before {
  content: "";
  display: block;
  padding-top: 62%; /* ~16:10, adjust if you want taller/shorter */
}

/* Slides stacked, fade via opacity */
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s ease-in-out;
  pointer-events: none;
}

.hero-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* Slider dots */

.hero-slider-dots {
  position: absolute;
  left: 50%;
  bottom: 0.6rem;
  transform: translateX(-50%);
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: none;
  padding: 0;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.7);
}

.hero-dot.is-active {
  width: 18px;
  background: var(--brand);
}

/* Hero text block – tightened to look like the screenshot */

.login-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.15rem;
}

.login-hero-title {
  font-size: 1.2rem;
  line-height: 1.25;
  margin: 0;
  font-weight: 700;
  background: linear-gradient(90deg, #131722 0%, #1a2230 45%, #7fbf2f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap; /* keep full phrase on one line */
  width: min(100%, 560px);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

:root.dark .login-hero-title {
  background: linear-gradient(90deg, #f2f5f9 0%, #dfe7f1 45%, #9ad84b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}


.login-hero-copy {
  margin: 0.4rem auto 0;
  font-size: 0.98rem;
  color: var(--muted);
  width: min(100%, 560px);
  text-align: left;
}

.login-highlights {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.login-highlights li {
  color: var(--ink);
}

.login-highlights li::before {
  content: "•";
  margin-right: 0.4rem;
  color: var(--brand);
}

/* Card side */

/* Sign-in card */
.login-container {
  border-radius: 22px;
  padding: 1.75rem 1.75rem 0;  /* NO bottom padding */
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);

  display: flex;
  flex-direction: column;
  min-height: 620px;           /* taller card -> footer can sit lower */
}



/* Header */

.login-header {
  margin-bottom: 1.4rem;
}

.login-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.login-title {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ink);
}

.login-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

/* Theme toggle (driven by base.js via #themeToggle) */

.theme-toggle {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(249, 250, 251, 0.95);
  width: 42px;
  height: 24px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  font-size: 0.7rem;
  cursor: pointer;
}

:root.dark .theme-toggle {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
}

.theme-toggle-icon {
  flex: 1;
  text-align: center;
  opacity: 0.4;
}

/* visual emphasis based on theme */

:root:not(.dark) .theme-toggle-icon-sun {
  opacity: 1;
}

:root.dark .theme-toggle-icon-moon {
  opacity: 1;
}

/* Form */

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.9rem;
  color: var(--ink);
}

.form-group input {
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #f9fafb;
  color: #111827;
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

:root.dark .form-group input {
  background: rgba(15, 23, 42, 0.75);
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.6);
}

.form-group input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(99, 180, 70, 0.45);
  background: #ffffff;
}

:root.dark .form-group input:focus {
  background: rgba(15, 23, 42, 0.95);
}

.helper-note {
  font-size: 0.83rem;
  color: var(--muted);
}

/* Inline row */

.form-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.25rem;
  font-size: 0.88rem;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}

.checkbox input {
  width: 15px;
  height: 15px;
  border-radius: 4px;
}

/* Buttons */

button {
  font-family: inherit;
}

.btn-primary,
.btn-secondary,
.btn-tertiary,
.link-button {
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.7rem 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
  color: #f9fafb;
  transition:
    transform 0.06s ease,
    box-shadow 0.1s ease,
    filter 0.1s ease;
}

.btn-primary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(99, 180, 70, 0.6);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 10px 22px rgba(99, 180, 70, 0.4);
}

.btn-primary[disabled] {
  opacity: 0.7;
  cursor: progress;
}

.btn-primary .btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  display: none;
  animation: login-spin 0.75s linear infinite;
}

.btn-primary.is-loading .btn-spinner {
  display: inline-block;
}

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

.btn-secondary {
  flex: 1;
  background: #f9fafb;
  border-color: rgba(148, 163, 184, 0.8);
  color: #111827;
}

.btn-secondary:hover {
  background: #ffffff;
}

:root.dark .btn-secondary {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
}

.btn-tertiary {
  flex: 1;
  background: transparent;
  border-color: rgba(148, 163, 184, 0.4);
  color: var(--muted);
}

.btn-tertiary:hover {
  background: rgba(249, 250, 251, 0.8);
}

:root.dark .btn-tertiary {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.4);
  color: #e5e7eb;
}

.link-button {
  background: none;
  border: none;
  color: var(--brand-600);
  padding-inline: 0;
}

.link-button:hover {
  text-decoration: underline;
}

/* Actions layout */

.primary-actions {
  margin-top: 0.25rem;
}

.secondary-actions {
  margin-top: 0.7rem;
  display: flex;
  gap: 0.75rem;
}

.secondary-actions-inline {
  justify-content: flex-start;
}

.install-card {
  display: none !important; /* temporarily hidden */
  position: relative;
  z-index: 4;
  pointer-events: auto;
  margin-top: 0.75rem;
  padding: 0.8rem;
  border: 1px solid rgba(99, 180, 70, 0.45);
  border-radius: 12px;
  background: rgba(99, 180, 70, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: flex-start;
  color: #0f172a;
}

:root.dark .install-card {
  background: rgba(99, 180, 70, 0.16);
  border-color: rgba(153, 210, 126, 0.65);
  color: #e5e7eb;
}

.install-logo {
  width: 50px;
  height: 50px;
  border-radius: 0;
  object-fit: contain;
  border: 0;
  background: transparent;
  padding: 0;
}

.install-copy {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.86rem;
  color: var(--ink);
}

.install-copy span {
  color: var(--muted);
}

:root.dark .install-copy {
  color: #f8fafc;
}

:root.dark .install-copy span {
  color: #cbd5e1;
}

.install-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  z-index: 8;
  width: 100%;
}

.install-actions .btn-secondary,
.install-actions .link-button {
  pointer-events: auto !important;
  cursor: pointer;
  position: relative;
  z-index: 9;
}

.install-actions .btn-secondary {
  width: 100%;
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.85);
  color: #0f172a;
}

:root.dark .install-actions .btn-secondary {
  background: #f8fafc;
  border-color: rgba(203, 213, 225, 0.95);
  color: #0f172a;
}

.install-actions .link-button {
  color: #047857;
  font-weight: 600;
}

:root.dark .install-actions .link-button {
  color: #b9e7a6;
}

.install-card-left {
  max-width: 460px;
  margin-top: 0.9rem;
}

/* Feedback */

.error {
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-ink);
  font-size: 0.9rem;
}

/* Footer */

/* Footer inside card */
.login-footer {
  margin-top: auto;        /* pushes footer to bottom of card */
  padding-top: 0.75rem;    /* small gap above logos */
  padding-bottom: 0;       /* no extra space below */
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  align-items: center;
}




/* Right-card logos: centered, subtle background, visible on both themes */
.footer-logos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  background: #f9fafb;
  border: 1px solid rgba(148, 163, 184, 0.35);
  margin: 0;               /* important: no extra margin */
}


:root.dark .footer-logos {
  background: rgba(15, 23, 42, 0.97);
  border-color: rgba(148, 163, 184, 0.5);
}

.footer-logo {
  height: 26px;
  max-width: 120px;
  width: auto;
  display: block;
}

.theme-logo-dark {
  display: none;
}

:root.dark .theme-logo-light,
[data-theme="dark"] .theme-logo-light {
  display: none;
}

:root.dark .theme-logo-dark,
[data-theme="dark"] .theme-logo-dark {
  display: block;
}

:root.dark .footer-logo-amago.theme-logo-dark,
[data-theme="dark"] .footer-logo-amago.theme-logo-dark {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  box-sizing: content-box;
  padding: 0.24rem 0.55rem;
}

.footer-logo.footer-logo-barra {
  max-width: none;
}

:root.dark .footer-logo {
  filter: brightness(1.08);
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}

/* Footer */

.login-footer {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  align-items: center;
}

/* Logos row – always on a light pill so colours & text stay readable */
.footer-logos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  background: #f9fafb; /* light background in both themes */
  border: 1px solid rgba(148, 163, 184, 0.35);
}

:root.dark .footer-logos {
  background: #f9fafb; /* keep logos on light pill even in dark mode */
  border-color: rgba(148, 163, 184, 0.6);
}

/* Logo images – no filters so original colours & text are preserved */
.footer-logo {
  height: 26px;
  max-width: 120px;
  width: auto;
  display: block;
}

/* explicitly avoid any filter in dark mode */
:root.dark .footer-logo {
  filter: none;
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}


.offline {
  display: none;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  background: rgba(249, 250, 251, 0.9);
  color: #111827;
}

/* If you add body.offline via JS, message will show */
body.offline .offline {
  display: inline-flex;
}

:root.dark .offline {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
}

.noscript-note {
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(250, 204, 21, 0.7);
  background: rgba(252, 211, 77, 0.16);
  color: #78350f;
}

:root.dark .noscript-note {
  color: #fef9c3;
}

/* Responsive */

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 2rem 1.5rem;
  }

  .login-hero {
    padding-right: 0;
  }

  .login-hero::after {
    display: none;
  }

  .login-logo {
    width: min(100%, 180px);
    height: auto;
  }

  .login-logo--light,
  .login-logo--dark {
    width: min(100%, 180px);
    height: auto;
  }
}

@media (max-width: 640px) {
  main {
    padding: 1.8rem 1rem;
  }

  .login-shell {
    padding: 1.6rem 1.25rem;
    border-radius: 20px;
  }

  .login-header-top {
    align-items: center;
  }

  .secondary-actions {
    flex-direction: column;
  }

  .login-logo,
  .login-logo--light,
  .login-logo--dark {
    width: min(100%, 140px);
    height: auto;
  }

  .login-hero-title {
    font-size: 1.05rem;
    white-space: normal;
  }

  .login-container {
    min-height: unset;
  }

  .footer-logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem;
    border-radius: 16px;
    width: 100%;
    box-sizing: border-box;
  }

  .footer-logo {
    height: 20px;
  }

  .footer-logo.footer-logo-barra {
    max-width: 110px;
  }
}
