/*
 * 文件作用：
 *   pmgr-account-modal.php 输出的三站统一账户弹窗的样式。
 *   未登录用户点击导航"账户"或 /my-account/ 链接时弹出。
 *
 * 三站主题色：
 *   body.pmgr-am-host-lumavet → 紫色 #5f4175（lumavet 沿用现有品牌色）
 *   body.pmgr-am-host-iwamed  → 红色 #C8102E
 *   body.pmgr-am-host-ipetmed → 红色 #C8102E
 *
 * 设计目标：
 *   - 居中白色卡片 + 半透明黑色遮罩
 *   - 顶部 LOGIN / SIGN UP 大 Tab
 *   - 表单字段 input 红/紫色 focus 高亮
 *   - 密码可见性切换按钮
 *   - 响应式：手机端宽度 92vw、padding 收缩
 *   - z-index 99999，覆盖 nav (z=9999) 和搜索 FAB
 */

/* ───────────────────────────── 主题变量 ───────────────────────────── */

/* 默认（备用）：红色品牌 */
.pmgr-am-overlay {
  --pmgr-am-accent: #C8102E;
  --pmgr-am-accent-hover: #a40d24;
  --pmgr-am-accent-soft: rgba(200, 16, 46, 0.12);
}

/* lumavet 紫色覆盖 */
body.pmgr-am-host-lumavet .pmgr-am-overlay {
  --pmgr-am-accent: #5f4175;
  --pmgr-am-accent-hover: #4a3260;
  --pmgr-am-accent-soft: rgba(95, 65, 117, 0.12);
}

/* ───────────────────────────── 遮罩 + 弹窗容器 ───────────────────────────── */

.pmgr-am-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pmgr-am-overlay[hidden] {
  display: none !important;
}

.pmgr-am-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 23, 0.55);
  backdrop-filter: blur(2px);
}

.pmgr-am-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  padding: 28px 28px 22px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: #1a1a1d;
  animation: pmgr-am-fade-in 0.18s ease-out;
}

@keyframes pmgr-am-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 关闭按钮 */
.pmgr-am-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: #9a9a9f;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.pmgr-am-close:hover {
  color: var(--pmgr-am-accent);
  background: var(--pmgr-am-accent-soft);
}

/* 标题 */
.pmgr-am-title {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: #1a1a1d;
}

/* ───────────────────────────── 主 Tab：LOGIN / SIGN UP ───────────────────────────── */

.pmgr-am-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid #e5e6ea;
}

.pmgr-am-tab {
  flex: 1;
  padding: 12px 4px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #6b6b73;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.pmgr-am-tab:hover {
  color: var(--pmgr-am-accent);
}

.pmgr-am-tab.is-active {
  color: var(--pmgr-am-accent);
  border-bottom-color: var(--pmgr-am-accent);
}

/* ───────────────────────────── 视图（login / register / reset） ───────────────────────────── */

.pmgr-am-view {
  display: none;
}

.pmgr-am-view.is-active {
  display: block;
}

.pmgr-am-view[hidden] {
  display: none !important;
}

/* ipetmed 子 Tab（手机号 / 邮箱） */
.pmgr-am-subtabs {
  display: inline-flex;
  margin-bottom: 16px;
  padding: 4px;
  background: #f3f4f6;
  border-radius: 8px;
}

.pmgr-am-subtab {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #5a5a60;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.pmgr-am-subtab.is-active {
  color: #ffffff;
  background: var(--pmgr-am-accent);
}

/* ───────────────────────────── 表单 ───────────────────────────── */

.pmgr-am-form {
  display: none;
}

.pmgr-am-form.is-active {
  display: block;
}

.pmgr-am-form[hidden] {
  display: none !important;
}

.pmgr-am-intro {
  margin: 0 0 14px;
  font-size: 13px;
  color: #5a5a60;
  line-height: 1.5;
}

.pmgr-am-field {
  margin-bottom: 14px;
}

.pmgr-am-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3a3a3f;
  margin-bottom: 6px;
}

.pmgr-am-field label .required {
  color: var(--pmgr-am-accent);
}

