/* Auth Pages CSS - CSP compliant external stylesheet */
/* DevOpser brand dark mode - see STYLE-GUIDE (marketing-site surface) */

/* Page ground: auth pages (login/signup/logout/error) link this file directly */
html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #000;
  background: linear-gradient(180deg, #000 0%, #1e1e1e 100%);
  background-attachment: fixed;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.6;
}

/* Base auth container = dark modal card */
.auth-form-container {
  max-width: 420px;
  margin: 40px auto;
  padding: 40px;
  background: #282828;
  border: 1px solid #444;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-form-container h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
}

.auth-form-container p {
  color: #ccc;
}

/* Form groups */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #ccc;
}

.form-group input[type="email"],
.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  background: #333333;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
  font-size: 16px; /* prevents iOS zoom */
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-group input::placeholder {
  color: #666;
}

.form-group input:focus {
  outline: none;
  border-color: #ED166C;
  box-shadow: 0 0 0 3px rgba(237, 22, 108, 0.15);
}

/* Auth button = primary gradient CTA */
.auth-button {
  display: inline-block;
  width: 100%;
  padding: 14px 32px;
  background: linear-gradient(135deg, #ED166C 0%, #c41058 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
  transition: transform 0.2s, box-shadow 0.2s;
}

.auth-button:hover {
  background: linear-gradient(135deg, #c41058 0%, #a00d48 100%);
  color: #fff;
  transform: translateY(-2px);
}

.auth-button:active {
  transform: scale(0.98);
}

.auth-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(237, 22, 108, 0.15);
}

.auth-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Secondary buttons */
.auth-button.secondary {
  background: #333333;
  border: 1px solid #444;
  color: #ccc;
  font-weight: 500;
  font-size: 0.875rem;
  margin-top: 10px;
  transition: all 0.2s;
}

.auth-button.secondary:hover {
  background: #3d3d3d;
  color: #fff;
  transform: translateY(-2px);
}

/* Button group */
.button-group {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.button-group .auth-button {
  flex: 1;
}

/* Flash messages - status colors on semi-transparent backgrounds */
.flash {
  padding: 12px 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  display: none;
  font-size: 0.9rem;
}

.flash.show {
  display: block;
}

.flash.error {
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #ff6b6b;
}

.flash.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.flash.info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  display: block;
}

/* Google OAuth button - deliberately neutral (recognizably Google) */
.social-auth {
  margin-bottom: 20px;
}

.google-auth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.google-auth-button:hover {
  background: #f8f9fa;
  border-color: #ccc;
  color: #1a1a1a;
}

.google-auth-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(237, 22, 108, 0.15);
}

/* Divider */
.social-auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
}

.social-auth-divider::before,
.social-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #444;
}

.social-auth-divider span {
  padding: 0 15px;
  color: #888;
  font-size: 14px;
}

/* Magic link specific styles */
.magic-link-auth {
  margin-top: 20px;
}

#magic-link-code-step {
  display: none;
}

#magic-link-code-step.show {
  display: block;
}

#magic-link-email-step.hide {
  display: none;
}

.magic-code-input {
  font-size: 24px !important;
  letter-spacing: 8px;
  text-align: center;
  font-family: 'Courier New', monospace;
  padding: 15px !important;
}

.code-instruction {
  text-align: center;
  margin-bottom: 10px;
  color: #ccc;
}

.code-instruction strong {
  color: #fff;
}

.code-hint {
  text-align: center;
  font-size: 0.85em;
  color: #888;
  margin-bottom: 15px;
}

/* Auth links */
.auth-links {
  margin-top: 20px;
  text-align: center;
  color: #888;
}

.auth-links a {
  color: #ED166C;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-links a:hover {
  color: #c41058;
  text-decoration: underline;
}

.auth-links a:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: 0 0 0 3px rgba(237, 22, 108, 0.15);
}

/* Signup page specific - info status note */
.redirect-note {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.redirect-note p {
  margin: 10px 0;
  color: #60a5fa;
}

.signup-continue-btn {
  display: inline-block;
  text-decoration: none;
}

/* Error page (error.ejs) */
body.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.error-card {
  max-width: 600px;
  width: 100%;
  padding: 40px;
  background: #282828;
  border: 1px solid #444;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.error-card h1 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 2.25rem;
  font-weight: 700;
  color: #fff;
}

.error-card .error-message {
  color: #ccc;
  font-size: 1rem;
}

.error-card .error-stack {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #333333;
  border: 1px solid #444;
  border-radius: 8px;
  color: #ccc;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-home-link {
  display: inline-block;
  margin-top: 1.5rem;
  color: #ED166C;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.error-home-link:hover {
  color: #c41058;
  text-decoration: underline;
}

.error-home-link:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: 0 0 0 3px rgba(237, 22, 108, 0.15);
}

/* Responsive styles */
@media screen and (max-width: 768px) {
  .auth-form-container {
    max-width: 100%;
    margin: 20px auto;
    padding: 24px 20px;
    border-radius: 12px;
  }

  .form-group input[type="email"],
  .form-group input[type="text"] {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px;
  }

  .auth-button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
  }

  .error-card {
    padding: 24px 20px;
    border-radius: 12px;
  }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
  .auth-form-container {
    margin: 10px auto;
    padding: 20px 15px;
  }

  .auth-form-container h2 {
    font-size: 1.5rem;
  }

  .form-group {
    margin-bottom: 15px;
  }
}

