/* =====================================================
   AUTH FLOW – shared styles
   Screens: signup, login, verify (OTP)
   Base: 1rem = 16px (browser default)
   ===================================================== */

/* --- Design tokens --- */
:root {
  --primary:           #F97316;
  --primary-hover:     #EA6C0A;
  --primary-disabled:  #FDBA74;
  --dark-panel:        #141812;
  --text-primary:      #111827;
  --text-secondary:    #6B7280;
  --text-muted:        #9CA3AF;
  --border:            #E5E7EB;
  --input-bg:          #F9FAFB;
  --page-bg:           #F3F4F6;
  --radius-sm:         0.5rem;
  --radius-md:         0.75rem;
  --radius-card:       1.25rem;
  --radius-pill:       100rem;
  --shadow-card:       0 0.25rem 1.5rem rgba(0,0,0,0.07), 0 0.0625rem 0.1875rem rgba(0,0,0,0.04);
}

/* --- Base reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* =======================================================
   LAYOUT
   ======================================================= */

.auth-layout {
  display: flex;
  min-height: 100vh;
}

/* =======================================================
   LEFT PANEL
   ======================================================= */

.auth-left {
  width: 32%;
  min-width: 16.25rem;
  flex-shrink: 0;
  background:
    radial-gradient(ellipse at 0% 100%, rgba(110, 52, 8, 0.72) 0%, transparent 55%),
    var(--dark-panel);
  display: flex;
  flex-direction: column;
}

/* Each variant (invite / marketing) fills the full height of the panel */
.auth-left-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 2rem;
}
.auth-left-panel[hidden] { display: none; }

/* --- Logo --- */
.auth-logo { display: inline-flex; align-items: center; }

.auth-logo__img {
  height: 1.6rem;
  width: auto;
  display: block;
}

/* --- Invite card --- */
.invite-card {
  margin-top: 1.75rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-md);
  padding: 1.125rem;
}

.invite-card__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.875rem;
}

.invite-card__avatar {
  width: 2.625rem;
  height: 2.625rem;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.invite-card__name {
  display: block;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.invite-card__title {
  display: block;
  color: rgba(255,255,255,0.45);
  font-size: 0.75rem;
  margin-top: 0.1875rem;
}

.invite-card__role-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.875rem;
  border-top: 1px solid rgba(255,255,255,0.09);
}

.invite-card__role-label { color: rgba(255,255,255,0.45); font-size: 0.75rem; }
.invite-card__role-value { color: #ffffff; font-size: 0.75rem; font-weight: 600; }

/* --- Left panel footer (pushes to bottom) --- */
.auth-left-footer { margin-top: auto; }

/* --- Invite expiry notice --- */
.invite-expiry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255,255,255,0.4);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.invite-expiry__dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

/* --- Marketing copy --- */
.auth-marketing__heading {
  color: #ffffff;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin-bottom: 0.625rem;
}

.auth-marketing__body {
  color: rgba(255,255,255,0.5);
  font-size: 1rem;
  line-height: 1.65;
}

/* =======================================================
   RIGHT PANEL
   ======================================================= */

.auth-right {
  flex: 1;
  position: relative;
  background-color: var(--page-bg);
  /* dot grid drawn by canvas in auth.js for the ripple effect */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}

/* Wrapper keeps card centred as a column */
.auth-right-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 28.75rem;
}

/* =======================================================
   AUTH CARD
   ======================================================= */

.auth-card {
  background: #ffffff;
  border-radius: var(--radius-card);
  padding: 2.75rem 3rem;
  width: 100%;
  box-shadow: var(--shadow-card);
}

