/* ===== iOS Safe Area ===== */
:root {
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --top-nav-base-height: 72px;
  --top-nav-height: calc(var(--top-nav-base-height) + var(--safe-area-inset-top));
}

@supports (top: constant(safe-area-inset-top)) {
  :root {
    --safe-area-inset-top: constant(safe-area-inset-top);
  }
}

.safe-top-nav {
  padding-top: calc(1rem + var(--safe-area-inset-top));
}

.safe-top-toolbar {
  top: var(--top-nav-height);
}

/* ===== 保留的核心动效 ===== */
.bg-orb {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  left: -100px;
  top: -80px;
  background: #ffa96d;
}

.orb-b {
  right: -130px;
  bottom: -120px;
  background: #72c6c1;
}

/* ===== Hero Logo 动效 ===== */
.hero-logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero-logo-wrap::before {
  content: '';
  position: absolute;
  inset: -12px;
  background: radial-gradient(circle, rgba(235, 115, 40, 0.18) 0%, transparent 70%);
  border-radius: 50%;
  animation: pulse-glow 3s ease-in-out infinite;
}

.hero-logo {
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(235, 115, 40, 0.25);
  animation: float 4s ease-in-out infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

/* ===== 网格背景 ===== */
.grid-bg {
  background-size: 40px 40px;
}

/* ===== Toast 通知 ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1f2937;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== 筛选按钮激活态 ===== */
.filter.is-active {
  background: rgba(217, 119, 6, 0.1) !important;
  color: #D97706 !important;
  border-color: rgba(217, 119, 6, 0.2) !important;
}

.dark .filter.is-active {
  background: rgba(217, 119, 6, 0.15) !important;
  color: #F59E0B !important;
  border-color: rgba(217, 119, 6, 0.3) !important;
}

/* ===== 任务卡片状态 ===== */
.status-open {
  background: #fef3c7;
  color: #92400e;
}

.status-progress {
  background: #dbeafe;
  color: #1e40af;
}

.status-done {
  background: #d1fae5;
  color: #065f46;
}

/* ===== 滚动条 ===== */
.preview-scroll::-webkit-scrollbar {
  width: 4px;
}

.preview-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.preview-scroll::-webkit-scrollbar-thumb {
  background-color: #e5e7eb;
  border-radius: 20px;
}

/* ===== 隐藏滚动条 ===== */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ===== 能力标签悬浮提示 ===== */
.ability-tag {
  position: relative;
}

.ability-tag .tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 10;
  margin-bottom: 8px;
}

.ability-tag .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2937;
}

.ability-tag:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* ===== 响应式调整 ===== */
@media (max-width: 1024px) {
  .hero-logo {
    width: 80px !important;
    height: 80px !important;
  }
}

@media (max-width: 640px) {
  .bg-orb {
    width: 180px;
    height: 180px;
    filter: blur(60px);
  }

  .hero-logo {
    width: 64px !important;
    height: 64px !important;
    border-radius: 16px;
  }
}

/* ===== 主标签页样式（Pill Toggle） ===== */
.main-tab {
  position: relative;
  cursor: pointer;
  outline: none;
  user-select: none;
  transition: all 0.2s ease;
}

/* ===== 技能分类区块样式 ===== */
.skill-category-section {
  margin-bottom: 2rem;
}

.skill-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.skill-category-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dark .skill-category-title {
  color: white;
}

.skill-category-count {
  font-size: 0.875rem;
  color: #6B7280;
}

.dark .skill-category-count {
  color: #9CA3AF;
}

.skill-category-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
}

@media (min-width: 768px) {
  .skill-category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== 瀑布流布局（任务大厅专用） ===== */
.masonry-grid {
  column-count: 1;
  column-gap: 1.5rem;
}

@media (min-width: 768px) {
  .masonry-grid {
    column-count: 2;
  }
}

@media (min-width: 1280px) {
  .masonry-grid {
    column-count: 3;
  }
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 1.5rem;
}

/* ===== 网格布局（技能大厅专用） ===== */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .skill-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .skill-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 技能卡片固定 4:3 比例封面 */
.skill-card-cover {
  position: relative;
  width: 100%;
  padding-top: 75%;
  /* 4:3 比例 = 3/4 = 75% */
  overflow: hidden;
  border-radius: 0.75rem;
}

.skill-card-cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 裁剪适配 */
}

/* ===== 卡片悬浮按钮（覆盖在图片封面底部） ===== */
.card-hover-buttons {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  pointer-events: none;
}

.group:hover .card-hover-buttons {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* 悬浮按钮上方增加额外渐变遮罩以提升可读性 */
.card-hover-gradient {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 40%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 15;
  pointer-events: none;
}

.group:hover .card-hover-gradient {
  opacity: 1;
}

/* ===== Shimmer 加载动画 ===== */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* ===== Material Symbols 配置 ===== */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ===== 对话模块 ===== */
#chat-module {
  transition: all 0.3s ease;
}

