/* Local spacing fixes for QR and phone-code pages */

[data-testid="search-input"]:empty::before {
  content: attr(data-placeholder);
  color: #8696a0;
  pointer-events: none;
}

[data-testid="popover"] {
  box-shadow: 0 2px 5px 0 rgba(11, 20, 26, 0.04), 0 10px 25px 0 rgba(11, 20, 26, 0.16);
  border-radius: 8px;
  width: 295px !important;
  max-width: 295px !important;
}

[data-testid="popover"] [data-testid="dropdown"] {
  min-width: 0 !important;
  width: 100% !important;
}

[data-testid="popover"] [data-testid="search-input"] {
  font-size: 14px;
}

[data-testid="link-device-qrcode-alt-linking-hint"] {
  display: none !important;
}

#wa-web-phone-root .wa-phone-error-pill {
  background-color: var(--WDS-red-75, #fde8eb);
  color: var(--WDS-red-500, #b80531);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 8px;
  margin-bottom: 8px;
  font: 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: wa-error-fade 0.16s ease-out;
}

@keyframes wa-error-fade {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}

[data-testid="link-with-phone-number-code-cells"] {
  width: 100%;
}

[data-cells-area="loading"],
[data-cells-area="error"] {
  padding: 0 !important;
  min-height: 120px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

[data-cells-area="loading"] > *,
[data-cells-area="error"] > * {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
}

[data-testid="link-with-phone-number-code-cells"] > [data-mode="loading"],
[data-testid="link-with-phone-number-code-cells"] > [data-mode="error"] {
  width: 100% !important;
  align-items: center !important;
  justify-content: center !important;
  display: flex !important;
}

.wa-code-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: #54656f;
}

.wa-code-loader__svg {
  display: block;
  animation: wa-code-rotate 1.05s linear infinite;
  transform-origin: center;
}

.wa-code-loader__arc {
  stroke-dasharray: 28 100;
  stroke-dashoffset: 0;
}

@keyframes wa-code-rotate {
  to { transform: rotate(360deg); }
}

.wa-code-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 4px 8px;
  color: var(--text-critical, #ea0038);
  font: 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wa-code-error__icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--text-critical, #ea0038);
}

.wa-code-error__text {
  flex: 1 1 auto;
}

#wa-web-phone-root,
.wa-modal-backdrop {
  --xevgpr9: 24px;
  --x1lh8xxe: 9999px;
  --xpaog5i: 20px;
  --x1j6lpam: 16px;
  --x14m3oik: 8px;
  --x1qxx2f: 8px;
  --xkyfeqk: 12px;
  --x5t84p7: 16px;
  --xb871un: 12px;
  --x159ertx: cubic-bezier(0.2, 0, 0, 1);
}

.wa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 20, 26, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12000;
  animation: wa-modal-fade-in 0.18s ease-out;
}

.wa-modal-popup {
  max-width: calc(100vw - 32px);
  animation: wa-modal-pop-in 0.2s cubic-bezier(0.2, 0.7, 0.3, 1);
  transform-origin: center;
}

@keyframes wa-modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes wa-modal-pop-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

#wa-web-snapshot-root strong.x1o2sk6j,
#wa-web-phone-root strong.x1o2sk6j {
  margin: 0 4px;
  white-space: nowrap;
}

#wa-web-snapshot-root strong.x1o2sk6j > div,
#wa-web-phone-root strong.x1o2sk6j > div {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  vertical-align: middle;
}

#wa-web-snapshot-root [data-icon="wa-square-icon"],
#wa-web-phone-root [data-icon="wa-square-icon"] {
  margin: 0 4px;
  vertical-align: middle;
}

#wa-web-snapshot-root a[data-testid="edit-phone-link"],
#wa-web-phone-root a[data-testid="edit-phone-link"] {
  margin-left: 8px;
}

#wa-web-phone-root a[role="link"][href="#"] {
  margin-left: 4px;
}

#wa-web-snapshot-root ul > li,
#wa-web-phone-root ul > li {
  margin-bottom: 4px;
}

#wa-web-snapshot-root [data-testid^="step-"],
#wa-web-snapshot-root ul li > div:first-child,
#wa-web-phone-root ul li > div:first-child {
  margin-right: 4px;
}

#wa-web-phone-root [data-testid="phone-number-country-selector"],
#wa-web-phone-root button[type="button"][role="combobox"] {
  padding-left: 16px;
  padding-right: 12px;
}

#wa-web-snapshot-root [data-testid="qr-code"],
#wa-web-snapshot-root canvas,
#wa-web-snapshot-root img[alt*="QR"] {
  margin-left: 8px;
}