.auth-card__heading {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.auth-card__subtext {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
  line-height: 1.55;
}

.auth-card__subtext strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* --- Inline form error (login / verify) --- */
.auth-error {
  margin-top: 0.875rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #DC2626;
  text-align: center;
}
.auth-error:empty { display: none; }

/* =======================================================
   FORM ELEMENTS
   ======================================================= */

.form-field { margin-bottom: 1.125rem; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.form-input-wrap { position: relative; }

.form-input {
  display: block;
  width: 100%;
  padding: 0.6875rem 0.9375rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.form-input::placeholder { color: var(--text-muted); }
.form-input:focus        { border-color: var(--primary); }

.form-input--locked {
  background: var(--input-bg);
  color: var(--text-secondary);
  cursor: default;
  padding-right: 6.875rem;
}

.form-badge {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  background: #DCFCE7;
  color: #16A34A;
  border: 1px solid #BBF7D0;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1875rem 0.625rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  pointer-events: none;
}

/* =======================================================
   BUTTONS
   ======================================================= */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.8125rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn-primary { background: var(--primary); color: #ffffff; }

.btn-primary:hover:not(:disabled):not(.is-loading) {
  background: var(--primary-hover);
  transform: translateY(-0.125rem);
  box-shadow: 0 0.375rem 1.25rem rgba(249, 115, 22, 0.35);
}

.btn-primary:active:not(:disabled):not(.is-loading) {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary:disabled:not(.is-loading) {
  background: var(--primary-disabled);
  cursor: not-allowed;
}

.btn-primary.is-loading { background: var(--primary); cursor: wait; }

/* --- Spinner --- */
.btn-spinner {
  width: 1.125rem;
  height: 1.125rem;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

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

/* =======================================================
   OTP INPUT GRID
   ======================================================= */

.otp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.625rem;
}

.otp-input {
  aspect-ratio: 1;
  width: 100%;
  text-align: center;
  font-size: 1.375rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-primary);
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  caret-color: var(--primary);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.otp-input:focus { border-color: var(--primary); }

.otp-input.is-pop { animation: inputPop 0.2s ease; }

/* =======================================================
   HELPER TEXT & LINKS
   ======================================================= */

.auth-resend {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.875rem;
}

.resend-action {
  font-weight: 600;
  color: var(--text-muted);
  cursor: default;
}

.resend-action.is-active {
  color: var(--text-primary);
  cursor: pointer;
}

.resend-action.is-active:hover { text-decoration: underline; }

.resend-timer {
  font-weight: 600;
  color: var(--text-primary);
}

.auth-back-link {
  display: block;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  transition: color 0.15s;
}

.auth-back-link:hover { color: var(--text-primary); }

.auth-policy {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.875rem;
  line-height: 1.5;
}

.auth-policy a { color: var(--text-secondary); }
.auth-policy a:hover { text-decoration: underline; }

.auth-switch {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 1rem;
}

.auth-switch a { color: var(--text-primary); font-weight: 700; }
.auth-switch a:hover { text-decoration: underline; }

/* =======================================================
   ANIMATIONS
   ======================================================= */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(1.125rem); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-0.875rem); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes inputPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Page entrance */
.auth-layout { animation: fadeIn 0.3s ease both; }

/* Left panel items stagger in from the left */
.auth-left-panel > *:nth-child(1) { animation: slideInLeft 0.4s 0.05s ease both; }
.auth-left-panel > *:nth-child(2) { animation: slideInLeft 0.4s 0.12s ease both; }
.auth-left-panel > *:nth-child(3) { animation: slideInLeft 0.4s 0.19s ease both; }

/* Card slides up */
.auth-card { animation: slideUp 0.45s 0.15s ease both; }

/* Form fields stagger */
.form-field:nth-child(1) { animation: slideUp 0.35s 0.3s  ease both; }
.form-field:nth-child(2) { animation: slideUp 0.35s 0.37s ease both; }
.form-field:nth-child(3) { animation: slideUp 0.35s 0.44s ease both; }

.otp-grid          { animation: slideUp 0.35s 0.3s  ease both; }
.auth-card .btn    { animation: slideUp 0.35s 0.42s ease both; }
.auth-resend       { animation: slideUp 0.35s 0.48s ease both; }
.auth-back-link    { animation: slideUp 0.35s 0.52s ease both; }
.auth-policy       { animation: slideUp 0.35s 0.48s ease both; }
.auth-switch       { animation: slideUp 0.35s 0.52s ease both; }

/* =======================================================
   RESPONSIVE – left panel stacks above card on mobile
   ======================================================= */

@media (max-width: 48rem) {
  .auth-layout {
    flex-direction: column;
  }

  .auth-left {
    width: 100%;
    min-width: unset;
  }

  .auth-left-panel {
    padding: 2.5rem 2.5rem;
    flex: 0 0 auto;
  }

  /* Footer no longer needs to stretch to the bottom */
  .auth-left-footer { margin-top: 1.25rem; }

  /* Compact the invite card */
  .invite-card { margin-top: 1.25rem; }

  /* Tighten marketing copy */
  .auth-marketing__heading { font-size: 1.125rem; }

  .auth-right {
    padding: 1.5rem 1rem 2.5rem;
    align-items: flex-start;
  }

  .auth-right-content { max-width: 100%; }

  .auth-card {
    padding: 2rem 1.5rem;
    border-radius: var(--radius-md);
  }

  .auth-card__heading { font-size: 1.375rem; }
}

@media (max-width: 24.375rem) {
  .otp-grid  { gap: 0.375rem; }
  .otp-input { font-size: 1.125rem; }
  .auth-card { padding: 1.75rem 1.25rem; }
}
