/* ==========================================================================
   Flexlink Transcribers: shared auth styles (v2)
   Pages: register, login, forgot-password, reset-password
   Concept: a solid brand-teal panel where a waveform "plays" a transcript,
   next to a calm white form. The one memorable moment is the playhead.
   ========================================================================== */

:root {
  --teal: #0fe0cf;
  --teal-deep: #00a99b;
  --ink: #05201e;
  --ink-soft: #0c3b37;
  --paper: #ffffff;
  --wash: #f2f8f7;
  --line: #d3e2df;
  --text: #2f4a47;
  --muted: #5b7572;
  --placeholder: #7b918e;
  --link: #00695f;
  --danger: #c62828;

  --font-display: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
  --font-ui: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

  --r-field: 10px;
  --r-panel: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.auth-layout {
  display: grid;
  grid-template-columns: minmax(420px, 5fr) minmax(0, 6fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Brand panel ---------- */
.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 44px;
  padding: 44px clamp(32px, 5vw, 80px);
  background: var(--teal);
  color: var(--ink);
  overflow: hidden;
}

.aside-logo {
  display: inline-flex;
  align-self: flex-start;
  padding: 8px 12px;
  background: var(--paper);
  border-radius: 12px;
  line-height: 0;
}
.aside-logo img { display: block; height: 44px; width: auto; max-width: 180px; object-fit: contain; }

.aside-body { max-width: 540px; }

.aside-head {
  margin: 0 0 40px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 4.8vw, 70px);
  line-height: .98;
  letter-spacing: -.035em;
  text-wrap: balance;
}

/* The playhead moment: waveform + transcript on a 9s loop */
.wave {
  position: relative;
  height: 76px;
  margin-bottom: 22px;
}
.wave-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}
.wave-layer span {
  flex: 1;
  min-width: 2px;
  height: calc(var(--h) * 1%);
  border-radius: 3px;
  background: var(--ink);
}
.wave-base { opacity: .22; }
.wave-played { animation: played 9s linear infinite; }
.playhead {
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: 0;
  width: 2px;
  background: var(--paper);
  animation: head 9s linear infinite;
}
.playhead::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--paper);
}

@keyframes played { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes head   { from { left: 0; } to { left: calc(100% - 2px); } }

.tx { margin: 0; padding: 18px 0 0; list-style: none; border-top: 1.5px solid rgba(5, 32, 30, .2); }
.tx-line {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 8px 0;
  font-size: 15px;
  line-height: 1.45;
  opacity: .5;
  animation: lit 9s linear infinite;
}
.tx-line:nth-child(2) { animation-delay: 3s; }
.tx-line:nth-child(3) { animation-delay: 6s; }
.tx-line time { font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-line p { margin: 0; }
.tx-line b { font-weight: 700; margin-right: 6px; }
@keyframes lit { 0%, 30% { opacity: 1; } 34%, 100% { opacity: .5; } }

.aside-note { margin: 0; max-width: 40ch; font-size: 15px; line-height: 1.5; color: rgba(5, 32, 30, .82); }

/* ---------- Form panel ---------- */
.auth-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 48px clamp(24px, 6vw, 96px);
  background: var(--paper);
}
.card { width: 100%; max-width: 400px; margin: 0 auto; }

.auth-brand { margin-bottom: 30px; }
.auth-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: -.025em;
  color: var(--ink);
}
.auth-sub { margin: 0; max-width: 38ch; font-size: 15.5px; color: var(--muted); }

/* ---------- Form ---------- */
.form-group { margin-bottom: 18px; }
.form-group label,
.theme-form > label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.input-box { position: relative; display: flex; align-items: center; }
.input-box input {
  width: 100%;
  height: 52px;
  padding: 0 46px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-field);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input-box input::placeholder { color: var(--placeholder); }
.input-box input:hover { border-color: #b4cbc7; }
.input-box input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(15, 224, 207, .38); }
.input-box input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #fff inset; -webkit-text-fill-color: var(--ink); }

.left-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--placeholder);
  pointer-events: none;
  transition: color .15s;
}
.input-box:focus-within .left-icon { color: var(--ink); }

.toggle-pass,
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 15px;
  color: var(--placeholder);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.toggle-pass:hover,
.password-toggle:hover { color: var(--ink); background: var(--wash); }

#triggerCountry { cursor: pointer; }
#triggerCountry input { cursor: pointer; padding-right: 44px; }
.chevron {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--placeholder);
  pointer-events: none;
}

