@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* Sign-in screen: two-column layout inside one centred container.
   Loaded after chat.css / light-theme.css. */
.modern-signin-modal {
  --su-purple: #b9a4ff;
  --su-purple-soft: #d6ccff;
  --su-white: #ffffff;
  --su-ink: #14122a;
  --su-max: 1160px;                                            /* content width */
  --su-edge: max(clamp(36px, 7vw, 110px), calc((100vw - var(--su-max)) / 2));     /* one shared side margin */
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 82% 40%, rgba(185,164,255,.10), transparent 65%),
    #0a0b12;
  backdrop-filter: none;

  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 470px);
  align-items: center;                  /* both columns share one vertical centre line */
  column-gap: clamp(40px, 6vw, 112px);
  padding: 112px var(--su-edge) 56px;
  overflow-y: auto;
}
.modern-signin-modal *, .modern-signin-modal *::before { font-family: inherit; }
.modern-signin-modal, .modern-signin-modal * { box-sizing: border-box; }

/* ---- Brand: sits on the same left edge as the content ---- */
.signin-brand {
  position: absolute; top: 20px; left: 24px;
  display: flex; align-items: center; gap: 12px;
  font-size: 22px; font-weight: 600; letter-spacing: -.3px; line-height: 1; color: var(--su-white);
}
.signin-brand img { height: 30px; width: auto; max-width: 100px; object-fit: contain; border-radius: 0; display: block; flex: none; }

/* ---- Left column ---- */
.signin-modal-content {
  grid-column: 2; grid-row: 1; width: 100%; max-width: 470px; margin: 0; padding: 0;
  background: transparent; border: 0; box-shadow: none;
  overflow: visible; max-height: none; text-align: left;
}

.signin-badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 24px;
  padding: 8px 16px; border-radius: 999px;
  background: rgba(185,164,255,.10); border: 1px solid rgba(185,164,255,.22);
  color: var(--su-purple); font-size: 14px; font-weight: 600; letter-spacing: .1px; line-height: 1;
}

/* Max size lowered (was 48px) so fewer of the rotating headings need two lines */
.signin-heading {
  font-size: clamp(30px, 3vw, 42px); font-weight: 700; line-height: 1.08; letter-spacing: -.035em;
  margin: 0 0 16px; color: var(--su-white); white-space: nowrap;
}
.signin-heading span, .signin-heading em, .signin-heading b { color: var(--su-purple); font-style: normal; font-weight: inherit; }

.signin-subtitle {
  font-size: 17px; font-weight: 400; line-height: 1.6; letter-spacing: -.005em;
  color: rgba(222,224,245,.68); margin: 0 0 20px; max-width: 460px;
}

/* ---- Card: same width as the column ---- */
.signin-card {
  width: 100%; max-width: none; margin: 0; padding: 16px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.09); border-radius: 20px;
  box-shadow: 0 20px 48px rgba(0,0,0,.35);
}
.signin-button-container { margin: 0; min-height: 56px; display: flex; justify-content: stretch; }
.signin-button-container > * { width: 100%; }
.signin-divider { margin: 16px 0; }
.signin-divider-text { text-transform: uppercase; font-size: 12px; letter-spacing: .1em; font-weight: 500; color: rgba(255,255,255,.45); }

.signin-continue-btn {
  width: 100%; max-width: none; min-height: 56px; padding: 0 20px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(255,255,255,.06); color: var(--su-white);
  border: 0; border-radius: 12px;
  font-weight: 600; font-size: 16px; letter-spacing: -.01em;
  box-shadow: none;
  transition: background .15s ease, transform .15s ease;
}
.signin-continue-btn:hover { background: rgba(255,255,255,.12); transform: none; box-shadow: none; }
.signin-continue-btn:active { background: rgba(255,255,255,.16); }
.signin-continue-btn:focus { outline: none; }
.signin-continue-btn:focus-visible { outline: none; }

