/* ===================================
   登录/注册模态框 + 导航栏登录按钮
   =================================== */

/* 导航栏登录按钮 */
.nav-login-btn {
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-login-btn:hover {
  border-color: var(--text-muted);
  background: var(--bg-card);
}

/* ====== 遮罩层 ====== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ====== 面板 ====== */
.auth-panel {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.3s ease, background-color var(--transition-normal);
}

.auth-overlay.open .auth-panel {
  transform: translateY(0) scale(1);
}

/* 关闭按钮 */
.auth-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.auth-close:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

/* ====== Tabs ====== */
.auth-header {
  margin-bottom: 1.5rem;
}

.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 3px;
}

.auth-tab {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab:hover {
  color: var(--text-secondary);
}

.auth-tab.active {
  color: var(--text-primary);
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ====== 表单 ====== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.auth-field label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-field input,
.auth-field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-page);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), background-color var(--transition-normal);
}

.auth-field input:focus,
.auth-field select:focus {
  border-color: #3fb8c4;
}

.auth-field input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.auth-field select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* 提交按钮 */
.auth-submit {
  width: 100%;
  padding: 0.65rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: #3fb8c4;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 0.25rem;
}

.auth-submit:hover {
  background: #35a3ae;
}

.auth-submit:active {
  transform: scale(0.99);
}

.auth-submit--register {
  background: #e8734a;
}

.auth-submit--register:hover {
  background: #d4653f;
}

/* 底部链接 */
.auth-footer-link {
  text-align: center;
  margin-top: 0.25rem;
}

.auth-footer-link a {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.auth-footer-link a:hover {
  color: var(--text-primary);
}

/* ====== 错误/成功提示 ====== */
.auth-message {
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  display: none;
  line-height: 1.5;
}

.auth-message.show {
  display: block;
}

.auth-message--error {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.15);
}

.auth-message--success {
  color: #059669;
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.15);
}

/* ====== 提交按钮加载态 ====== */
.auth-submit.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.auth-submit.loading::after {
  content: '';
  position: absolute;
  right: 0.75rem;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* ====== 邀请码字段（动态显隐） ====== */
.auth-field--invite {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

.auth-field--invite.show {
  max-height: 80px;
  opacity: 1;
  margin-top: 0;
}

/* ====== 导航栏用户菜单（已登录状态） ====== */
.nav-user-area {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-user-btn:hover {
  border-color: var(--text-muted);
  background: var(--bg-card);
}

/* 用户头像占位 */
.nav-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3fb8c4;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* 下拉菜单箭头 */
.nav-user-arrow {
  width: 10px;
  height: 10px;
  opacity: 0.4;
  transition: transform 0.2s ease;
}

.nav-user-area.open .nav-user-arrow {
  transform: rotate(180deg);
}

/* 下拉菜单 */
.nav-user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 100;
  overflow: hidden;
}

.nav-user-area.open .nav-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-user-dropdown__info {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

.nav-user-dropdown__name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.nav-user-dropdown__email {
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
}

.nav-user-dropdown__role {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  margin-top: 0.35rem;
}

.nav-user-dropdown__role--coach {
  color: #3fb8c4;
  background: rgba(63, 184, 196, 0.1);
}

.nav-user-dropdown__role--student {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.nav-user-dropdown__role--parent {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.nav-user-dropdown__role--admin {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* 审核状态徽章 */
.nav-user-dropdown__status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  margin-top: 0.25rem;
  margin-left: 0.25rem;
}

.nav-user-dropdown__status--pending {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.nav-user-dropdown__status--approved {
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.nav-user-dropdown__status--rejected {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.nav-user-dropdown__actions {
  padding: 0.4rem;
}

.nav-user-dropdown__btn {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.nav-user-dropdown__btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.nav-user-dropdown__btn--logout {
  color: #dc2626;
}

.nav-user-dropdown__btn--logout:hover {
  background: rgba(220, 38, 38, 0.06);
  color: #dc2626;
}

/* ====== 审核中提示条 ====== */
.auth-pending-banner {
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  color: #92400e;
  background: rgba(245, 158, 11, 0.1);
  border-bottom: 1px solid rgba(245, 158, 11, 0.15);
  text-align: center;
  line-height: 1.5;
  display: none;
}

.auth-pending-banner.show {
  display: block;
}

/* ====== 忘记密码面板 ====== */
.auth-form--reset {
  display: none;
}

/* ====== 响应式 ====== */
@media (max-width: 768px) {
  .nav-user-dropdown {
    right: -0.5rem;
    min-width: 200px;
  }

  .nav-user-btn span {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
