/* AuthUI v213 — 登录注册系统样式 */

/* === Toast === */
.auth-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.auth-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.auth-toast-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.auth-toast-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.auth-toast-info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* === Modal Overlay === */
.auth-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.auth-modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* === Modal === */
.auth-modal {
  position: relative;
  width: 400px;
  max-width: calc(100vw - 32px);
  background: linear-gradient(160deg, rgba(30, 35, 50, 0.98), rgba(20, 24, 36, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 32px 28px 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.auth-modal-overlay.show .auth-modal {
  transform: scale(1) translateY(0);
}

/* === Close Button === */
.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
}

/* === Modal Header === */
.auth-modal-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-modal-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  color: #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-logo-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.4));
}
.auth-modal-title {
  font-size: 22px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 6px;
}
.auth-modal-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

/* === Form === */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
}
.auth-input-wrap {
  position: relative;
}
.auth-input {
  width: 100%;
  padding: 10px 14px;
  padding-right: 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}
.auth-input:focus {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.auth-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}
.auth-input:not([type="password"]) {
  padding-right: 14px;
}
.auth-toggle-pwd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s;
}
.auth-toggle-pwd:hover {
  color: rgba(255, 255, 255, 0.6);
}
.auth-toggle-pwd svg {
  width: 18px;
  height: 18px;
}

/* === Error === */
.auth-error {
  font-size: 13px;
  color: #f87171;
  min-height: 18px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.auth-error.show {
  opacity: 1;
}

/* === Submit Button === */
.auth-submit {
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}
.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}
.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* === Switch === */
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
}
.auth-switch a {
  color: #818cf8;
  text-decoration: none;
  font-weight: 500;
  margin-left: 4px;
  transition: color 0.2s;
}
.auth-switch a:hover {
  color: #a5b4fc;
}

/* === User Menu (sidebar) === */
.sidebar-user {
  position: relative;
  cursor: pointer;
}
.sidebar-user.menu-open .sidebar-user-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.sidebar-user-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(24, 28, 40, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

/* User Menu Header */
.user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 6px;
}
.user-menu-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-menu-avatar.guest {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
}
.user-menu-info {
  flex: 1;
  min-width: 0;
}
.user-menu-name {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-email {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 2px;
}
.user-menu-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-top: 3px;
}
.user-menu-badge.vip {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #1a1a2e;
}
.user-menu-badge.free {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
}

/* User Menu Items */
.user-menu-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}
.user-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}
.user-menu-item.primary {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
}
.user-menu-item.primary:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}
.user-menu-item.danger {
  color: rgba(248, 113, 113, 0.7);
}
.user-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}
.user-menu-item .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.user-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}

/* === Role Badges === */
.sidebar-user-role.role-vip {
  color: #fbbf24;
}
.sidebar-user-role.role-free {
  color: rgba(255, 255, 255, 0.4);
}
.sidebar-user-role.role-guest {
  color: #818cf8;
}

/* === Gated Features === */
.auth-gated {
  position: relative;
}
.auth-gated::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
}
.auth-gated:hover::after {
  background: rgba(0, 0, 0, 0.5);
}

/* === Hide Old User Menu (replaced by AuthUI) === */
#user-menu { display: none !important; }

/* === Responsive === */
@media (max-width: 480px) {
  .auth-modal {
    width: calc(100vw - 24px);
    padding: 24px 20px 20px;
    border-radius: 14px;
  }
  .auth-modal-title {
    font-size: 20px;
  }
}