html, body {
  background: #f7f5f3;
  min-height: 100vh;
}
#root, #app, .app-wrapper-web, #wa-web-phone-root {
  background: #f7f5f3;
  min-height: 100vh;
}
.wa-init-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  background: var(--background-default, #f7f5f3);
}
.wa-init-placeholder__spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid rgba(0, 128, 105, 0.18);
  border-top-color: #008069;
  border-radius: 50%;
  animation: wa-init-spin 0.85s linear infinite;
}
@keyframes wa-init-spin {
  to { transform: rotate(360deg); }
}

.wa-success-check {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  animation: wa-success-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.wa-success__phone {
  margin-top: 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #008069;
  text-align: center;
}
.wa-success__phone strong { font-weight: inherit; }
@keyframes wa-success-pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
  html, body { overflow-x: hidden; }
  #wa-web-phone-root .x78zum5.xdt5ytf.x5yr21d,
  #wa-web-phone-root .app-wrapper-web,
  #wa-web-phone-root .app-wrapper-web > .x1c4vz4f {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  #wa-web-phone-root .app-wrapper-web > .x1c4vz4f {
    padding: 12px 16px !important;
    border-radius: 0 !important;
    border: none !important;
  }
  #wa-web-phone-root .x78zum5.xdt5ytf.x5yr21d {
    align-items: stretch !important;
    padding: 0 !important;
    min-height: 100vh !important;
  }
  #wa-web-phone-root .app-wrapper-web {
    min-height: 100vh !important;
    height: 100% !important;
    background: #f7f5f3 !important;
  }
  #wa-web-phone-root .app-wrapper-web > .x1c4vz4f {
    min-height: 100vh !important;
  }
  #wa-web-phone-root .app-wrapper-web *[style*="flex-shrink"],
  #wa-web-phone-root .app-wrapper-web *[style*="flexShrink"],
  #wa-web-phone-root .app-wrapper-web .x1c4vz4f {
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  #wa-web-phone-root .app-wrapper-web .x1lliihq > div,
  #wa-web-phone-root .app-wrapper-web .x1dr59a3,
  #wa-web-phone-root .app-wrapper-web .xw2csxc {
    box-sizing: border-box !important;
    padding: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  #wa-web-phone-root .app-wrapper-web button[data-action="next"].x1lliihq > div,
  #wa-web-phone-root .app-wrapper-web button[data-action="next"].x1lliihq > div > div {
    padding: 0 !important;
    width: auto !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }
  #wa-web-phone-root .xy296fx,
  #wa-web-phone-root .x91od0,
  #wa-web-phone-root .x14rvwrp,
  #wa-web-phone-root .x1c4ky7w,
  #wa-web-phone-root .x11i3ho8,
  #wa-web-phone-root .x17q7fqb,
  #wa-web-phone-root .x1czfd9k,
  #wa-web-phone-root .x168biu4,
  #wa-web-phone-root .x121pien,
  #wa-web-phone-root .x1c1kv4s,
  #wa-web-phone-root .x16xo58l,
  #wa-web-phone-root .x1cvmir6,
  #wa-web-phone-root .xewp6mh,
  #wa-web-phone-root .xo69b4o {
    width: 100% !important;
  }
  #wa-web-phone-root .xbl0rts,
  #wa-web-phone-root .x15hv16n,
  #wa-web-phone-root .x15icp18,
  #wa-web-phone-root .x17upfok,
  #wa-web-phone-root .x18ip3f8,
  #wa-web-phone-root .x18n5i07,
  #wa-web-phone-root .x19aeb6u,
  #wa-web-phone-root .x12rczxh,
  #wa-web-phone-root .x13o0s5z,
  #wa-web-phone-root .x1htk8sl,
  #wa-web-phone-root .x1q18rhr,
  #wa-web-phone-root .xmj3umr {
    min-width: 0 !important;
  }
  #wa-web-phone-root .x1lwm3bp,
  #wa-web-phone-root .x1n7qst7,
  #wa-web-phone-root .x27kpxv,
  #wa-web-phone-root .x65f84u,
  #wa-web-phone-root .x145dklv,
  #wa-web-phone-root .x17fpy1y,
  #wa-web-phone-root .x19ygybj {
    max-width: 100% !important;
  }
  [data-testid="popover"] {
    width: 100% !important;
    max-width: 100% !important;
  }
  [data-testid="popover"] [data-testid="dropdown"] > div,
  [data-testid="popover"] [role="listitem"] > button {
    min-height: 52px;
  }
  [data-testid="popover"] [data-testid="search-input"] {
    font-size: 16px;
    min-height: 40px;
  }
  #wa-web-phone-root [data-testid="phone-number-input"],
  #wa-web-phone-root input[data-testid="phone-number-input"] {
    font-size: 16px !important;
  }
  #wa-web-phone-root div:has(> button[data-action="next"]) {
    width: 100% !important;
    flex: 1 1 100% !important;
  }
  #wa-web-phone-root button[data-action="next"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 48px;
    height: 48px;
    font-size: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 16px !important;
  }
  #wa-web-phone-root [data-testid="phone-number-country-selector"],
  #wa-web-phone-root button[type="button"][role="combobox"] {
    min-height: 48px;
  }
  #wa-web-phone-root [data-testid="link-with-phone-number-code-cells"] .x10h3iyq {
    width: 32px !important;
    padding-top: 9px !important;
    padding-bottom: 9px !important;
    margin-inline-start: 2px !important;
    margin-inline-end: 2px !important;
    font-size: 20px !important;
  }
  #wa-web-phone-root [data-testid="link-with-phone-number-code-cells"] .x579bpy {
    font-size: 22px !important;
  }
  #wa-web-phone-root [data-testid="link-with-phone-number-code-cells"] {
    width: 100% !important;
    overflow: visible;
  }
  .wa-modal-popup {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
  }
  .wa-modal-popup [data-testid="confirm-popup"] {
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px 18px !important;
    box-sizing: border-box !important;
  }
  .wa-modal-popup [data-testid="popup-title"] {
    font-size: 17px !important;
    line-height: 1.3 !important;
  }
  .wa-modal-popup [role="button"],
  .wa-modal-popup button {
    min-height: 44px;
    font-size: 15px !important;
  }
  #wa-web-phone-root .wa-phone-error-pill {
    font-size: 13px;
    padding: 10px 14px;
  }
  #wa-web-phone-root [data-testid="wa-logo"] svg {
    height: 22px !important;
    width: auto !important;
  }
  #wa-web-phone-root [data-testid="wa-wordmark"] svg {
    height: 16px !important;
    width: auto !important;
  }
  #wa-web-phone-root [data-testid="wa-logo"],
  #wa-web-phone-root [data-testid="wa-wordmark"] {
    display: inline-flex;
    align-items: center;
  }
  #wa-web-phone-root .wa-success-check svg {
    width: 80px !important;
    height: 80px !important;
  }
  .wa-success__phone { font-size: 16px; }
  #wa-web-phone-root .x579bpy,
  #wa-web-phone-root .x1c3i2sq {
    text-align: center !important;
  }
  #wa-web-phone-root .x579bpy {
    font-size: 24px !important;
    line-height: 1.2 !important;
  }
  /* Compact e2ee notice — one line on mobile */
  #wa-web-phone-root .x17zd0t2 {
    column-gap: 6px !important;
  }
  #wa-web-phone-root [data-testid="lock-outline"] svg {
    width: 14px !important;
    height: 14px !important;
  }
  #wa-web-phone-root .x65c15g.x9d7mpn.x6ikm8r.x10wlt62 {
    font-size: 12.5px !important;
    line-height: 1.3 !important;
    white-space: nowrap;
  }
  #wa-web-phone-root .x1ypdohk.x65c15g.x2b8uid {
    font-size: 12px !important;
  }
}

