/* Material Design 3 – Login Form */

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

body {
  min-height: 100vh;
  background-color: #f0f4f9;
  font-family: 'Google Sans', 'Roboto', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 0;
}

/* ── Page wrapper ─────────────────────────────────────────── */
.page-wrapper {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 1040px;
}

/* ── Card ─────────────────────────────────────────────────── */
.login-card {
  background: #ffffff;
  border-radius: 28px;
  padding: 36px 36px 36px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 48px;
  width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.06);
  position: relative;
  overflow: hidden;
}

/* ── MD3 indeterminate linear progress bar ────────────────── */
.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #d2e3fc;
  overflow: hidden;
  /* spans full grid width, outside normal flow */
  grid-column: 1 / -1;
}

.progress-bar.hidden {
  display: none !important;
}

.progress-bar__bar1,
.progress-bar__bar2 {
  position: absolute;
  height: 100%;
  background: #1a73e8;
}

.progress-bar__bar1 {
  animation: md3-bar1 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
}

.progress-bar__bar2 {
  animation: md3-bar2 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
  animation-delay: -1.15s;
}

@keyframes md3-bar1 {
  0%   { left: -35%;  width: 35%; }
  60%  { left: 100%;  width: 100%; }
  100% { left: 100%;  width: 35%; }
}

@keyframes md3-bar2 {
  0%   { left: -200%; width: 200%; }
  60%  { left: 107%;  width: 200%; }
  100% { left: 107%;  width: 200%; }
}

/* ── Loading overlay ─────────────────────────────────────── */
.login-card::after {
  content: '';
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.30);
  pointer-events: none;
  z-index: 10;
  border-radius: inherit;
}

.login-card.loading::after {
  display: block;
}

.step-2 {
  margin-top: 35px;
}

.step-2 .actions {
  margin-top: 56px;
}

/* ── Step 2 slide-in from right ──────────────────────────── */
.step-2.slide-in {
  animation: slideFromRight 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideFromRight {
  from {
    opacity: 0;
    transform: translateX(48px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Left column ──────────────────────────────────────────── */
.card-left {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 8px;
}

/* CSV / logo mark */
.logo-mark {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.logo-mark span {
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}

.card-left h1 {
  font-size: 44px;
  font-weight: 400;
  color: #1f1f1f;
  line-height: 1.1;
  margin-bottom: 8px;
}

.card-left .subtitle {
  font-size: 16px;
  color: #444746;
  line-height: 1.5;
}

/* ── Right column ─────────────────────────────────────────── */
.card-right {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 85px;
}

/* ── Floating-label text field (MD3 Outlined) ─────────────── */
.text-field {
  position: relative;
  width: 458px;
  max-width: 100%;
}

.text-field input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  font-size: 16px;
  font-family: inherit;
  color: #1f1f1f;
  background: transparent;
  border: 1px solid #747775;
  border-radius: 4px;
  outline: none;
  transition: border-color .2s, border-width .15s;
  /* push text down slightly so it doesn't overlap the floating label */
  padding-top: 6px;
}

.text-field input::placeholder {
  color: transparent; /* hidden by default; shown via label */
}

/* The floating label */
.text-field label {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #444746;
  background: #ffffff;
  padding: 0 3px;
  pointer-events: none;
  transition: top .18s ease, transform .18s ease, font-size .18s ease, color .18s ease;
  line-height: 1;
  white-space: nowrap;
}

/* Floating state: focus OR has value */
.text-field input:focus + label,
.text-field input:not(:placeholder-shown) + label {
  top: 0;
  transform: translateY(-50%);
  font-size: 12px;
  color: #1a73e8;
}

/* Border highlight on focus */
.text-field input:focus {
  border-color: #1a73e8;
  border-width: 2px;
  padding-left: 15px; /* compensate for extra border px */
  padding-right: 15px;
}

/* keep label color neutral when not focused but has value */
.text-field input:not(:focus):not(:placeholder-shown) + label {
  color: #444746;
}

/* ── Step visibility ─────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Step 2 left: user identity chip ─────────────────────── */
.left-step-2 h1 {
  margin-bottom: 12px;
}

.user-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid #747775;
  border-radius: 20px;
  padding: 6px 14px 6px 10px;
  max-width: 100%;
}

.user-identity__icon {
  color: #444746;
  flex-shrink: 0;
}

.user-identity__email {
  font-size: 14px;
  font-weight: 500;
  color: #1f1f1f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.user-identity__chevron {
  color: #444746;
  flex-shrink: 0;
  margin-left: 2px;
}

/* ── Show password row ────────────────────────────────────── */
.show-password-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #1f1f1f;
  user-select: none;
}

.show-password-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #747775;
  border-radius: 3px;
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color .15s, background .15s;
}

.show-password-checkbox:checked {
  background: #1a73e8;
  border-color: #1a73e8;
}

.show-password-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: 2px solid #ffffff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.show-password-checkbox:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

/* ── Links & helper text ──────────────────────────────────── */
.forgot-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 14px;
  color: #1a73e8;
  text-decoration: none;
  font-weight: 500;
}

