/* ============================================
   认证UI样式
   ============================================ */

/* 模态框 */
.auth-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.3s ease;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.auth-modal-content {
  position: relative;
  background: white;
  border-radius: 24px;
  padding: 40px;
  width: 90%;
  max-width: 440px;
  margin: auto;
  max-height: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  font-size: 20px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: rotate(90deg);
}

.auth-modal-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-modal-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #2C2C2C;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #9D86C8 0%, #C9A9E4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-modal-header p {
  font-size: 14px;
  color: #A8A8A8;
}

/* 表单 */
.auth-input-group {
  margin-bottom: 20px;
}

.auth-input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #2C2C2C;
  margin-bottom: 8px;
}

.auth-input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #E8E8E8;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s;
  background: white;
}

.auth-input-group input:focus {
  outline: none;
  border-color: #9D86C8;
  box-shadow: 0 0 0 3px rgba(157, 134, 200, 0.1);
}

.auth-input-group small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #A8A8A8;
}

/* 按钮 */
.auth-btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #9D86C8 0%, #C9A9E4 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.auth-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(157, 134, 200, 0.3);
}

.auth-btn-primary:active {
  transform: translateY(0);
}

/* 底部链接 */
.auth-modal-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #E8E8E8;
  font-size: 14px;
  color: #A8A8A8;
}

.auth-modal-footer a {
  color: #9D86C8;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s;
}

.auth-modal-footer a:hover {
  color: #C9A9E4;
  text-decoration: underline;
}

/* 加载状态 */
.auth-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #E8E8E8;
  border-top-color: #9D86C8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.auth-loading p {
  font-size: 14px;
  color: #A8A8A8;
}

/* 通知 */
.notification {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10001;
  background: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(400px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.show {
  transform: translateX(0);
}

.notification-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

.notification-success .notification-icon {
  background: #4CAF50;
  color: white;
}

.notification-error .notification-icon {
  background: #F44336;
  color: white;
}

.notification-info .notification-icon {
  background: #2196F3;
  color: white;
}

.notification-message {
  font-size: 14px;
  color: #2C2C2C;
}

/* 导航栏认证区域 */
.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: #2C2C2C;
}

.nav-user-link {
  color: #2C2C2C;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  padding: 6px 12px;
  border-radius: 8px;
}

.nav-user-link:hover {
  background: rgba(157, 134, 200, 0.1);
  color: #9D86C8;
}

.nav-btn-write,
.nav-btn-login,
.nav-btn-register,
.nav-btn-logout {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  font-family: inherit;
  font-weight: 500;
}

.nav-btn-write {
  background: linear-gradient(135deg, #9D86C8 0%, #C9A9E4 100%);
  color: white;
  border: none;
}

.nav-btn-write:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(157, 134, 200, 0.3);
}

.nav-btn-login {
  background: white;
  color: #9D86C8;
  border: 2px solid #9D86C8;
}

.nav-btn-login:hover {
  background: #F0E6FA;
}

.nav-btn-register {
  background: linear-gradient(135deg, #9D86C8 0%, #C9A9E4 100%);
  color: white;
  border: none;
}

.nav-btn-register:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(157, 134, 200, 0.3);
}

.nav-btn-logout {
  background: transparent;
  color: #A8A8A8;
  border: 1px solid #E8E8E8;
}

.nav-btn-logout:hover {
  background: #F5F5F5;
  color: #2C2C2C;
}

/* 生日彩蛋 - 五彩纸屑 */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 9998;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* 动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

/* 页面过渡 */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 20000;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(240, 230, 250, 0.95) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(201, 169, 228, 0.55) 0%, transparent 50%),
    linear-gradient(160deg, #FEFBF7 0%, #F0E6FA 100%);
  transition: opacity 0.45s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-transition.is-active {
  opacity: 1;
  pointer-events: all;
}

.page-transition__mark {
  font-size: 28px;
  opacity: 0;
  transform: translateY(8px) scale(0.92);
  transition: opacity 0.35s ease 0.08s, transform 0.35s ease 0.08s;
  filter: drop-shadow(0 4px 16px rgba(157, 134, 200, 0.35));
}

.page-transition.is-active .page-transition__mark {
  opacity: 1;
  transform: translateY(0) scale(1);
}

body.page-enter {
  animation: pageEnter 0.55s ease both;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-transition,
  .page-transition__mark,
  body.page-enter {
    transition: none !important;
    animation: none !important;
  }
}

/* 响应式 */
@media (max-width: 768px) {
  .auth-modal {
    padding: 12px;
    align-items: flex-start;
  }

  .auth-modal-content {
    padding: 28px 20px;
    max-width: 100%;
    width: 100%;
    margin-top: 8px;
    margin-bottom: 24px;
  }

  .auth-modal-header h2 {
    font-size: 22px;
  }

  .auth-modal-close {
    width: 40px;
    height: 40px;
  }

  .notification {
    left: 16px;
    right: 16px;
    transform: none;
  }

  .nav-user {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .nav-btn-login,
  .nav-btn-logout,
  .nav-btn-write {
    min-height: 40px;
  }
}
