/* =========================================================
   tghao.com front-end styles
   Readable source version - not minified
   ========================================================= */

:root {
  --page-bg: #f5f6f8;
  --panel-bg: #ffffff;
  --text: #303133;
  --text-secondary: #606266;
  --text-muted: #909399;
  --border: #ebeef5;
  --border-strong: #dcdfe6;
  --primary: #409eff;
  --primary-soft: #ecf5ff;
  --success: #67c23a;
  --danger: #f56c6c;
  --warning: #e6a23c;
  --radius: 8px;
  --shadow-hover: 0 7px 24px rgba(31, 45, 61, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

img {
  max-width: 100%;
  border: 0;
  vertical-align: middle;
}

a {
  color: inherit;
  text-decoration: none;
}

a,
button,
input {
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

/* ---------- Top navigation ---------- */
.topbar {
  position: relative;
  z-index: 20;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
}

.nav {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text);
  transition: color 0.18s ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--primary);
}

.pc-label {
  color: var(--text-muted);
}

/* ---------- Common content ---------- */
.content-space {
  padding-top: 24px;
  padding-bottom: 36px;
}

.notice-box,
.side-box,
.filter-box,
.sort-box,
.auth-card,
.detail-box,
.article-box,
.order-card,
.desc-box {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.notice-box {
  padding: 18px 22px;
}

.notice-box h2,
.block-title h2,
.side-box h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
}

.notice-box p {
  margin: 10px 0 0;
  color: var(--text-secondary);
}

.block {
  margin-top: 24px;
}

.block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.block-title a {
  color: var(--text-muted);
}

.block-title a:hover {
  color: var(--primary);
}

/* ---------- Product cards ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.product-card {
  min-width: 0;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  border-color: #d9ecff;
  box-shadow: var(--shadow-hover);
}

.product-image {
  height: 168px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.02);
}

.product-info {
  padding: 13px 14px 14px;
}

.auto-tag {
  display: inline-block;
  margin-bottom: 7px;
  padding: 2px 7px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 4px;
  font-size: 12px;
  line-height: 20px;
}

.product-title {
  min-height: 44px;
  line-height: 22px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-bottom {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stock {
  color: var(--success);
  font-size: 12px;
}

.price {
  color: var(--danger);
  font-size: 19px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Home articles ---------- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.article-card {
  min-width: 0;
  min-height: 108px;
  padding: 17px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.article-card:hover {
  border-color: #d9ecff;
  box-shadow: var(--shadow-hover);
}

.article-card h3 {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 600;
}

.article-meta-small {
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- Home columns ---------- */
.home-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.side-box {
  min-width: 0;
  padding: 18px;
}

.side-box h2 {
  margin-bottom: 10px;
}

.cat-line,
.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #f2f3f5;
}

.cat-line:last-child,
.mini-item:last-child {
  border-bottom: 0;
}

.mini-item:hover span {
  color: var(--primary);
}

.mini-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-item b {
  color: var(--danger);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Product/category list ---------- */
.list-layout {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 18px;
}

.filter-box {
  height: max-content;
  padding: 12px;
}

.filter-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 5px;
  color: var(--text-secondary);
}

.filter-item:hover {
  color: var(--primary);
  background: #f7fbff;
}

.filter-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.sort-box {
  margin-bottom: 14px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.pagination {
  margin: 26px 0 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination a,
.pagination span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--panel-bg);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
}

.pagination a:hover {
  color: var(--primary);
  border-color: #a0cfff;
}

.pagination .active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

/* ---------- Blog list ---------- */
.blog-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.blog-row {
  min-width: 0;
  padding: 17px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.blog-row:hover {
  border-color: #d9ecff;
  box-shadow: var(--shadow-hover);
}

.blog-row h3 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.55;
  font-weight: 600;
}

.blog-row p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- Login/register ---------- */
.auth-wrap {
  padding: 58px 0 72px;
}

.auth-card {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 28px 30px;
}

.auth-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.4;
}

.auth-card > p {
  margin: 5px 0 24px;
  color: var(--text-muted);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 7px;
}

.field input,
.contact {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 5px;
}

.field input:focus,
.contact:focus,
.search-modal input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.12);
}

.primary {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 5px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.18s ease;
}

.primary:hover,
.buy-button:hover {
  opacity: 0.9;
}

.auth-switch {
  margin-top: 18px;
  text-align: center;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--primary);
}

/* ---------- Product detail ---------- */
.detail-wrap {
  padding: 24px 0 36px;
}

.detail-box {
  padding: 24px;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 28px;
}