.signin-guest-note {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 0; padding: 0; max-width: none; text-align: left;
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  font-size: 13.5px; line-height: 1.5; color: rgba(222,224,245,.5);
}
.signin-guest-note::before { display: none !important;
  content: ""; width: 15px; height: 15px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Guest note: hidden until the Guest button is hovered (always visible on touch screens) */
.signin-modal-content:has(.signin-continue-btn:hover) .signin-guest-note { opacity: 1; transform: none; }
@media (hover: none) { .signin-guest-note { opacity: 1; transform: none; } }

/* ---- Right artwork: fills the second column, ends on the right margin ---- */
.signin-hero {
  grid-column: 1; grid-row: 1; justify-self: start; align-self: center;
  width: 100%; max-width: 600px; height: auto; max-height: calc(100vh - 200px);
  aspect-ratio: 4 / 3;
  border-radius: 20px; overflow: hidden;
  border: 1px solid rgba(185,164,255,.18);
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.signin-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Light theme ---- */
.theme-light .modern-signin-modal { background: #fbfaf8; }
.theme-light .signin-brand, .theme-light .signin-heading { color: #1a1a1a; }
/* The brand logo is a white image: turn it dark so it shows on the light page */
.theme-light .modern-signin-modal .signin-brand img { filter: brightness(0) !important; }
.theme-light .signin-heading span, .theme-light .signin-heading em, .theme-light .signin-heading b { color: #6d4af0; }
.theme-light .signin-badge { color: #6d4af0; background: rgba(109,74,240,.08); border-color: rgba(109,74,240,.22); }
.theme-light .signin-subtitle { color: rgba(20,20,20,.68); }
.theme-light .signin-card { background: #fff; border-color: rgba(0,0,0,.08); box-shadow: 0 12px 40px rgba(0,0,0,.07); }
.theme-light .signin-divider-text { color: rgba(20,20,20,.45); }
.theme-light .signin-continue-btn { background: #6d4af0; color: #fff; }
.theme-light .signin-continue-btn:hover { background: #5f3ce0; }
.theme-light .signin-guest-note { color: rgba(20,20,20,.5); }
.theme-light .signin-hero { border-color: rgba(0,0,0,.08); box-shadow: 0 16px 48px rgba(0,0,0,.12); }

/* ---- Narrow laptops ---- */
@media (max-width: 1100px) {
  .modern-signin-modal { grid-template-columns: minmax(0, 1fr) minmax(0, 430px); column-gap: 40px; }
  .signin-heading { white-space: normal; }
}

/* ---- Tablet / phone: artwork drops away, form centres ---- */
@media (max-width: 900px) {
  .modern-signin-modal { display: flex; flex-direction: column; justify-content: center; align-items: stretch; padding: 108px 20px 32px; }
  .signin-hero { display: none; }
  .signin-modal-content { max-width: none; }
  .signin-brand { top: 20px; left: 20px; font-size: 22px; gap: 12px; }
  .signin-brand img { height: 28px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .modern-signin-modal, .signin-modal-content, .signin-heading, .signin-subtitle, .signin-button-container, .signin-divider { animation: none !important; }
  .signin-continue-btn { transition: none; }
}

/* =====================================================================
   Overrides: these win over rules in chat.css / light-theme.css
   ===================================================================== */
.modern-signin-modal .signin-modal-content,
.modern-signin-modal .signin-heading,
.modern-signin-modal .signin-subtitle,
.modern-signin-modal .signin-guest-note { text-align: left !important; }
.modern-signin-modal .signin-heading,
.modern-signin-modal .signin-subtitle,
.modern-signin-modal .signin-guest-note { margin-left: 0 !important; margin-right: 0 !important; }
.modern-signin-modal .signin-card { margin: 0 !important; max-width: none !important; }

/* Rotating headings: longer ones wrap onto two lines instead of overflowing.
   min-height reserves two lines (2 x 1.08 line-height) so the card below
   never jumps between visits; remove it if you prefer no gap under short headings. */
.modern-signin-modal .signin-heading {
  white-space: normal !important;
  text-wrap: balance;               /* splits two-line headings evenly */
}

/* Logo: keep its real proportions (wide logos are no longer squeezed into a square) */
.modern-signin-modal .signin-brand img { width: auto !important; height: 30px !important; max-width: 100px !important; object-fit: contain !important; border-radius: 0 !important; background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; clip-path: none !important; outline: 0 !important; }
.modern-signin-modal .signin-brand { background: none !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
.modern-signin-modal .signin-brand::before, .modern-signin-modal .signin-brand::after { display: none !important; }

/* Guest button: one clean focus ring, no double outline */
.modern-signin-modal .signin-continue-btn { border: 0 !important; box-shadow: none !important; }
.modern-signin-modal .signin-continue-btn:focus-visible { outline: none !important; }

/* Wide screens: two columns */
@media (min-width: 901px) {
  .modern-signin-modal { display: grid !important; }
  .modern-signin-modal .signin-hero { display: block !important; }
}

/* Narrow screens / zoomed browser: one column, artwork hidden, logo + text share the column's left edge */
@media (max-width: 900px) {
  .modern-signin-modal {
    --su-edge: max(20px, calc((100vw - 560px) / 2));
    display: flex !important; flex-direction: column !important;
    justify-content: center !important; align-items: stretch !important;
  }
  .modern-signin-modal .signin-modal-content { width: 100% !important; max-width: 560px !important; margin: 0 auto !important; }
  .modern-signin-modal .signin-hero { display: none !important; }
  .modern-signin-modal .signin-brand { left: 20px !important; }
  .modern-signin-modal .signin-heading { white-space: normal !important; }
}

/* =====================================================================
   Google sign-in bar: plain, one line, email only, no Google logo.
   The real Google button stays in place but invisible on top, so clicks
   still go to Google. The visible text comes from data-label / data-initial
   (set by the small script in the notes: the email, or "Continue with Google").
   ===================================================================== */
.modern-signin-modal {
  --su-gbar-bg: #d6ccff;
  --su-gbar-border: transparent;
}
.theme-light .modern-signin-modal { --su-gbar-bg: #6d4af0; --su-gbar-border: transparent; }

.modern-signin-modal .signin-button-container {
  position: relative; display: flex !important; align-items: center; justify-content: flex-start !important;
  min-height: 56px; padding: 0 20px 0 12px; gap: 12px;
  background: var(--su-gbar-bg); border: 1px solid var(--su-gbar-border); border-radius: 999px;
  overflow: hidden; cursor: pointer;
}
/* avatar circle with the first letter of the email */
.modern-signin-modal .signin-button-container::before {
  content: attr(data-initial); flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 600; text-transform: uppercase;
  color: #fff; background: var(--su-ink);
}
/* the email, one line */
.modern-signin-modal .signin-button-container::after {
  content: attr(data-label); min-width: 0; flex: 1;
  font-size: 16px; font-weight: 600; color: var(--su-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.theme-light .modern-signin-modal .signin-button-container::after { color: #ffffff; }
.modern-signin-modal .signin-button-container:hover { filter: brightness(1.05); }

/* Google's real button: still there and clickable, just invisible */
.modern-signin-modal .signin-button-container > * {
  position: absolute !important; top: 0 !important; left: 0 !important;
  width: auto !important; height: auto !important;     /* keep Google's natural size; the script scales it to fill the bar */
  transform-origin: 0 0; opacity: 0.001; z-index: 2;
}

/* First-time visitor (no saved email): no avatar circle, just "Continue with Google" */
.modern-signin-modal .signin-button-container:not([data-initial])::before,
.modern-signin-modal .signin-button-container[data-initial=""]::before { display: none; }
.modern-signin-modal .signin-button-container:not([data-initial]),
.modern-signin-modal .signin-button-container[data-initial=""] { padding-left: 20px; justify-content: center !important; }
.modern-signin-modal .signin-button-container:not([data-initial])::after,
.modern-signin-modal .signin-button-container[data-initial=""]::after { flex: 0 1 auto; font-weight: 600; }

/* Hides the sign-in modal (must be !important to beat the display rules above) */
#nameOverlay.is-closed { display: none !important; }
/* Subtitle + AI Mode pill on one line */
.modern-signin-modal .signin-meta {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 14px; margin: 0 0 28px;
}
.modern-signin-modal .signin-meta .signin-subtitle { margin: 0 !important; max-width: none; }
.modern-signin-modal .signin-meta .signin-badge { margin: 0 !important; flex: none; }