.pmgr-am-field input[type="text"],
.pmgr-am-field input[type="email"],
.pmgr-am-field input[type="tel"],
.pmgr-am-field input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #1a1a1d;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pmgr-am-field input:focus {
  outline: none;
  border-color: var(--pmgr-am-accent);
  box-shadow: 0 0 0 3px var(--pmgr-am-accent-soft);
}

/* 密码可见性切换 */
.pmgr-am-pw-wrap {
  position: relative;
}

.pmgr-am-pw-wrap input {
  padding-right: 42px;
}

.pmgr-am-pw-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9a9a9f;
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s;
}

.pmgr-am-pw-toggle:hover {
  color: var(--pmgr-am-accent);
}

.pmgr-am-pw-toggle.is-shown {
  color: var(--pmgr-am-accent);
}

/* Captcha 行：输入框 + 图片 */
.pmgr-am-captcha-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.pmgr-am-captcha-row input[type="text"] {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.1em;
}

.pmgr-am-captcha-img {
  flex: 0 0 120px;
  width: 120px;
  height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  background: #f5f6f8;
  transition: opacity 0.15s;
}

.pmgr-am-captcha-img:hover {
  opacity: 0.8;
}

/* 短信验证码行：输入 + 发送按钮 */
.pmgr-am-code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.pmgr-am-code-row input {
  flex: 1;
  min-width: 0;
}

.pmgr-am-send-code {
  flex: 0 0 auto;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pmgr-am-accent);
  background: #ffffff;
  border: 1px solid var(--pmgr-am-accent);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.pmgr-am-send-code:hover:not(:disabled) {
  color: #ffffff;
  background: var(--pmgr-am-accent);
}

.pmgr-am-send-code:disabled {
  color: #9a9a9f;
  border-color: #d1d5db;
  background: #f3f4f6;
  cursor: not-allowed;
}

/* Remember me + Forgot password 同行 */
.pmgr-am-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
  font-size: 13px;
}

.pmgr-am-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #3a3a3f;
}

.pmgr-am-check input {
  margin: 0;
}

.pmgr-am-link {
  color: #5a5a60;
  text-decoration: none;
  cursor: pointer;
}

.pmgr-am-link:hover {
  color: var(--pmgr-am-accent);
  text-decoration: underline;
}

/* 操作行 + 提交按钮 */
.pmgr-am-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.pmgr-am-submit {
  width: 100%;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  background: var(--pmgr-am-accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.5px;
}

.pmgr-am-submit:hover:not(:disabled) {
  background: var(--pmgr-am-accent-hover);
}

.pmgr-am-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 提示消息行 */
.pmgr-am-msg {
  margin: 12px 0 0;
  font-size: 13px;
  min-height: 18px;
  line-height: 1.5;
}

.pmgr-am-msg.is-error {
  color: #b91c1c;
}

.pmgr-am-msg.is-success {
  color: #047857;
}

/* ───────────────────────────── 响应式 ───────────────────────────── */

@media (max-width: 480px) {
  .pmgr-am-overlay {
    padding: 12px;
  }
  .pmgr-am-modal {
    padding: 22px 18px 18px;
    max-width: 100%;
    border-radius: 12px;
  }
  .pmgr-am-title {
    font-size: 18px;
  }
  .pmgr-am-tab {
    font-size: 13px;
    padding: 11px 4px;
  }
  .pmgr-am-captcha-img {
    flex: 0 0 100px;
    width: 100px;
  }
  .pmgr-am-row {
    flex-wrap: wrap;
  }
}

/* 禁止 body 滚动（弹窗打开时由 JS 加 .pmgr-am-no-scroll class 到 html） */
html.pmgr-am-no-scroll,
html.pmgr-am-no-scroll body {
  overflow: hidden !important;
}

/* ipetmed 满屏 Tab UI 隐藏 —— 由 pmgr-mobile-auth.php 钩到 wp_footer 时输出，
   该容器在 /my-account/ 页面也不应可见，搬到弹窗后由弹窗 JS 拷贝展示。
   保留隐藏样式作为兜底，确保万一 JS 没加载时也不会满屏铺开。 */
.pmgr-ma-wrap[data-pmgr-am-host="ipetmed"] {
  display: none !important;
}