.detail-image {
  min-height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.detail-image img {
  width: auto;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.detail-main {
  min-width: 0;
}

.detail-main h1 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.45;
}

.detail-main .intro {
  margin: 9px 0;
  color: var(--text-secondary);
}

.big-price {
  margin: 14px 0;
  color: var(--danger);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 600;
}

.detail-row {
  margin: 14px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-row .label {
  width: 78px;
  flex: 0 0 auto;
  color: var(--text-secondary);
}

.qty {
  display: inline-flex;
}

.qty button,
.qty input {
  width: 38px;
  height: 36px;
  border: 1px solid var(--border-strong);
  background: #fff;
  text-align: center;
}

.qty button:first-child {
  border-radius: 5px 0 0 5px;
}

.qty button:last-child {
  border-radius: 0 5px 5px 0;
}

.qty button:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.qty input {
  width: 58px;
  border-left: 0;
  border-right: 0;
  outline: 0;
}

.contact {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border-radius: 5px;
}

.pay-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pay-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.pay-item:hover,
.pay-item.active {
  color: var(--primary);
  border-color: var(--primary);
  background: #f7fbff;
}

.pay-item img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.buy-button {
  width: 100%;
  height: 44px;
  margin-top: 12px;
  border: 0;
  border-radius: 5px;
  color: #fff;
  background: var(--primary);
  transition: opacity 0.18s ease;
}

.desc-box {
  margin-top: 18px;
  padding: 24px;
  line-height: 1.95;
}

.desc-box h2,
.desc-box h3 {
  line-height: 1.5;
}

.desc-box p {
  margin: 0 0 12px;
}

/* ---------- Article detail ---------- */
.article-box {
  padding: 28px;
}

.article-box h1 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.5;
}

.article-meta {
  margin-bottom: 20px;
  padding-bottom: 17px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.article-content {
  font-size: 15px;
  line-height: 2;
  overflow-wrap: anywhere;
}

.article-content h2 {
  margin: 26px 0 10px;
  font-size: 20px;
  line-height: 1.55;
}

.article-content h3 {
  margin: 22px 0 8px;
  font-size: 17px;
}

.article-content p,
.article-content ul,
.article-content ol {
  margin-top: 0;
  margin-bottom: 14px;
}

.article-content a {
  color: var(--primary);
}

.prev-next {
  margin-top: 28px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--border);
}

.prev-next a:hover {
  color: var(--primary);
}

/* ---------- Search overlay ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
}

.search-overlay.open {
  display: flex;
}

.search-modal {
  width: min(720px, calc(100% - 32px));
}

.search-tabs {
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.search-tabs button {
  padding: 7px 15px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
}

.search-tabs button.active {
  background: var(--primary);
  color: #fff;
}

.search-modal input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: 0;
  background: #fff;
  font-size: 18px;
}

.search-hint {
  margin-top: 12px;
  text-align: center;
  color: #fff;
  opacity: 0.8;
}

/* ---------- Order search ---------- */
.order-page {
  min-height: 100vh;
  padding: 36px 16px;
  background: var(--page-bg);
}

.order-shell {
  width: min(760px, 100%);
  margin: auto;
}

.order-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.order-card {
  margin-top: 18px;
  padding: 24px;
}

.order-tabs {
  margin: 18px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.order-tabs button {
  padding: 8px 14px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
}

.order-tabs button:hover,
.order-tabs button.active {
  color: var(--primary);
  border-color: var(--primary);
}

.order-status {
  padding: 26px 0 8px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Footer ---------- */
.footer {
  padding: 25px 0;
  background: var(--panel-bg);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  line-height: 1.8;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-columns {
    grid-template-columns: 1fr;
  }

  .list-layout {
    grid-template-columns: 1fr;
  }

  .filter-box {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .filter-item {
    min-width: max-content;
  }

  .detail-box {
    grid-template-columns: 1fr;
  }

  .detail-image {
    min-height: 300px;
  }

  .nav {
    padding: 10px 0;
  }
}

@media (max-width: 680px) {
  .wrap {
    width: min(100% - 20px, 1180px);
  }

  .nav {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .nav-left,
  .nav-right {
    width: 100%;
    gap: 10px 14px;
  }

  .content-space,
  .detail-wrap {
    padding-top: 14px;
    padding-bottom: 24px;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product-image {
    height: 145px;
  }

  .product-info {
    padding: 11px;
  }

  .price {
    font-size: 17px;
  }

  .article-grid,
  .blog-list {
    grid-template-columns: 1fr;
  }

  .detail-box,
  .article-box,
  .desc-box,
  .order-card {
    padding: 17px;
  }

  .detail-main h1,
  .article-box h1 {
    font-size: 21px;
  }

  .detail-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .detail-row .label {
    width: 100%;
  }

  .contact {
    flex-basis: 100%;
  }

  .prev-next {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .product-grid {
    grid-template-columns: 1fr 1fr;
  }

  .product-image {
    height: 132px;
  }

  .product-title {
    min-height: 42px;
    font-size: 13px;
    line-height: 21px;
  }

  .stock {
    display: none;
  }

  .search-modal input {
    height: 50px;
    font-size: 16px;
  }
}
