/**
 * SPACIO sign-in — split layout with marketing carousel
 */

:root,
html[data-theme="light"] {
  --auth-accent: #007a5e;
  --auth-accent-dark: #00513f;
  --auth-accent-soft: rgba(0, 122, 94, 0.14);
  --auth-panel-bg: #ffffff;
  --auth-text: #111827;
  --auth-text-muted: #6b7280;
  --auth-border: #e5e7eb;
  --auth-marketing-bg: linear-gradient(145deg, #00513f 0%, #007a5e 48%, #1a9a7a 100%);
}

html[data-theme="dark"] {
  --auth-accent: #2eb896;
  --auth-accent-dark: #1a9a7a;
  --auth-accent-soft: rgba(46, 184, 150, 0.18);
  --auth-panel-bg: #1a2030;
  --auth-text: #f3f4f6;
  --auth-text-muted: #9ca3af;
  --auth-border: rgba(255, 255, 255, 0.1);
  --auth-marketing-bg: linear-gradient(145deg, #003528 0%, #00513f 48%, #007a5e 100%);
}

body.auth-portal-theme {
  margin: 0;
  min-height: 100vh;
  font-family: var(--rp-font-sans, "Inter", system-ui, sans-serif);
  background: var(--auth-panel-bg);
  color: var(--auth-text);
}

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

.auth-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ---- Left: sign-in form ---- */
.auth-form-panel {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: var(--auth-panel-bg);
}

.auth-form-inner {
  width: 100%;
  max-width: 400px;
}

.auth-brand-mark {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 2.5rem;
}

.auth-brand-shapes {
  display: flex;
  gap: 0.2rem;
}

.auth-brand-shapes span {
  display: block;
  width: 1.1rem;
  height: 1.45rem;
  border-radius: 0.2rem;
  transform: skewX(-12deg);
}

.auth-brand-shapes span:nth-child(1) {
  background: var(--auth-accent);
  opacity: 0.95;
}

.auth-brand-shapes span:nth-child(2) {
  background: #6ee7b7;
  margin-left: -0.35rem;
}

.auth-brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--auth-text);
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--auth-text);
}

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

.auth-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem 1.25rem;
  border: none;
  border-radius: 0.65rem;
  background: var(--auth-accent);
  color: #fff !important;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 28px rgba(0, 122, 94, 0.28);
}

.auth-login-btn:hover {
  background: var(--auth-accent-dark);
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(0, 122, 94, 0.34);
}

.auth-login-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.auth-legal {
  margin: 1.75rem 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--auth-text-muted);
  text-align: center;
}

.auth-legal a {
  color: var(--auth-accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-legal a:hover {
  text-decoration: underline;
}

.auth-footer-note {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  color: var(--auth-text-muted);
  text-align: center;
}

.auth-debug {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--auth-text-muted);
  word-break: break-all;
}

.auth-debug code {
  font-size: 0.72rem;
}

/* ---- Right: marketing carousel ---- */
.auth-marketing-panel {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  background: var(--auth-marketing-bg);
  position: relative;
  overflow: hidden;
}

.auth-marketing-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.12), transparent 42%),
    radial-gradient(circle at 85% 80%, rgba(255, 255, 255, 0.08), transparent 38%);
  pointer-events: none;
}

.auth-carousel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

.auth-carousel-viewport {
  position: relative;
  min-height: 420px;
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 40, 32, 0.22);
}

.auth-carousel-viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.auth-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 2rem 1.75rem 1.5rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  pointer-events: none;
  z-index: 1;
}

.auth-slide.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  z-index: 2;
}

.auth-slide-visual {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1.5rem 0 1rem;
}

.auth-slide-icon {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 2.25rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.auth-slide h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  line-height: 1.3;
}

.auth-slide p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
}

.auth-carousel-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1.35rem;
}

.auth-carousel-dot {
  border: none;
  padding: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  width: 0.45rem;
  height: 0.45rem;
  transition: width 0.25s ease, background 0.25s ease;
}

.auth-carousel-dot.is-active {
  width: 1.75rem;
  background: #fff;
}

.auth-carousel-dot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Theme toggle */
.theme-toggle-auth {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  border: 1px solid var(--auth-border);
  background: var(--auth-panel-bg);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--auth-text-muted);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.theme-toggle-auth:hover {
  color: var(--auth-text);
}

/* Responsive */
@media (max-width: 991.98px) {
  .auth-split {
    flex-direction: column;
  }

  .auth-marketing-panel {
    order: -1;
    flex: 0 0 auto;
    min-height: 320px;
    padding: 2rem 1.5rem 1.5rem;
  }

  .auth-carousel-viewport {
    min-height: 260px;
  }

  .auth-slide-visual {
    padding: 0.75rem 0;
  }

  .auth-slide-icon {
    width: 4.25rem;
    height: 4.25rem;
    font-size: 1.75rem;
  }

  .auth-form-panel {
    flex: 1 1 auto;
    padding: 2rem 1.5rem 2.5rem;
  }
}

@media (max-width: 575.98px) {
  .auth-title {
    font-size: 1.55rem;
  }

  .auth-brand-mark {
    margin-bottom: 2rem;
  }
}
