/*
Theme Name: 互选学习网
Description: 互选学习网 1-9年级教辅产品展示主题(响应式, 适配手机)
Version: 2.1.0
*/

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f6f8; color: #1a1a1a; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== 顶部导航 ===== */
.topbar { background: #1f2937; color: #9ca3af; font-size: 12px; padding: 6px 0; }
.topbar .container { display: flex; justify-content: space-between; }
.topbar a { color: #9ca3af; margin-left: 14px; }
.topbar a:hover { color: #fff; }
.header { background: #fff; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.header .container { display: flex; align-items: center; height: 66px; gap: 28px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: #111; }
.logo img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.logo b { color: #667eea; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 8px 14px; border-radius: 8px; color: #4b5563; font-size: 15px; font-weight: 500; }
.nav a:hover, .nav a.current-menu-item { background: #eef2ff; color: #667eea; }
.header .actions { display: flex; gap: 10px; align-items: center; }
.btn { display: inline-block; padding: 9px 20px; border-radius: 10px; border: none; font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; }
.btn-primary { background: #667eea; color: #fff; } .btn-primary:hover { background: #5a6fd6; }
.btn-outline { background: #fff; color: #667eea; border: 1.5px solid #667eea; }
.btn-white { background: #fff; color: #764ba2; }
.btn-ghost { background: rgba(255,255,255,.15); color: #fff; border: 1.5px solid rgba(255,255,255,.5); }
.menu-toggle { display: none; background: none; border: none; font-size: 26px; cursor: pointer; color: #333; }

/* ===== 横幅 ===== */
.banner { background: linear-gradient(120deg, #667eea 0%, #764ba2 60%, #a855f7 100%); color: #fff; overflow: hidden; position: relative; }
.banner .container { display: flex; align-items: center; gap: 50px; padding: 64px 20px; position: relative; z-index: 2; }
.banner h1 { font-size: 38px; line-height: 1.3; margin-bottom: 14px; font-weight: 800; }
.banner p { font-size: 17px; opacity: .92; margin-bottom: 26px; max-width: 520px; }
.banner .btns { display: flex; gap: 12px; flex-wrap: wrap; }
.banner .cover { display: flex; gap: 14px; flex-shrink: 0; }
.banner .cover img { width: 160px; height: 160px; border-radius: 14px; object-fit: cover; box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.banner .cover img:nth-child(2) { transform: translateY(20px); }
.banner::after { content:''; position: absolute; right: -80px; top: -80px; width: 340px; height: 340px; border-radius: 50%; background: rgba(255,255,255,.08); }

/* ===== 品牌专区 ===== */
.section { padding: 44px 0; }
.section-title { font-size: 26px; font-weight: 800; text-align: center; margin-bottom: 8px; }
.section-sub { text-align: center; color: #6b7280; font-size: 14px; margin-bottom: 30px; }
.brand-zone { border-radius: 16px; padding: 26px; margin-bottom: 24px; }
.brand-zone.peiyou { background: linear-gradient(135deg, #fdf2f8, #fce7f3); }
.brand-zone.dzt { background: linear-gradient(135deg, #eff6ff, #e0f2fe); }
.brand-zone.zhihui { background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.brand-zone .zh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.brand-zone .zh h3 { font-size: 22px; font-weight: 800; }
.brand-zone .zh p { color: #6b7280; font-size: 13px; }
.brand-zone .zh .more { font-size: 13px; color: #667eea; font-weight: 600; }
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.zcard { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.07); transition: transform .2s; }
.zcard:hover { transform: translateY(-4px); }
.zcard img { width: 100% !important; height: auto !important; aspect-ratio: 1/1 !important; object-fit: cover !important; object-position: center !important; display: block !important; }
.zcard .zn { padding: 8px 10px; font-size: 13px; font-weight: 600; text-align: center; }

/* ===== 产品网格 ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; justify-items: stretch; }
/* 产品卡片: 正方形排列 */
.card { display: flex; flex-direction: column; }
.card .img, .card img.img, .card a > img { width: 100% !important; height: auto !important; aspect-ratio: 1 / 1 !important; object-fit: cover !important; object-position: center !important; display: block !important; }
.card .info { display: flex; flex-direction: column; }
.card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.06); transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-5px); box-shadow: 0 12px 28px rgba(0,0,0,.12); }
.card .img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.card .info { padding: 12px 14px; }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.card .tags span { font-size: 11px; padding: 2px 10px; border-radius: 10px; background: #f3f4f6; color: #6b7280; }
.card .tags .b-peiyou { background: #fdf2f8; color: #be185d; }
.card .tags .b-dzt { background: #eff6ff; color: #1d4ed8; }
.card .tags .b-zhihui { background: #ecfdf5; color: #047857; }
.card .name { font-size: 14px; font-weight: 600; margin-bottom: 8px; line-height: 1.45; color: #1e293b; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.card .tags { margin-bottom: 8px; }
.card .tags span { font-size: 11px; padding: 3px 10px; border-radius: 10px; letter-spacing: .3px; }
.card .price { font-size: 17px; margin-top: auto; }
.card .price small { font-size: 12px; }
.card .price { color: #e65100; font-weight: 700; font-size: 16px; }
.card .price small { color: #9ca3af; font-weight: 400; font-size: 12px; text-decoration: line-through; margin-left: 6px; }
.empty-tip { text-align: center; color: #9ca3af; padding: 60px 0; }

/* ===== 产品详情 ===== */
.crumb { max-width: 1200px; margin: 16px auto 0; padding: 0 20px; font-size: 13px; color: #9ca3af; }
.crumb b { color: #667eea; }
.detail-main { max-width: 1200px; margin: 20px auto 0; padding: 0 20px; display: grid; grid-template-columns: 460px 1fr; gap: 36px; }
.gallery .bigbox { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.gallery .big { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
.gallery .thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery .thumbs img { width: 68px; height: 68px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2.5px solid transparent; }
.gallery .thumbs img.on { border-color: #667eea; }
.dinfo { background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 2px 12px rgba(0,0,0,.06); height: fit-content; }
.dinfo .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.dinfo .tags span { font-size: 12px; padding: 3px 12px; border-radius: 12px; background: #eef2ff; color: #667eea; font-weight: 600; }
.dinfo h1 { font-size: 25px; margin-bottom: 10px; }
.dinfo .sub { color: #6b7280; font-size: 14px; margin-bottom: 16px; line-height: 1.8; }
.dinfo .price-row { display: flex; align-items: baseline; gap: 12px; padding: 16px 0; border-top: 1px dashed #e5e7eb; border-bottom: 1px dashed #e5e7eb; margin-bottom: 18px; }
.dinfo .price { font-size: 28px; font-weight: 800; color: #e65100; }
.dinfo .price small { font-size: 14px; color: #9ca3af; font-weight: 400; text-decoration: line-through; margin-left: 8px; }
.dinfo .sku-t { font-size: 13px; color: #6b7280; margin-bottom: 8px; }
.dinfo .sku { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.dinfo .sku span { padding: 8px 18px; border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 14px; cursor: pointer; }
.dinfo .sku span.on { border-color: #667eea; color: #667eea; background: #eef2ff; font-weight: 600; }
.dinfo .feat { list-style: none; margin-bottom: 22px; }
.dinfo .feat li { padding: 8px 0; border-bottom: 1px dashed #e5e7eb; font-size: 14px; color: #4b5563; }
.dinfo .btns { display: flex; gap: 12px; }
.dinfo .btns .btn { flex: 1; }
.detail-section { max-width: 1200px; margin: 36px auto 60px; padding: 0 20px; }
.detail-section h2 { font-size: 20px; margin-bottom: 16px; padding-left: 12px; border-left: 4px solid #667eea; }
.detail-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.detail-imgs .di { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.06); cursor: zoom-in; }
.detail-imgs .di img { width: 100%; display: block; }

/* ===== 页面(关于/联系等) ===== */
.page-main { max-width: 900px; margin: 30px auto 60px; padding: 0 20px; }
.page-main h1 { font-size: 28px; margin-bottom: 20px; }
.page-box { background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.page-box h2, .page-box h3 { margin: 18px 0 10px; }
.page-box p { margin-bottom: 12px; color: #374151; font-size: 15px; }
.page-box ul { padding-left: 22px; margin-bottom: 12px; }
.page-box li { margin-bottom: 6px; color: #374151; }

/* ===== 页脚 ===== */
.footer { background: #1f2937; color: #9ca3af; padding: 44px 0 20px; margin-top: 20px; }
.footer .grid { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; }
.footer h4 { color: #fff; font-size: 15px; margin-bottom: 12px; }
.footer a { display: block; color: #9ca3af; font-size: 13px; margin-bottom: 8px; }
.footer a:hover { color: #fff; }
.footer p { font-size: 13px; line-height: 1.8; }
.footer .bottom { max-width: 1200px; margin: 26px auto 0; padding: 16px 20px 0; border-top: 1px solid #374151; text-align: center; font-size: 12px; }

/* ===== 图片查看 ===== */
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.93); display: none; align-items: center; justify-content: center; z-index: 9999; }
.viewer.open { display: flex; }
.viewer img { max-width: 92vw; max-height: 88vh; border-radius: 8px; }
.viewer .close { position: absolute; top: 20px; right: 20px; background: rgba(255,255,255,.2); color: #fff; border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 20px; cursor: pointer; }

/* ===== 响应式(手机自适应) ===== */
@media (max-width: 900px) {
    .banner .container { flex-direction: column; text-align: center; padding: 44px 20px; gap: 30px; }
    .banner .cover { display: none; }
    .detail-main { grid-template-columns: 1fr; }
    .footer .grid { grid-template-columns: 1fr 1fr; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .zone-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .menu-toggle { display: block; }
    .nav { display: none; position: absolute; top: 66px; left: 0; right: 0; background: #fff; flex-direction: column; padding: 10px 20px 16px; box-shadow: 0 8px 20px rgba(0,0,0,.1); }
    .nav.open { display: flex; }
    .nav a { padding: 12px 10px; border-bottom: 1px solid #f3f4f6; }
    .header .actions .hide-m { display: none; }
}
@media (max-width: 480px) {
    .container { padding: 0 14px; }
    .banner h1 { font-size: 28px; }
    .section { padding: 30px 0; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .card .info { padding: 10px; }
    .brand-zone { padding: 18px; }
    .detail-imgs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .dinfo { padding: 20px; }
    .topbar { display: none; }
}


/* ===== 点击展开(全端) ===== */
.nav li.open > ul.sub-menu { display: block; }
/* ===== 搜索框 ===== */
.hx-search { display: flex; align-items: center; background: #f1f5f9; border-radius: 20px; padding: 2px 4px 2px 14px; border: 1px solid #e2e8f0; }
.hx-search input { border: none; background: transparent; outline: none; font-size: 13px; width: 150px; color: #334155; }
.hx-search button { border: none; background: #667eea; color: #fff; border-radius: 18px; width: 30px; height: 30px; cursor: pointer; font-size: 14px; flex-shrink: 0; }
.hx-search button:hover { background: #5a6fd6; }
.hx-search-m { display: none; }
@media (max-width: 900px) {
    .hx-search-d { display: none; }
    .hx-search-m { display: flex; margin: 4px 0 10px; }
    .hx-search-m input { width: 100%; }
    .hx-search-m { background: #f1f5f9; border-radius: 20px; padding: 2px 4px 2px 14px; border: 1px solid #e2e8f0; }
}
/* ===== 导航下拉菜单 ===== */
.nav li { list-style: none; position: relative; margin: 0; }
.nav li > a { display: block; }
.nav ul.sub-menu { display: none; position: absolute; top: 100%; left: 0; background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.12); min-width: 152px; padding: 6px; margin: 4px 0 0; z-index: 999; }
.nav ul.sub-menu li { display: block; }
.nav ul.sub-menu a { padding: 9px 14px; border-radius: 6px; color: #334155; font-size: 14px; white-space: nowrap; border: none; }
.nav ul.sub-menu a:hover { background: #eef2ff; color: #4338ca; }
.nav li:hover > ul.sub-menu { display: block; }

/* ===== 学习资讯列表 ===== */
.news-list { display: flex; flex-direction: column; gap: 14px; }
.news-item { display: flex; gap: 16px; align-items: flex-start; background: #fff; border: 1px solid #eef2f7; border-radius: 12px; padding: 14px 18px; text-decoration: none; color: #1e293b; transition: .15s; }
.news-item:hover { box-shadow: 0 6px 18px rgba(102,126,234,.14); transform: translateY(-1px); }
.news-item img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.news-title { font-size: 16px; font-weight: 600; color: #1e293b; }
.news-date { color: #94a3b8; font-size: 12px; margin: 2px 0 6px; }
.news-ex { color: #64748b; font-size: 13px; line-height: 1.6; }
.news-content { line-height: 1.9; }
.news-content img { max-width: 100%; height: auto; }
.page-main h1 { margin-bottom: 6px; }
@media (max-width: 900px) {
    .nav ul.sub-menu { position: static; display: none; box-shadow: none; padding: 0 0 0 16px; background: transparent; }
    .nav li.open > ul.sub-menu { display: block; }
    .nav li { border-bottom: 1px solid #f1f5f9; }
    .news-item { flex-direction: row; }
    .news-item img { width: 64px; height: 64px; }
}