.forgot-link:hover {
  text-decoration: underline;
}

.guest-note {
  margin-top: 28px;
  font-size: 14px;
  color: #444746;
  line-height: 1.6;
}

.guest-note a {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 500;
}

.guest-note a:hover {
  text-decoration: underline;
}

/* ── Actions row ──────────────────────────────────────────── */
.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  margin-top: 48px;
}

.link-btn {
  font-size: 14px;
  font-weight: 500;
  color: #1a73e8;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 8px;
  border-radius: 20px;
  transition: background .15s;
}

.link-btn:hover {
  background: rgba(26, 115, 232, .08);
  text-decoration: none;
}

/* MD3 Filled Button */
.btn-next {
  height: 40px;
  padding: 0 24px;
  background: #1a73e8;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  letter-spacing: .25px;
  transition: box-shadow .2s, background .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}

.btn-next:hover {
  background: #1765cc;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

.btn-next:active {
  background: #185abc;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* ── Footer bar ───────────────────────────────────────────── */
.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 4px 20px;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-lang {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-lang select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  font-size: 14px;
  color: #444746;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 28px 6px 8px;
  border-radius: 20px;
  /* custom chevron */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23444746' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: background-color .15s;
}

.footer-lang select:hover {
  background-color: rgba(68, 71, 70, .08);
}

.footer-lang select:focus {
  outline: 2px solid #1a73e8;
  outline-offset: 1px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-links a {
  font-size: 14px;
  color: #444746;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 20px;
  transition: background .15s;
}

.footer-links a:hover {
  background: rgba(68, 71, 70, .08);
  text-decoration: none;
}

/* ── Phase 0 ─────────────────────────────────────────────── */
#phase-0 {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  opacity: 1;
  transition: opacity 0.22s ease;
  z-index: 50;
}

#phase-0.fade-out {
  opacity: 0;
}

.phase0-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  flex-shrink: 0;
}

.phase0-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.phase0-logo img {
  max-width: 200px;
}

.phase0-logo span {
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}

.phase0-signin-link {
  font-size: 14px;
  font-weight: 500;
  color: #1a73e8;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  transition: background .15s;
}

.phase0-signin-link:hover {
  background: rgba(26, 115, 232, .08);
}

.phase0-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 32px;
}

.phase0-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.phase0-footer {
  flex-shrink: 0;
  padding: 16px 32px 24px;
  text-align: center;
}

.phase0-footer p {
  font-size: 12px;
  color: rgb(95, 99, 104);
  line-height: 1.6;
}

.phase0-footer a {
  color: #1a73e8;
  text-decoration: underline;
}

.phase0-left {
  width: 764px;
  box-sizing: border-box;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phase0-left-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-placeholder {
  width: 740px;
  height: 416px;
  background: #2d2e30;
  border-radius: 10px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 -48px 48px rgba(0, 0, 0, 0.45), inset 0 8px 24px rgba(0, 0, 0, 0.2);
}

.video-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  padding: 0;
}

