/* 功能按钮和菜单组件样式 - 微信风格 */

/* 功能按钮样式增强 */
.function-button {
  background: #07c160;
  color: white;
  border: none;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 4px;
  touch-action: manipulation;
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%) scale(1);
  opacity: 1;
  box-shadow: 0 2px 8px rgba(7, 193, 96, 0.2);
  font-size: 16px;
  z-index: 10;
}

/* 功能按钮图标 */
.function-button .function-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

/* 功能按钮悬停效果 */
.function-button:hover {
  background: #06ad56;
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
}

.function-button:hover .function-icon {
  transform: rotate(90deg);
}

/* 功能按钮激活效果 */
.function-button:active {
  background: #059748;
  transform: translateY(-50%) scale(0.95);
}

/* 功能按钮显示状态 */
.function-button.show {
  transform: translateY(-50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* 功能按钮隐藏状态 */
.function-button.hide {
  transform: translateY(-50%) scale(0);
  opacity: 0;
  pointer-events: none;
}

/* 功能菜单容器 - 微信风格底部滑出 */
.function-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.function-menu.show {
  display: block;
  pointer-events: auto;
}

/* 功能菜单遮罩层 */
.function-menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.function-menu.show .function-menu-overlay {
  opacity: 1;
}

/* 功能菜单内容 - 底部面板 */
.function-menu-content {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  top: auto;
  bottom: 120px;
  background: white;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  z-index: 1001;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.function-menu.show .function-menu-content {
  transform: translateY(0);
}

/* 功能菜单头部 - 微信风格 */
.function-menu-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 24px 20px;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}

/* 拖拽指示器 */
.function-menu-header::before {
  content: "";
  width: 36px;
  height: 4px;
  background: #d1d1d6;
  border-radius: 2px;
  margin-bottom: 16px;
}

.function-menu-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: #666;
}

.function-menu-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  color: #666;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.function-menu-close:hover {
  background: #f5f5f5;
  color: #333;
}

/* 功能菜单网格 - 微信风格 */
.function-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px 16px;
  max-height: 50vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* 功能菜单项 - 垂直布局 */
.function-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
  min-height: 80px;
  justify-content: center;
}

.function-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.function-menu-item:active {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(0.95);
}

/* 功能菜单项图标 - 微信风格 */
.function-menu-item-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #f8f9fa;
  border-radius: 12px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.function-menu-item:hover .function-menu-item-icon {
  transform: scale(1.05);
}

/* 功能菜单项内容 */
.function-menu-item-content {
  text-align: center;
  width: 100%;
}

.function-menu-item-title {
  font-size: 12px;
  font-weight: 400;
  color: #333;
  line-height: 1.2;
  margin: 0;
}

.function-menu-item-description {
  display: none; /* 微信风格不显示描述 */
}

/* 响应式设计 - 微信风格 */
@media (max-width: 480px) {
  .function-menu-grid {
    gap: 12px 12px;
    grid-template-columns: repeat(5, 1fr);
    padding-bottom: 14px;
  }

  .function-menu-item {
    padding: 8px 4px;
    min-height: 72px;
  }

  .function-menu-item-icon {
    font-size: 24px;
    width: 44px;
    height: 44px;
    margin-bottom: 6px;
  }

  .function-menu-item-title {
    font-size: 11px;
  }

  .function-menu-header {
    padding: 10px 20px 16px;
  }

  .function-menu-header h3 {
    font-size: 15px;
  }
}

/* 大屏幕适配 */
@media (min-width: 768px) {
  .function-menu-grid {
    grid-template-columns: repeat(6, 1fr);
    padding: 32px 40px 40px;
    gap: 32px 20px;
  }

  .function-menu-item {
    min-height: 90px;
    padding: 16px 12px;
  }

  .function-menu-item-icon {
    width: 52px;
    height: 52px;
    font-size: 30px;
    margin-bottom: 10px;
  }

  .function-menu-item-title {
    font-size: 13px;
  }
}

/* 动画增强 - 底部滑出效果 */
.function-menu.animate-in .function-menu-content {
  animation: menuSlideUp 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes menuSlideUp {
  0% {
    transform: translateY(100%);
  }
  100% {
    transform: translateY(0);
  }
}

/* 关闭动画 */
.function-menu.animate-out .function-menu-content {
  animation: menuSlideDown 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes menuSlideDown {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(100%);
  }
}

/* 滚动条样式 */
.function-menu-grid::-webkit-scrollbar {
  width: 6px;
}

.function-menu-grid::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.function-menu-grid::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.function-menu-grid::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 管理命令菜单项统一样式 - 与其他图标保持一致 */
.function-menu-item[data-action="clearChat"] .function-menu-item-icon,
.function-menu-item[data-action="pwaManage"] .function-menu-item-icon,
.function-menu-item[data-action="logout"] .function-menu-item-icon {
  background: #f8f9fa;
  color: inherit;
}

/* 管理命令菜单项悬停效果 - 统一样式 */
.function-menu-item[data-action="clearChat"]:hover .function-menu-item-icon,
.function-menu-item[data-action="pwaManage"]:hover .function-menu-item-icon,
.function-menu-item[data-action="logout"]:hover .function-menu-item-icon {
  background: #f8f9fa;
  transform: scale(1.05);
}

@media (max-width: 600px) {
  .function-menu-content {
    max-height: calc(100vh - 120px);
  }
}

.swiper-slide-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 20px 8px;
  padding: 20px 8px 28px 8px;
  justify-items: center;
  align-items: center;
}
@media (max-width: 600px) {
  .swiper-slide-grid {
    gap: 16px 4px;
    padding: 12px 2px 18px 2px;
  }
}

@media (min-width: 600px) {
  .function-menu-content {
    overflow-y: auto;
  }
}
@media (max-width: 599px) {
  .function-menu-content {
    overflow-y: visible;
  }
}