/* Fix for mobile viewport height issues */
@media screen and (max-height: 600px) {
  .auth-form-container {
    margin: 10px auto;
  }
}

/* Ensure form elements don't overflow */
.form-group input {
  max-width: 100%;
  box-sizing: border-box;
}

/* Accessibility: reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================================================================== */
/* The shared auth card (partials/auth-card.ejs): pages and the modal */
/* Design language: DevOpser dark marketing identity (landing tokens: */
/* #000 ground, #282828 card, #444 lines, brand pink #ED166C), mono   */
/* utility voice for the eyebrow and the code readout.                */
/* ================================================================== */

/* Guard: auth-card.js toggles [hidden] on steps, errors and the modal. */
[hidden] {
  display: none !important;
}

.ac-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ac-page-header {
  padding: 22px 28px;
}

.ac-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  text-decoration: none;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.ac-wordmark-tag {
  color: #ED166C;
  font-weight: 600;
}

.ac-wordmark:focus-visible {
  outline: 2px solid #ED166C;
  outline-offset: 3px;
  border-radius: 4px;
}

.ac-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ac-card {
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  background: #282828;
  border: 1px solid #444;
  border-radius: 12px;
  padding: 36px;
}

.ac-eyebrow {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Segoe UI Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  color: #888;
  margin: 0 0 16px;
  letter-spacing: 0.02em;
}

.ac-eyebrow-accent {
  color: #ED166C;
}

.ac-heading {
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 8px;
  color: #fff;
  letter-spacing: -0.015em;
}

.ac-sub {
  color: #ccc;
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 22px;
}

.ac-flash {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 16px;
}

.ac-flash-error {
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: #ff8a8a;
}

.ac-flash-info {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.ac-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  background: #333;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.ac-google:hover {
  background: #3d3d3d;
}

.ac-google:focus-visible {
  outline: none;
  border-color: #ED166C;
  box-shadow: 0 0 0 3px rgba(237, 22, 108, 0.15);
}

.ac-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: #888;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
}

.ac-or::before,
.ac-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #444;
}

.ac-label {
  display: block;
  font-size: 13px;
  color: #ccc;
  margin: 0 0 6px;
}

.ac-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  /* 16px floor prevents iOS zoom-on-focus */
  font-size: 16px;
  background: #333;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
}

.ac-input::placeholder {
  color: #777;
}

.ac-input:focus {
  outline: none;
  border-color: #ED166C;
  box-shadow: 0 0 0 3px rgba(237, 22, 108, 0.15);
}

.ac-code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 26px;
  letter-spacing: 10px;
  text-align: center;
  padding: 12px;
}

.ac-btn {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  margin-top: 14px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.ac-btn-primary {
  background: linear-gradient(135deg, #ED166C 0%, #c41058 100%);
  color: #fff;
}

.ac-btn-primary:hover {
  background: linear-gradient(135deg, #c41058 0%, #a00d48 100%);
}

.ac-btn:focus-visible {
  outline: 2px solid #ED166C;
  outline-offset: 2px;
}

.ac-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.ac-btn-ghost {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 12px;
}

.ac-btn-ghost:hover {
  background: #333;
}

.ac-row {
  display: flex;
  gap: 10px;
}

.ac-row .ac-btn {
  margin-top: 12px;
}

.ac-error {
  color: #ff8a8a;
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0 0;
}

.ac-hint {
  color: #888;
  font-size: 12.5px;
  line-height: 1.5;
  margin: 14px 0 0;
}

.ac-code-note {
  color: #ccc;
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 12px;
}

.ac-code-note strong {
  color: #fff;
  word-break: break-all;
}

.ac-status {
  color: #34d399;
  font-size: 13px;
  min-height: 1.2em;
  margin: 10px 0 0;
}

.ac-alt {
  text-align: center;
  color: #888;
  font-size: 14px;
  margin: 26px 0 0;
}

.ac-alt a {
  color: #ED166C;
  text-decoration: none;
  font-weight: 500;
}

.ac-alt a:hover {
  text-decoration: underline;
}

.ac-alt a:focus-visible {
  outline: 2px solid #ED166C;
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ------------------------------------------------------------------ */
/* The landing sign-in modal (#signin-modal on landing-builder.ejs)   */
/* ------------------------------------------------------------------ */

.ac-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.ac-modal-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.ac-modal-panel .ac-card {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.ac-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  background: transparent;
  border: none;
  color: #888;
  font-size: 22px;
  line-height: 1;
  padding: 8px;
  cursor: pointer;
}

.ac-modal-close:hover {
  color: #fff;
}

.ac-modal-close:focus-visible {
  outline: 2px solid #ED166C;
  outline-offset: 2px;
  border-radius: 4px;
}

@media (max-width: 480px) {
  .ac-card {
    padding: 26px 20px;
  }

  .ac-code {
    letter-spacing: 7px;
    font-size: 22px;
  }
}
