/**
 * 与 application/index/view/common/header.html 配套：顶栏、下拉、登录/注册弹窗。
 * 在需引入 common/header 的页面中 link 本文件，并加载 /static/js/auth-modal.js。
 */
:root {
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --brown-50: #faf7f2;
  --brown-600: #5c4b46;
  --brown-700: #4a3c38;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.topbar-inner {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}

.nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-width: 0;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.25s;
}

.nav a:hover {
  color: var(--text);
}

.nav a.is-active {
  color: var(--brown-600);
  font-weight: 700;
  position: relative;
}

.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  border-radius: 999px;
  background: var(--brown-600);
}

.topbar-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-menu {
  position: relative;
  display: inline-block;
}

.user-menu::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  width: 224px;
  height: 14px;
  z-index: 59;
}

.user-menu > .avatar-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: none;
  outline: none;
  transition: box-shadow 0.3s;
}

.user-menu:hover > .avatar-btn,
.user-menu:focus-within > .avatar-btn {
  box-shadow: 0 0 0 2px rgba(92, 67, 50, 0.35);
}

.user-menu > .avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

#user-dropdown {
  position: absolute;
  z-index: 60;
  top: calc(100% + 12px);
  right: 0;
  left: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 224px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s var(--ease-spring), transform 0.2s var(--ease-spring), visibility 0.2s;
}

.user-menu:hover #user-dropdown,
.user-menu:focus-within #user-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.user-auth {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar .auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 25vw;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.topbar .auth-btn-ghost {
  color: var(--brown-600);
  background: transparent;
  border: 1px solid var(--brown-600);
}

.topbar .auth-btn-ghost:hover {
  background: rgba(92, 67, 50, 0.06);
}

.topbar .auth-btn-primary {
  color: #fff;
  border: 0;
  background: var(--brown-600);
  box-shadow: 0 4px 14px rgba(74, 52, 40, 0.25);
}

.topbar .auth-btn-primary:hover {
  background: var(--brown-700);
  filter: none;
}

.topbar .user-auth .auth-btn {
  font: inherit;
  cursor: pointer;
}

.auth-modal {
  padding: 0;
  border: none;
  border-radius: 18px;
  max-width: 420px;
  width: calc(100vw - 32px);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
}

.auth-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
}

.auth-modal-panel {
  padding: 24px 24px 20px;
  position: relative;
}

.auth-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #9ca3af;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.auth-modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.auth-modal-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.auth-form-msg {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

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

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-top: 4px;
}

.auth-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input:focus {
  outline: none;
  border-color: rgba(92, 67, 50, 0.45);
  box-shadow: 0 0 0 3px rgba(92, 67, 50, 0.12);
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-submit {
  margin-top: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  background: var(--brown-600);
  box-shadow: 0 6px 18px rgba(74, 52, 40, 0.28);
  transition: filter 0.2s, box-shadow 0.2s;
}

.auth-submit:hover {
  filter: brightness(1.05);
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-modal-footer {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.auth-text-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--brown-600);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-text-btn:hover {
  color: var(--brown-700);
}

.auth-captcha-row .input-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.auth-captcha-row .form-control {
  flex: 1 1 140px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
}

.auth-captcha-row .btn-captcha {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--brown-600);
  color: #fff;
  text-decoration: none;
}

.auth-captcha-row img[onclick] {
  border-radius: 8px;
  cursor: pointer;
  vertical-align: middle;
}

.auth-login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-radius: 12px;
  padding: 4px;
  background: rgba(17, 24, 39, 0.06);
}

.auth-login-tab {
  flex: 1;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  transition: background 0.2s, color 0.2s;
}

.auth-login-tab.is-active {
  color: var(--brown-600);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.dropdown-head {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f2f5;
  margin-bottom: 6px;
}

.dropdown-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.dropdown-mail {
  margin: 2px 0 0;
  font-size: 12px;
  color: #6b7280;
}

.dropdown-link {
  display: block;
  text-decoration: none;
  font-size: 14px;
  color: #374151;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.2s, color 0.2s;
}

.dropdown-link:hover {
  background: var(--brown-50);
  color: var(--brown-600);
}

.dropdown-link.danger {
  color: #dc2626;
  margin-top: 4px;
}

.dropdown-link.danger:hover {
  background: #fef2f2;
}

.footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
}

.footer-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 14px;
}

.footer-inner p {
  margin: 0;
}