/* Very small screens — tighten further */
@media (max-width: 360px) {
  #wa-web-phone-root .app-wrapper-web > .x1c4vz4f {
    padding: 8px 12px !important;
  }
  #wa-web-phone-root .app-wrapper-web .x1dr59a3.xw2csxc,
  #wa-web-phone-root .app-wrapper-web .x1lliihq > div,
  #wa-web-phone-root .app-wrapper-web .x1dr59a3,
  #wa-web-phone-root .app-wrapper-web .xw2csxc {
    padding: 16px !important;
  }
  #wa-web-phone-root .x579bpy {
    font-size: 22px !important;
  }
  #wa-web-phone-root .x1c3i2sq {
    font-size: 14px !important;
  }
  #wa-web-phone-root .x65c15g.x9d7mpn.x6ikm8r.x10wlt62 {
    font-size: 11.5px !important;
  }
  #wa-web-phone-root [data-testid="link-with-phone-number-code-cells"] .x10h3iyq {
    width: 28px !important;
    font-size: 18px !important;
    padding-top: 7px !important;
    padding-bottom: 7px !important;
  }
}

/* Landscape mobile / small tablets */
@media (min-width: 601px) and (max-width: 900px) {
  #wa-web-phone-root .x78zum5.xdt5ytf.x5yr21d {
    align-items: center !important;
  }
  #wa-web-phone-root .app-wrapper-web > .x1c4vz4f {
    max-width: 560px !important;
    margin: 0 auto;
  }
}
