/**
 * OpenStore 组件样式
 */

/* 应用卡片 */
.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.app-card:hover {
  border-color: var(--border-color-hover);
  box-shadow: var(--glow-card);
  transform: translateY(-2px);
}

.app-card-logo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-tertiary);
}

.app-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.app-card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.app-card-rating {
  color: var(--accent-primary);
}

.app-card-downloads {
  color: var(--text-secondary);
}

.app-card-new {
  color: var(--accent-primary);
  font-weight: 500;
}

.app-card-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.app-card-category-tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 212, 255, 0.15);
  color: var(--accent-primary);
}

/* 发行主体区域 - 参考 Apple App Store / Google Play 布局 */
.store-publishers-section {
  margin-top: 32px;
}

.store-publishers-section .store-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* 多发行主体：响应式网格，单主体时全宽 */
.store-publishers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.store-publishers-section--single .store-publishers-grid {
  grid-template-columns: 1fr;
}

.store-publisher-card {
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
}

.store-publisher-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0;
}

.store-publisher-applicable {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* 联系信息：客服邮箱单列首行，官网/技术支持另起一行 */
.store-publisher-contact {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.store-publisher-email-row {
  display: block;
}

.store-publisher-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.store-publisher-contact .store-agreement-link {
  font-size: 0.9rem;
}

/* 客服邮箱：只读展示，非链接，便于复制 */
.store-publisher-email {
  font-size: 0.9rem;
  color: var(--text-secondary);
  user-select: text;
  cursor: default;
}

.store-publisher-email-label {
  color: var(--text-secondary);
}

.store-publisher-email-value {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  color: var(--text-primary);
  word-break: break-all;
}

.store-publisher-email-copy {
  margin-left: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--accent-primary);
  background: transparent;
  border: 1px solid var(--accent-primary);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.store-publisher-email-copy:hover {
  background: rgba(0, 212, 255, 0.1);
}

.store-publisher-email-copy:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.store-publisher-email-copy.copied {
  color: var(--success-color, #22c55e);
  border-color: var(--success-color, #22c55e);
}

.store-publisher-legal {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 4px;
}

.store-agreement-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.store-agreement-link:hover {
  text-decoration: underline;
}

.store-agreement-link:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.store-agreement-separator {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  user-select: none;
  flex-shrink: 0;
}

/* 移动端：链接换行时隐藏多余分隔符，改用垂直堆叠 */
@media (max-width: 480px) {
  .store-publisher-legal {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .store-agreement-separator {
    display: none;
  }
}

/* 应用网格 */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* 分类列表 */
.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.category-link {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.category-link:hover,
.category-link.active {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* 分类横向滚动（移动端） */
@media (max-width: 768px) {
  .category-list--scroll {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .category-list--scroll::-webkit-scrollbar {
    height: 6px;
  }
}

/* 筛选栏 */
.browse-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 16px;
  align-items: center;
}

.browse-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.browse-filter-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.filter-pill:hover,
.filter-pill.active {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.browse-result-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.infinite-sentinel {
  height: 1px;
  visibility: hidden;
  pointer-events: none;
}

.loading-more {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* 平台下载区域 */
.store-download-section {
  margin-top: 16px;
}

.store-download-empty {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.store-platform-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.store-platform-tab {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.store-platform-tab:hover,
.store-platform-tab.active {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.store-download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.store-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
}

.store-dl-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

/* 骨架占位 - 鱼骨图效果 */
.store-skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    rgba(255, 255, 255, 0.04) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: store-skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes store-skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.store-img-wrap {
  position: relative;
  overflow: hidden;
}

.store-img-wrap .store-skeleton {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.store-img-wrap img {
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.25s ease-in;
}

.store-img-wrap.store-img-loaded img {
  opacity: 1;
}

.store-img-wrap.store-img-loaded .store-skeleton {
  display: none;
}

/* 应用详情截图展示 */
.store-screenshots-section {
  width: 100%;
}

.store-screenshots-device-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.store-screenshots-device-tab {
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.store-screenshots-device-tab:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.08);
}

.store-screenshots-device-tab.active {
  background: rgba(0, 212, 255, 0.18);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.15);
}

.store-screenshots-device-tab:active {
  transform: scale(0.96);
  background: rgba(0, 212, 255, 0.25);
}

.store-screenshots-gallery {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.store-screenshot-btn {
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.store-screenshot-wrap {
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.store-screenshot-wrap-phone {
  width: 180px;
  height: 320px;
}

.store-screenshot-wrap-desktop {
  width: 320px;
  height: 200px;
}

.store-screenshot-img {
  flex-shrink: 0;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  scroll-snap-align: start;
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.store-screenshot-img-phone {
  height: 320px;
  max-width: 200px;
}

.store-screenshot-img-desktop {
  height: 200px;
  max-width: 360px;
}

.store-screenshot-img:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

/* 截图预览 Lightbox */
.screenshot-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.screenshot-lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.screenshot-lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  user-select: none;
}

.screenshot-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 28px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.screenshot-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.screenshot-lightbox-prev,
.screenshot-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.screenshot-lightbox-prev {
  left: 16px;
}

.screenshot-lightbox-next {
  right: 16px;
}

.screenshot-lightbox-prev:hover,
.screenshot-lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
}

.screenshot-lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-radius: var(--radius-md);
}