.phone-row {
  display: flex;
  align-items: stretch;
  height: 52px;
  overflow: hidden;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-field);
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.phone-row[data-selected="false"] { opacity: .6; cursor: not-allowed; }
.phone-row:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(15, 224, 207, .38); }
.phone-row .prefix {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  background: var(--wash);
  border-right: 1.5px solid var(--line);
}
#c_flag { font-size: 18px; line-height: 1; }
.phone-row input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 14px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
}
.phone-row input::placeholder { color: var(--placeholder); }
.phone-row input:disabled { cursor: not-allowed; }

.form-group > span[id$="Status"] {
  display: block;
  margin-top: 7px;
  font-size: 13.5px !important;
  font-weight: 500;
  line-height: 1.4;
}
.form-group > span[id$="Status"] i { margin-right: 4px; }

.forgot-link { margin: -6px 0 20px; font-size: 14.5px; }

/* ---------- Buttons ---------- */
.submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  margin-top: 8px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: var(--r-field);
  cursor: pointer;
  transition: background .18s, color .18s, transform .1s;
}
.submit-btn:hover { background: var(--teal); color: var(--ink); }
.submit-btn:active { transform: scale(.99); }
.submit-btn:disabled,
.submit-btn[disabled] { opacity: .6; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 22px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-field);
  transition: background .15s, color .15s;
}
.btn-secondary:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

/* ---------- Links ---------- */
a { color: var(--link); font-weight: 600; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
a:focus-visible,
button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

.login-link,
.back,
.footer-links {
  margin-top: 26px;
  font-size: 15px;
  color: var(--muted);
}
.footer-links br { display: none; }
.back a::before { content: "\2190\00a0"; }

/* Expired / invalid link */
.state-box { padding: 4px 0 0; }
.state-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 12px;
  font-size: 22px;
  color: var(--danger);
  background: #fdecec;
}
.state-box p { margin: 0 0 20px; color: var(--muted); }

.auth-copy { margin: 34px auto 0; width: 100%; max-width: 400px; font-size: 13px; color: var(--muted); }
.auth-copy i { margin-right: 6px; color: var(--teal-deep); }

/* ---------- Country modal ---------- */
#countryModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 32, 30, .62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#countryModal .modal-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow: hidden;
  background: var(--paper);
  border-radius: var(--r-panel);
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .5);
}
.search-box { padding: 14px; border-bottom: 1px solid var(--line); }
.search-box input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-field);
  outline: none;
}
.search-box input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(15, 224, 207, .38); }
#countryList { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.country-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  font-size: 15px;
  color: var(--ink);
  border-bottom: 1px solid var(--wash);
  cursor: pointer;
}
.country-item:hover { background: var(--wash); }

/* ---------- iziToast tweaks ---------- */
.iziToast { width: auto !important; max-width: 320px !important; left: auto !important; right: 10px !important; margin-left: 0 !important; }

/* ---------- Tablet / mobile: brand panel becomes a compact band ---------- */
@media (max-width: 900px) {
  .auth-layout { display: block; }
  .auth-aside { gap: 20px; padding: 22px 22px 56px; }
  .aside-logo img { height: 36px; }
  .aside-head { margin: 0; font-size: 32px; line-height: 1.02; max-width: 14ch; }
  .wave { height: 40px; margin: 0; }
  .tx, .aside-note { display: none; }
  .aside-body { display: flex; flex-direction: column; gap: 22px; }
  .auth-main {
    position: relative;
    margin-top: -30px;
    padding: 32px 22px 36px;
    border-radius: 24px 24px 0 0;
  }
  .auth-title { font-size: 28px; }
  .iziToast { border-radius: 8px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .wave-played { animation: none; clip-path: none; }
  .playhead { display: none; }
  .tx-line { animation: none; opacity: 1; }
  * { transition: none !important; }
}

/* ---------- Optional floating buttons (only if un-commented in the footer) ---------- */
.support-nudge-container { position: fixed; bottom: 24px; right: 16px; z-index: 999; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.support-nudge-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 50px; font-size: 12px; font-weight: 600; color: #fff; text-decoration: none; pointer-events: auto; box-shadow: 0 4px 20px rgba(0, 0, 0, .3); }
.telegram-nudge { background: linear-gradient(135deg, #229ED9, #1a7ab8); }
.whatsapp-nudge, #joinGroupBtn { background: linear-gradient(135deg, #25D366, #128C7E); }
.nudge-text { font-size: 10px; letter-spacing: .5px; text-transform: uppercase; }
#joinGroupBtn { position: fixed; bottom: 80px; right: 20px; z-index: 9999; padding: 12px 25px; border-radius: 50px; font-size: 15px; font-weight: 600; color: #fff; text-decoration: none; box-shadow: 0 0 15px rgba(37, 211, 102, .6); }
