/* ============================================================
   模板库 - 用户认证弹层（独立模块）
   依赖：Bootstrap 5、Font Awesome、site.css 中的主题变量
   ============================================================ */

.auth-modal {
  --auth-red: var(--site-primary, #c41230);
  --auth-red-dark: var(--site-primary-dark, #9c0e26);
  --auth-ink: var(--site-dark, #14161a);
  --auth-muted: #737985;
  --auth-line: #e7e9ee;
}

/* auth.js 仅在引用本模块的页面隐藏 CMS 登录态示例 */
.site-topbar .auth-topbar-hidden {
  display: none !important;
}

.auth-modal .modal-dialog {
  max-width: 540px;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.auth-modal-content {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(12, 14, 18, 0.3);
}

.auth-modal-accent {
  height: 5px;
  background:
    linear-gradient(90deg, var(--auth-red) 0 68%, var(--auth-ink) 68% 84%, #d7d9de 84% 100%);
}

.auth-modal-header {
  position: relative;
  align-items: flex-start;
  padding: 1.7rem 2rem 1.25rem;
  border-bottom: 1px solid var(--auth-line);
  background:
    linear-gradient(135deg, rgba(196, 18, 48, 0.055), transparent 48%),
    #fff;
}

.auth-modal-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
  color: var(--auth-red);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.auth-modal-title {
  color: var(--auth-ink);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.25;
}

.auth-modal-subtitle {
  margin: 0.35rem 0 0;
  color: var(--auth-muted);
  font-size: 0.86rem;
}

.auth-modal-close {
  flex: 0 0 auto;
  margin: 0 !important;
  padding: 0.65rem !important;
  border-radius: 50%;
  background-color: #f2f3f5;
  opacity: 0.72;
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.auth-modal-close:hover {
  background-color: #e8e9ec;
  opacity: 1;
  transform: rotate(90deg);
}

.auth-modal-body {
  padding: 1.6rem 2rem 1.8rem;
}

.auth-panel[hidden] {
  display: none !important;
}

.auth-panel:not([hidden]) {
  animation: auth-panel-in 0.24s ease both;
}

@keyframes auth-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field .form-label {
  margin-bottom: 0.42rem;
  color: #30343a;
  font-size: 0.86rem;
  font-weight: 700;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 0.95rem;
  width: 1rem;
  color: #a1a6af;
  font-size: 0.9rem;
  text-align: center;
  transform: translateY(-50%);
  pointer-events: none;
}

.auth-input-wrap .auth-input {
  padding-left: 2.75rem;
}

.auth-input {
  min-height: 48px;
  border-color: #dde0e5;
  border-radius: 9px;
  color: var(--auth-ink);
  font-size: 0.91rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.auth-input::placeholder {
  color: #abb0b8;
}

.auth-input:hover {
  border-color: #c5c9d0;
}

.auth-input:focus {
  border-color: var(--auth-red);
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.1);
}

.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--auth-red);
}

.auth-captcha-row,
.auth-email-row,
.auth-email-code-row {
  display: flex;
  gap: 0.65rem;
}

.auth-captcha-input,
.auth-email-row .auth-input {
  min-width: 0;
}

.auth-captcha-image {
  position: relative;
  display: inline-flex;
  flex: 0 0 122px;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  overflow: hidden;
  border: 1px solid #d8dbe0;
  border-radius: 9px;
  background:
    repeating-linear-gradient(-24deg, transparent 0 9px, rgba(196, 18, 48, 0.1) 9px 10px),
    linear-gradient(135deg, #f8f8f7, #eceef1);
  color: #25282d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  user-select: none;
}

.auth-captcha-image::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 8px;
  left: -7px;
  height: 1px;
  background: rgba(196, 18, 48, 0.45);
  transform: rotate(-8deg);
}

.auth-send-code {
  flex: 0 0 122px;
  border: 1px solid rgba(196, 18, 48, 0.28);
  border-radius: 9px;
  background: rgba(196, 18, 48, 0.055);
  color: var(--auth-red);
  font-size: 0.84rem;
  font-weight: 700;
}

.auth-send-code:hover,
.auth-send-code:focus {
  border-color: var(--auth-red);
  background: var(--auth-red);
  color: #fff;
}

.auth-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -0.1rem 0 1rem;
}

.auth-check {
  color: var(--auth-muted);
  font-size: 0.85rem;
}

.auth-check .form-check-input:checked {
  border-color: var(--auth-red);
  background-color: var(--auth-red);
}

.auth-check .form-check-input:focus {
  border-color: var(--auth-red);
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.1);
}

.auth-text-button {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--auth-red);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.auth-text-button:hover,
.auth-text-button:focus {
  color: var(--auth-red-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-submit {
  width: 100%;
  min-height: 49px;
  border-radius: 9px;
  font-size: 0.96rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 20px rgba(196, 18, 48, 0.2);
}

.auth-switch-note {
  margin: 1rem 0 0;
  color: var(--auth-muted);
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 575.98px) {
  .auth-modal .modal-dialog {
    align-items: flex-end;
    min-height: calc(100% - 0.75rem);
    margin: 0.75rem 0.55rem 0;
  }

  .auth-modal-content {
    max-height: calc(100vh - 0.75rem);
    border-radius: 15px 15px 0 0;
  }

  .auth-modal-header {
    padding: 1.3rem 1.25rem 1rem;
  }

  .auth-modal-title {
    font-size: 1.35rem;
  }

  .auth-modal-body {
    padding: 1.25rem 1.25rem 1.5rem;
  }

  .auth-captcha-image,
  .auth-send-code {
    flex-basis: 112px;
  }
}

@media (max-width: 380px) {
  .auth-captcha-row,
  .auth-email-row {
    flex-wrap: wrap;
  }

  .auth-captcha-image,
  .auth-send-code {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-panel:not([hidden]) {
    animation: none;
  }

  .auth-modal-close {
    transition: none;
  }
}
