/* Modal verificación de teléfono por WhatsApp (perfil, shell, etc.) */

.pv-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pv-modal[hidden] {
  display: none !important;
}

.pv-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.55);
}

.pv-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: min(92dvh, 900px);
  overflow: hidden;
  background: var(--panel, #fff);
  color: var(--text, #16212d);
  border: 1px solid var(--line, #d7dee8);
  border-radius: 14px;
  box-shadow: none;
  font-family: "Montserrat", "Roboto", sans-serif;
  animation: pv-pop 180ms ease-out;
}

.pv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--line, #d7dee8);
  background: var(--panel, #fff);
  box-sizing: border-box;
  flex: none;
}

.pv-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pv-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.pv-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #5a6a7e);
  cursor: pointer;
}

.pv-close::before {
  content: "";
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url(/assets/icons/icon-x.png) center / contain no-repeat;
  mask: url(/assets/icons/icon-x.png) center / contain no-repeat;
}

.pv-close:hover {
  background: var(--bg-3, #edf2f7);
  border-color: var(--line, #d7dee8);
  color: var(--text, #16212d);
}

.pv-close:focus-visible,
.pv-btn:focus-visible {
  outline: 2px solid var(--acc, #ffc400);
  outline-offset: 2px;
}

.pv-body {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.pv-help {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted, #5a6a7e);
}

.pv-current-phone {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #16212d);
}

.pv-current-phone[hidden],
.pv-step[hidden] {
  display: none !important;
}

.pv-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.pv-stepper {
  display: flex;
  align-items: center;
}

.pv-step-indicator {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #6b7b8f);
}

.pv-input,
.pv-code-box {
  border: 1px solid var(--line, #c9d4e0);
  background: var(--bg-3, #fdfefe);
  color: var(--text, #16212d);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.pv-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
}

.pv-input::placeholder {
  color: var(--muted, #8796a8);
}

.pv-code {
  display: grid;
  grid-template-columns: repeat(6, 42px);
  gap: 8px;
  justify-content: start;
}

.pv-code-box {
  height: 44px;
  border-radius: 8px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}

.pv-input:focus,
.pv-code-box:focus {
  border-color: var(--acc, #ffc400);
  box-shadow: 0 0 0 2px rgba(245, 197, 24, 0.25);
}

.pv-hint,
.pv-resend-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted, #5a6a7e);
}

.pv-resend-hint {
  min-height: 16px;
}

.pv-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #d7dee8);
}

.pv-btn {
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--btn-bg, #111827);
  color: var(--btn-fg, #fff);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.pv-btn:hover:not(:disabled) {
  filter: brightness(1.12);
}

.pv-btn.ghost {
  background: transparent;
  border-color: var(--line, #c9d4e0);
  color: var(--text, #314155);
}

.pv-btn.ghost:hover:not(:disabled) {
  filter: none;
  background: var(--bg-3, #edf2f7);
}

.pv-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pv-error {
  padding: 8px 10px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  font-size: 13px;
}

.pv-error.ok {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.pv-error[hidden] {
  display: none !important;
}

.modal-open {
  overflow: hidden;
}

:root[data-theme="dark"] .pv-panel,
:root[data-theme="dark"] .pv-head {
  background: #121a24;
  border-color: #2a3a4e;
}

:root[data-theme="dark"] .pv-actions {
  border-top-color: #2a3a4e;
}

:root[data-theme="dark"] .pv-input,
:root[data-theme="dark"] .pv-code-box {
  background: #0e141d;
  border-color: #31445c;
  color: #edf3fa;
}

:root[data-theme="dark"] .pv-title,
:root[data-theme="dark"] .pv-label,
:root[data-theme="dark"] .pv-current-phone,
:root[data-theme="dark"] .pv-btn.ghost {
  color: #edf3fa;
}

:root[data-theme="dark"] .pv-step-indicator,
:root[data-theme="dark"] .pv-help,
:root[data-theme="dark"] .pv-hint,
:root[data-theme="dark"] .pv-resend-hint,
:root[data-theme="dark"] .pv-close {
  color: #97a8bb;
}

:root[data-theme="dark"] .pv-input::placeholder {
  color: #72859a;
}

:root[data-theme="dark"] .pv-btn.ghost {
  border-color: #31445c;
}

:root[data-theme="dark"] .pv-close:hover,
:root[data-theme="dark"] .pv-btn.ghost:hover:not(:disabled) {
  background: #1b2736;
  border-color: #31445c;
  color: #edf3fa;
}

@keyframes pv-pop {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pv-panel {
    animation: none;
  }
}

@media (max-width: 720px) {
  .pv-head {
    min-height: 52px;
    padding: 8px 8px 8px 14px;
  }
}

@media (max-width: 520px) {
  .pv-modal {
    align-items: flex-end;
    padding:
      max(8px, env(safe-area-inset-top, 0px))
      max(8px, env(safe-area-inset-right, 0px))
      max(8px, env(safe-area-inset-bottom, 0px))
      max(8px, env(safe-area-inset-left, 0px));
  }

  .pv-code {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .pv-code-box {
    height: 42px;
    font-size: 16px;
  }

  .pv-actions .pv-btn {
    flex: 1 1 0;
    min-width: 0;
  }
}