/* 折叠/展开动画 */
#chat-content {
  max-height: 800px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 1;
}

#chat-content.collapsed {
  max-height: 0;
  opacity: 0;
  border-top: none;
}

#chat-chevron {
  transition: transform 0.3s ease;
}

#chat-chevron.collapsed {
  transform: rotate(0deg);
}

/* 聊天列表项 */
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.chat-list-item:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.dark .chat-list-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.chat-list-item.active {
  background: rgba(217, 119, 6, 0.06);
  border-left: 3px solid #D97706;
}

.chat-list-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #e5e7eb;
}

.dark .chat-list-item-avatar {
  border-color: #374151;
}

.chat-list-item-info {
  flex: 1;
  min-width: 0;
}

.chat-list-item-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark .chat-list-item-name {
  color: white;
}

.chat-list-item-preview {
  font-size: 0.6875rem;
  color: #9CA3AF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-list-item-time {
  font-size: 0.625rem;
  color: #9CA3AF;
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-list-item-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #EF4444;
  flex-shrink: 0;
}

/* 消息气泡 */
.chat-bubble {
  max-width: 85%;
  padding: 0.5rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  word-break: break-word;
  animation: bubbleIn 0.2s ease-out;
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-bubble-self {
  margin-left: auto;
  background: linear-gradient(135deg, #D97706, #F59E0B);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.chat-bubble-peer {
  margin-right: auto;
  background: #F3F4F6;
  color: #1F2937;
  border-bottom-left-radius: 0.25rem;
}

.dark .chat-bubble-peer {
  background: #374151;
  color: #E5E7EB;
}

.chat-bubble-system {
  margin: 0 auto;
  max-width: 90%;
  background: transparent;
  color: #9CA3AF;
  font-size: 0.6875rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
}

/* 交付结果气泡 */
.chat-bubble-delivery {
  margin-right: auto;
  max-width: 90%;
  background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
  border: 1px solid #A7F3D0;
  border-radius: 1rem;
  overflow: hidden;
  padding: 0;
}

.dark .chat-bubble-delivery {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.2), rgba(4, 120, 87, 0.15));
  border-color: rgba(5, 150, 105, 0.3);
}

.chat-bubble-delivery .delivery-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #065F46;
  border-bottom: 1px solid #A7F3D0;
}

.dark .chat-bubble-delivery .delivery-header {
  color: #6EE7B7;
  border-bottom-color: rgba(5, 150, 105, 0.3);
}

.chat-bubble-delivery .delivery-content {
  padding: 0.75rem;
  font-size: 0.8125rem;
  color: #1F2937;
  line-height: 1.5;
  white-space: pre-wrap;
}

.dark .chat-bubble-delivery .delivery-content {
  color: #E5E7EB;
}

.chat-bubble-delivery .delivery-images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  padding: 0 0.75rem 0.75rem;
}

.chat-bubble-delivery .delivery-images img {
  width: 100%;
  border-radius: 0.5rem;
  cursor: pointer;
}

/* 技能胶囊标签 */
.skill-capsule {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem 0.25rem 0.5rem;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), rgba(245, 158, 11, 0.12));
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #92400E;
  transition: all 0.2s ease;
}

.dark .skill-capsule {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.15), rgba(245, 158, 11, 0.1));
  border-color: rgba(217, 119, 6, 0.3);
  color: #FCD34D;
}

.skill-capsule-remove {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s ease;
  font-size: 0.875rem;
  line-height: 1;
}

.skill-capsule-remove:hover {
  opacity: 1;
}

/* 角色标识 */
.chat-role-demand {
  background: rgba(217, 119, 6, 0.1);
  color: #D97706;
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.chat-role-worker {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.dark .chat-role-demand {
  background: rgba(217, 119, 6, 0.15);
  color: #F59E0B;
  border-color: rgba(217, 119, 6, 0.3);
}

.dark .chat-role-worker {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.3);
}

/* 技能下拉框项 */
.chat-skill-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.chat-skill-option:hover {
  background: rgba(217, 119, 6, 0.06);
}

.dark .chat-skill-option:hover {
  background: rgba(245, 158, 11, 0.1);
}

.chat-skill-option.selected {
  background: rgba(217, 119, 6, 0.1);
}

/* 加载状态气泡 */
.chat-bubble-loading {
  margin-right: auto;
  display: flex;
  gap: 4px;
  padding: 0.75rem 1rem;
  background: #F3F4F6;
  border-radius: 1rem;
  border-bottom-left-radius: 0.25rem;
}

.dark .chat-bubble-loading {
  background: #374151;
}

.chat-bubble-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9CA3AF;
  animation: loadingDot 1.2s ease-in-out infinite;
}

.chat-bubble-loading span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-bubble-loading span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loadingDot {

  0%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  50% {
    transform: scale(1);
    opacity: 1;
  }
}