.video-btn--topright {
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: transparent;
  color: #ffffff;
  border-radius: 50%;
  transition: background .15s;
}

.video-btn--topright:hover {
  background: rgba(255, 255, 255, 0.12);
}

.video-btn--bottomleft {
  bottom: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  background: #1a73e8;
  color: #ffffff;
  border-radius: 50%;
  transition: background .15s;
}

.video-btn--bottomleft:hover {
  background: #1765cc;
}

.video-btns-center {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 32px;
}

.video-btn--mute,
.video-btn--camera {
  position: relative; /* override base .video-btn absolute */
}

.video-btn--mute {
  width: 56px;
  height: 56px;
  background: rgb(234, 67, 53);
  border: 2px solid rgb(234, 67, 53) !important;
  color: #ffffff;
  border-radius: 50%;
  transition: background .15s;
}

.video-btn--mute:hover {
  background: rgb(210, 48, 36);
  border-color: rgb(210, 48, 36) !important;
}

.video-btn--camera {
  width: 56px;
  height: 56px;
  background: transparent;
  border: 2px solid #ffffff !important;
  color: #ffffff;
  border-radius: 50%;
  transition: background .15s;
}

.video-btn--camera:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ── Video controls (3 selects below video) ───────────────── */
.video-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 740px;
}

.video-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.video-select-icon {
  position: absolute;
  left: 8px;
  color: #444746;
  pointer-events: none;
  flex-shrink: 0;
}

.video-select {
  width: 168px;
  height: auto;
  box-sizing: border-box;
  border: 1px solid #747775;
  border-radius: 20px;
  padding: 6px 28px 6px 32px;
  font-size: 14px;
  font-family: inherit;
  color: #1f1f1f;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%231f1f1f' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color .2s;
}

.video-select:focus {
  border-color: #1a73e8;
  border-width: 2px;
  outline: none;
}

