/* WhatsApp Web login clone — matches the current web.whatsapp.com design:
   cream background, rounded white card, pill inputs, segmented code. */

:root {
  --wa-cream: #f7f4ee;
  --wa-card: #ffffff;
  --wa-green: #25d366;
  --wa-btn: #00a884;
  --wa-green-dark: #008069;
  --wa-text: #111b21;
  --wa-muted: #667781;
  --wa-border: #d8dde2;
  --wa-error: #ea0038;
}

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

body {
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--wa-cream);
  color: var(--wa-text);
  min-height: 100vh;
}

/* Top-left logo */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
}
.topbar-logo { width: 28px; height: 28px; }
.topbar-name {
  color: var(--wa-green);
  font-size: 19px;
  font-weight: 600;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 0 16px 40px;
}

/* Card */
.card {
  background: var(--wa-card);
  border: 1.5px solid #a9b4ba;
  border-radius: 18px;
  padding: 48px 56px;
  width: 100%;
  max-width: 760px;
}

.card-title {
  font-size: 28px;
  font-weight: 500;
  color: #111b21;
  margin-bottom: 10px;
}
.card-sub {
  font-size: 16px;
  font-weight: 400;
  color: #111b21;
  line-height: 1.6;
  margin-bottom: 32px;
}
.center { text-align: center; }

/* Pill inputs */
.pill {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid #a9b4ba;
  border-radius: 999px;
  padding: 13px 22px;
  background: #fff;
}
.country-wrap {
  position: relative;
  max-width: 320px;
  margin: 0 auto 14px;
}
.country-pill {
  width: 100%;
  cursor: pointer;
  font-size: 15px;
  color: var(--wa-text);
}
.country-pill .flag { font-size: 18px; }
.country-pill .chev { margin-left: auto; }
.country-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--wa-border);
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(11, 20, 26, 0.12);
  list-style: none;
  z-index: 10;
}
.country-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
}
.country-list li:hover { background: #f0f2f5; }
.country-list .dial-code { margin-left: auto; color: var(--wa-muted); }

.phone-pill {
  max-width: 320px;
  margin: 0 auto 36px;
}
.phone-pill .dial { font-size: 15px; color: var(--wa-text); }
.phone {
  border: none;
  outline: none;
  font-size: 15px;
  flex: 1;
  min-width: 0;
  color: var(--wa-text);
  background: transparent;
}

/* Green button — small centered pill, like the real page */
.btn-green {
  display: block;
  margin: 0 auto 24px;
  background: var(--wa-btn);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 32px;
  min-width: 100px;
  cursor: pointer;
}
.btn-green:hover { background: #00906f; }
.btn-green:disabled { background: var(--wa-border); cursor: default; }

.qr-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--wa-text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--wa-green);
  text-underline-offset: 4px;
  cursor: pointer;
}
.qr-note {
  margin-top: 8px;
  font-size: 13px;
  color: var(--wa-muted);
}

.form-error {
  color: var(--wa-error);
  font-size: 13px;
  text-align: center;
  margin: -24px 0 16px;
}

/* Full-page loader (WhatsApp Web boot screen) */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #f4f3f1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.loader[hidden] { display: none; }
.loader-logo { width: 90px; height: 90px; }
.loader-name {
  font-size: 20px;
  font-weight: 400;
  color: #3b4a54;
  margin-top: 18px;
}
.load-track {
  width: 200px;
  height: 3px;
  background: #e2e5e7;
  margin-top: 30px;
  overflow: hidden;
}
.load-fill {
  height: 100%;
  width: 40%;
  background: #b0b9c0;
  animation: loadslide 1.1s ease-in-out infinite;
}
@keyframes loadslide {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}
.loader-lock {
  margin-top: 26px;
  color: #8696a0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Spinner */
.spinner {
  width: 48px;
  height: 48px;
  margin: 24px auto;
  border: 4px solid var(--wa-border);
  border-top-color: var(--wa-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Segmented code display: X 8 1 S - R L V 3 */
.code-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f5f5f5;
  border-radius: 12px;
  padding: 26px 16px;
  margin-bottom: 36px;
}
.code-char {
  width: 44px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #a9b4ba;
  border-radius: 8px;
  background: #fff;
  font-size: 24px;
  font-weight: 400;
  color: #111b21;
}
.code-dash {
  font-size: 22px;
  color: var(--wa-muted);
  padding: 0 2px;
}

.edit-link {
  background: none;
  border: none;
  color: var(--wa-green-dark);
  font-size: 15px;
  cursor: pointer;
  padding: 0;
}
.edit-link:hover { text-decoration: underline; }

/* Steps: circled numbers joined by a vertical line */
.steps {
  list-style: none;
  counter-reset: step;
  margin-bottom: 28px;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  padding-bottom: 22px;
  font-size: 15px;
  font-weight: 400;
  color: #111b21;
  line-height: 26px;
}
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--wa-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--wa-text);
  background: #fff;
}
.steps li::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 2px;
  width: 1.5px;
  background: var(--wa-border);
}
.steps li:last-child::after { display: none; }

.inline-icon {
  width: 18px;
  height: 18px;
  vertical-align: -4px;
}
.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--wa-border);
  border-radius: 7px;
  background: #fff;
  vertical-align: -7px;
  padding: 2px;
}
.icon-badge-green {
  background: var(--wa-green);
  border-color: var(--wa-green);
}
.icon-badge img { width: 17px; height: 17px; }
.icon-badge-green img { width: 16px; height: 16px; filter: none; }

/* Success */
.check-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--wa-green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

/* Error */
.error-text {
  color: var(--wa-error);
  font-size: 14px;
  margin-bottom: 24px;
  word-break: break-word;
}

/* Footer */
.foot { margin-top: 36px; }
.foot-line {
  text-align: center;
  font-size: 14px;
  color: var(--wa-text);
  margin-bottom: 14px;
}
.foot-line.muted { color: var(--wa-muted); }
.foot-link {
  color: var(--wa-text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--wa-green);
  text-underline-offset: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.foot-plain {
  color: var(--wa-muted);
  text-decoration: none;
  font-size: 13px;
}
.foot-plain:hover { text-decoration: underline; }

/* Pane switching via data-state on #card */
.pane { display: none; }
.card[data-state="phone"] .pane-phone,
.card[data-state="requesting"] .pane-requesting,
.card[data-state="code"] .pane-code,
.card[data-state="success"] .pane-success,
.card[data-state="error"] .pane-error { display: block; }

/* Narrow screens: card keeps border/radius and shrinks, like WhatsApp Web */
@media (max-width: 860px) {
  .topbar { padding: 14px 16px; }
  .card { padding: 40px 28px; }
  .card-title { font-size: 26px; }
}
@media (max-width: 480px) {
  .card { padding: 32px 18px; }
  .card-title { font-size: 24px; }
  .code-char { width: 32px; height: 44px; font-size: 18px; }
  .code-strip { gap: 5px; padding: 16px 8px; }
}
