/* ================================================================
   赢生服务市场 - 响应式适配样式
   ================================================================ */

/* ---------- Tailwind xs breakpoint polyfill ---------- */
@media (min-width: 480px) {
  .xs\:inline { display: inline !important; }
  .xs\:hidden { display: none !important; }
  .xs\:inline-flex { display: inline-flex !important; }
}
@media (max-width: 479px) {
  .xs\:inline { display: none !important; }
  .xs\:hidden { display: inline !important; }
  .xs\:inline-flex { display: none !important; }
}

/* ---------- 移动端导航 ---------- */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 60;
  backdrop-filter: blur(2px);
}
.mobile-nav-overlay.open { display: block; }

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  background: #fff;
  z-index: 70;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  box-shadow: 4px 0 16px rgba(0,0,0,0.1);
}
.mobile-nav-drawer.open { transform: translateX(0); }

.mobile-nav-drawer .drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
}
.mobile-nav-drawer .drawer-header .brand {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #2563eb, #c026d3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.mobile-nav-drawer .drawer-close {
  padding: 4px;
  color: #9ca3af;
  background: none;
  border: none;
  cursor: pointer;
}
.mobile-nav-drawer .drawer-close:hover { color: #374151; }

.mobile-nav-drawer .nav-section { padding: 12px 0; }
.mobile-nav-drawer .nav-section .section-title {
  padding: 4px 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}
.mobile-nav-drawer .nav-link {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  font-size: 0.9rem;
  color: #374151;
  text-decoration: none;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.mobile-nav-drawer .nav-link:hover,
.mobile-nav-drawer .nav-link.active {
  background: #eff6ff;
  border-left-color: #2563eb;
  color: #2563eb;
}
.mobile-nav-drawer .nav-link svg {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  flex-shrink: 0;
}

/* ---------- 关键词域名输入行 ---------- */
@media (max-width: 640px) {
  .domain-row {
    flex-direction: column;
    align-items: stretch !important;
  }
  .domain-row .domain-input {
    width: 100% !important;
  }
  .domain-row label {
    margin-top: 4px;
    margin-left: 0 !important;
  }
  .domain-row .remove-domain {
    position: absolute;
    top: 4px;
    right: 4px;
  }
  .domain-row { position: relative; }
}

/* ---------- 多视图 tabs 横向滚动 ---------- */
.view-tabs-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  white-space: nowrap;
  display: flex;
  flex-wrap: nowrap;
}
.view-tabs-scroll::-webkit-scrollbar { display: none; }
.view-tabs-scroll .view-tab {
  flex-shrink: 0;
}

/* ---------- 统计概览卡片 ---------- */
@media (max-width: 640px) {
  #statsOverview {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  #statsOverview > div {
    padding: 10px !important;
  }
  #statsOverview .text-2xl { font-size: 1.25rem !important; }
}

/* ---------- 跟踪任务卡片按钮 ---------- */
@media (max-width: 768px) {
  .task-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    margin-left: 0 !important;
  }
  .task-card-actions a,
  .task-card-actions button {
    font-size: 0.75rem !important;
    padding: 4px 10px !important;
  }
}

/* ---------- header 用户操作按钮 ---------- */
@media (max-width: 640px) {
  header .flex.items-center {
    gap: 2px;
  }
}

/* ---------- 充值页面金额按钮 ---------- */
@media (max-width: 640px) {
  .recharge-amount-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
}

/* ---------- 跟踪详情页 ---------- */
@media (max-width: 1024px) {
  .detail-sidebar { order: 2; }
  .detail-main { order: 1; }
}

/* ---------- 首页 Hero ---------- */
@media (min-width: 640px) {
  .hero-badge-group {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
  }
}
@media (max-width: 639px) {
  .hero-badge-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
}

/* ---------- 通用移动端调优 ---------- */
@media (max-width: 640px) {
  .hero-title { font-size: 1.75rem !important; }
  .hero-desc { font-size: 1rem !important; }
  .section-title { font-size: 1.5rem !important; }

  /* 表格工具栏按钮缩小 */
  .ys-table-toolbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
  }
  .ys-table-toolbar .ys-toolbar-left,
  .ys-table-toolbar .ys-toolbar-right {
    justify-content: center;
  }
  .ys-table-toolbar .ys-search-input {
    width: 100% !important;
  }
  button.ys-btn {
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
  }

  /* 排名摘要卡片 */
  #rankingSummary {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  #rankingSummary > div { padding: 10px !important; }
  #rankingSummary .text-2xl { font-size: 1.25rem !important; }

  /* 面包屑导航优化 */
  .breadcrumb-nav { font-size: 0.75rem !important; }

  /* 工具描述区 */
  article .text-lg { font-size: 0.95rem !important; }
  article .text-3xl { font-size: 1.5rem !important; }

  /* 弹窗在移动端全屏 */
  .modal-content {
    max-width: 100% !important;
    margin: 0 8px !important;
  }

  /* 首页按钮堆叠 */
  .hero-btns {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .hero-btns a {
    width: 100%;
    max-width: 260px;
    text-align: center;
  }
}

/* ---------- Tabulator 表格在窄屏上横向滚动 ---------- */
.tabulator {
  max-width: 100%;
}
.tabulator .tabulator-tableholder {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}
.tabulator .tabulator-tableholder .tabulator-table {
  min-width: 700px;
}

/* ---------- 文章内容移动端优化 ---------- */
@media (max-width: 640px) {
  .prose h2 { font-size: 1.25rem !important; }
  .prose h3 { font-size: 1.1rem !important; }
  .prose { font-size: 0.9rem !important; }
  .prose pre { font-size: 0.75rem !important; }
  .prose code { font-size: 0.75rem !important; word-break: break-all; }
}

/* ---------- 首页工具卡片 ---------- */
@media (max-width: 640px) {
  .tool-card-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ---------- 跟踪详情页 - 图表容器移动端 ---------- */
@media (max-width: 640px) {
  .chart-container {
    height: 280px !important;
  }
}

/* ---------- 分页控件 ---------- */
.pagination-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---------- 跟踪创建表单 ---------- */
@media (max-width: 640px) {
  #createTaskForm .grid-cols-1.md\:grid-cols-3 > div {
    min-width: 0;
  }
  #createTaskForm .p-4.bg-gray-50.rounded-xl {
    flex-direction: column;
    gap: 12px;
  }
  #createTaskForm .p-4.bg-gray-50.rounded-xl button {
    width: 100%;
  }
}