.phase0-right {
  width: 448px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Phase 0 submit button ────────────────────────────────── */
.phase0-submit {
  width: 240px;
  height: 56px;
  background: #1a73e8;
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 28px;
  cursor: pointer;
  letter-spacing: .25px;
  transition: background .15s, box-shadow .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}

.phase0-submit:hover {
  background: #1765cc;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* ── Phase 0 options selector ─────────────────────────────── */
.phase0-options-wrap {
  position: relative;
  min-width: 186px;
}

.phase0-options-select {
  min-width: 186px;
  height: 44px;
  box-sizing: border-box;
  border: 1px solid #747775;
  border-radius: 50px;
  padding: 6px 28px 6px 10px;
  font-size: 14px;
  font-family: inherit;
  color: #1f1f1f;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%231f1f1f' d='M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color .2s;
}

.phase0-options-select:focus {
  border-color: #1a73e8;
  border-width: 2px;
  outline: none;
}


.phase0-right-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.phase0-title {
  font-size: 24px;
  font-weight: 400;
  color: #1f1f1f;
  text-align: center;
  line-height: 1.1;
}

.phase0-field-wrap {
  display: flex;
  flex-direction: column;
  width: 300px;
}

.phase0-input {
  width: 300px;
  height: 56px;
  box-sizing: border-box;
  border: 1px solid #747775;
  border-radius: 4px;
  padding: 0 16px;
  font-size: 16px;
  font-family: inherit;
  color: #1f1f1f;
  background: transparent;
  outline: none;
  transition: border-color .2s, border-width .15s;
}

.phase0-input::placeholder {
  color: #747775;
}

.phase0-input:focus {
  border-color: #1a73e8;
  border-width: 2px;
  padding: 0 15px;
}

.char-counter {
  font-size: 12px;
  color: #747775;
  text-align: right;
  margin-top: 5px;
  font-family: inherit;
}

/* ── Spinner overlay ─────────────────────────────────────── */
#spinner-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 4px solid #d2e3fc;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 800px) {
  .login-card {
    grid-template-columns: 1fr;
    padding: 36px 28px 28px;
    gap: 32px 0;
    border-radius: 20px;
  }

  .text-field {
    width: 100%;
  }

  .card-left h1 {
    font-size: 32px;
  }
}

/* ── Dark mode (MD3 dark palette) ────────────────────────── */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #202124;
  }

  /* ── Login card ── */
  .login-card {
    background: rgb(14, 14, 14);
    box-shadow: 0 1px 3px rgba(0,0,0,.5);
  }

  .login-card::after {
    background: rgba(48, 49, 52, 0.45);
  }

  /* ── Progress bar ── */
  .progress-bar {
    background: #3c4043;
  }

  .progress-bar__bar1,
  .progress-bar__bar2 {
    background: #8ab4f8;
  }

  /* ── Left column text ── */
  .card-left h1 {
    color: #e8eaed;
  }

  .card-left .subtitle {
    color: #bdc1c6;
  }

  /* ── User identity chip ── */
  .user-identity {
    border-color: #5f6368;
  }

  .user-identity__icon,
  .user-identity__chevron {
    color: #bdc1c6;
  }

  .user-identity__email {
    color: #e8eaed;
  }

  /* ── Floating-label text field ── */
  .text-field input {
    color: #e8eaed;
    border-color: #5f6368;
  }

  .text-field label {
    color: #bdc1c6;
    background: rgb(14,14,14);
  }

  .text-field input:focus + label,
  .text-field input:not(:placeholder-shown) + label {
    color: #8ab4f8;
  }

  .text-field input:not(:focus):not(:placeholder-shown) + label {
    color: #bdc1c6;
  }

  .text-field input:focus {
    border-color: #8ab4f8;
  }

  /* ── Show password ── */
  .show-password-row {
    color: #e8eaed;
  }

  .show-password-checkbox {
    border-color: #5f6368;
    background: rgb(14,14,14);
  }

  .show-password-checkbox:checked {
    background: #8ab4f8;
    border-color: #8ab4f8;
  }

  .show-password-checkbox:checked::after {
    border-color: rgb(30,31,32);
  }

  /* ── Links ── */
  .forgot-link {
    color: #8ab4f8;
  }

  .link-btn {
    color: #8ab4f8;
  }

  .link-btn:hover {
    background: rgba(138, 180, 248, .08);
  }

  .guest-note {
    color: #bdc1c6;
  }

  .guest-note a {
    color: #8ab4f8;
  }

  /* ── Next button ── */
  .btn-next {
    background: #8ab4f8;
    color: #202124;
  }

  .btn-next:hover {
    background: #93bbf8;
    box-shadow: 0 2px 6px rgba(0,0,0,.5);
  }

  .btn-next:active {
    background: #7da8f5;
  }

  /* ── Footer ── */
  .footer-lang select {
    color: #bdc1c6;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23bdc1c6' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  }

  .footer-lang select:hover {
    background-color: rgba(189, 193, 198, .08);
  }

  .footer-links a {
    color: #bdc1c6;
  }

  .footer-links a:hover {
    background: rgba(189, 193, 198, .08);
  }

  /* ── Spinner overlay ── */
  #spinner-overlay {
    background: rgb(30,31,32);
  }

  .spinner-ring {
    border-color: #3c4043;
    border-top-color: #8ab4f8;
  }

}

@media (max-width: 480px) {
  #phase-0 {
    display: none !important;
  }

  body {
    padding: 0;
    justify-content: flex-start;
    align-items: stretch;
  }

  .page-wrapper {
    min-height: 100svh;
    max-width: 100%;
    display: flex;
    flex-direction: column;
  }

  .login-card {
    padding: 24px;
    border-radius: 0;
    box-shadow: none;
    flex: 1;
    align-content: start;
  }

  .card-left h1 {
    font-size: 28px;
  }

 .card-right {
    padding-top: 8px;
  }

  .actions {
    gap: 12px;
  }

  .page-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px 24px;
  }
}

