/*
Theme Name: Elecdatasheet Shop
Description: Elecdatasheet WooCommerce storefront theme
*/

/* ===== Reset & base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #222;
    background: #f5f6f8;
    line-height: 1.5;
}
a { color: #0b63ce; text-decoration: none; }
a:hover { color: #064a9e; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
button { font: inherit; cursor: pointer; }

/* ===== Topbar: 100% width, 30px height ===== */
.site-topbar {
    width: 100%;
    height: 60px;
    background: #101c2e;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    height: 60px;
    display: flex;
    align-items: center;
    padding-left: 20px;
    padding-right: 24px;
    gap: 0;
}
.brand { display: flex; align-items: center; height: 60px; flex: 0 0 auto; }
.brand img, .custom-logo { max-height: 48px; width: auto; }
.brand-mark {
    width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #10b3f3, #0b63ce);
    color: #fff; font-weight: 800; font-size: 30px;
    border-radius: 8px;
}

/* 菜单：logo 右侧空 20px */
.main-nav { margin-left: 40px; flex: 0 0 auto; height: 60px; }
.nav-list { display: flex; gap: 36px; height: 60px; align-items: center; }
.nav-list a {
    color: #cfd8e3; font-size: 26px; line-height: 60px;
    display: inline-block; height: 60px;
}
.nav-list a:hover, .nav-list .current-menu-item > a, .nav-list .current_page_item > a { color: #fff; }

/* 搜索框：菜单右侧空 20px，胶囊形，最小 80px，可拉伸 */
.searchbox { margin-left: 40px; flex: 1 1 160px; max-width: 720px; min-width: 160px; height: 60px; }
.searchbox form {
    height: 44px; margin-top: 8px;
    display: flex; align-items: center;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
}
.searchbox input[type="search"] {
    flex: 1; border: 0; outline: none;
    height: 44px; line-height: 44px;
    padding: 0 0 0 20px;
    font-size: 24px; min-width: 0; background: transparent;
}
.searchbox .search-go {
    border: 0; background: transparent;
    width: 48px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    color: #0b63ce;
}
.searchbox .icon-search { display: block; }

/* 我的 + 购物车 */
.elec-account { margin-left: 40px; color: #cfd8e3; display: flex; align-items: center; height: 60px; }
.elec-account:hover { color: #fff; }
.elec-cart { margin-left: 20px; color: #cfd8e3; display: flex; align-items: center; height: 60px; position: relative; }
.elec-cart:hover { color: #fff; }
.cart-count {
    position: absolute; top: 2px; right: -14px;
    background: #ff5252; color: #fff;
    font-size: 18px; line-height: 1; padding: 4px 8px;
    border-radius: 14px; font-style: normal;
}

/* ===== 轮播区：topbar 下 5px 间隔，高 500px ===== */
.hero-carousel {
    width: 100%;
    height: 500px;
    margin-top: 5px;
    position: relative;
    overflow: hidden;
    background: #0a1424;
}
.carousel-track { height: 100%; position: relative; }
.slide {
    position: absolute; inset: 0;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;   /* 切换动画 0.5s */
    pointer-events: none;
}
.slide.is-active { opacity: 1; pointer-events: auto; }
.slide img { width: 100%; height: 100%; object-fit: cover; }

.c-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 64px;
    border: 0; background: rgba(0,0,0,.25);
    color: #fff; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
}
.c-arrow:hover { background: rgba(0,0,0,.45); }
.c-prev { left: 0; border-radius: 0 6px 6px 0; }
.c-next { right: 0; border-radius: 6px 0 0 6px; }

.c-dots {
    position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 8px;
}
.c-dot {
    width: 10px; height: 10px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,.8);
    background: rgba(255,255,255,.35);
    padding: 0;
}
.c-dot.is-active { background: #fff; }

/* ===== 热门商品：轮播下 5px ===== */
.hot-products { margin-top: 5px; padding: 18px 16px 30px; background: #f5f6f8; }
.hp-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.hp-head h2 { font-size: 20px; color: #14202f; }
.hp-more { font-size: 13px; }

/* 商品网格：PC 5 列 / 平板 3 列 / 手机 2 列 */
.hp-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}

/* 商品卡片 */
.p-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(16,28,46,.08);
    transition: box-shadow .2s, transform .2s;
    display: flex; flex-direction: column;
}
.p-card:hover { box-shadow: 0 6px 18px rgba(16,28,46,.16); transform: translateY(-2px); }
.card-media { position: relative; display: block; background: #fafafa; }
.card-media img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.card-badge {
    position: absolute; top: 8px; left: 8px;
    background: #ff5252; color: #fff;
    font-size: 11px; padding: 2px 8px; border-radius: 3px;
}
.card-badge.out { background: #888; }
.card-body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title {
    font-size: 13px; color: #222; font-weight: 600;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; min-height: 38px; line-height: 19px;
}
.card-title:hover { color: #0b63ce; }
.card-price { color: #d0021b; font-weight: 700; font-size: 15px; }
.card-price del { color: #999; font-weight: 400; font-size: 12px; margin-right: 4px; }
.card-price ins { text-decoration: none; }
.card-rating .star-rating { float: none; display: inline-block; font-size: 11px; }
.card-btn {
    margin-top: auto;
    text-align: center;
    background: #0b63ce; color: #fff !important;
    border-radius: 4px; padding: 6px 10px;
    font-size: 13px;
    transition: background .2s;
}
.card-btn:hover { background: #084c9f; color: #fff; }
.card-btn.alt { background: #6b7787; }
.card-btn.alt:hover { background: #525d6b; }

/* ===== 分类页（左分类/右商品）===== */
.shop-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 18px;
    padding: 18px 16px 40px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.shop-side .side-block { background: #fff; border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(16,28,46,.08); }
.side-block h3 { font-size: 15px; margin-bottom: 10px; color: #14202f; border-left: 3px solid #0b63ce; padding-left: 8px; }
.cat-list li { line-height: 30px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.cat-list a { flex: 1; }
.cat-list .is-current > a { color: #0b63ce; font-weight: 700; }
.cat-n { color: #999; font-size: 12px; }
.side-search { display: flex; background: #f1f3f6; border-radius: 16px; overflow: hidden; height: 30px; }
.side-search input { flex: 1; border: 0; background: transparent; padding: 0 12px; outline: none; font-size: 12px; min-width: 0; }
.side-search button { border: 0; background: transparent; width: 30px; color: #0b63ce; }

.shop-toolbar { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 8px 8px 0 0; padding: 12px 16px; box-shadow: 0 1px 3px rgba(16,28,46,.08); flex-wrap: wrap; gap: 8px; }
.shop-title { font-size: 18px; color: #14202f; }
.order-form { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #666; }
.order-form select { border: 1px solid #dfe3e8; border-radius: 4px; padding: 4px 6px; font-size: 12px; background: #fff; }
.shop-grid { padding: 14px; background: #fff; border-radius: 0 0 8px 8px; box-shadow: 0 1px 3px rgba(16,28,46,.08); margin-top: 0; }
.shop-grid .p-card { box-shadow: 0 1px 2px rgba(16,28,46,.06); border: 1px solid #eef0f3; }
.shop-grid .p-card:hover { box-shadow: 0 6px 18px rgba(16,28,46,.14); }
.no-results { padding: 40px; text-align: center; color: #888; grid-column: 1 / -1; }
.shop-pagination { padding: 16px 0 6px; text-align: center; font-size: 13px; }
.shop-pagination .page-numbers { display: inline-block; padding: 5px 10px; margin: 0 2px; background: #fff; border-radius: 4px; border: 1px solid #e3e6ea; color: #444; }
.shop-pagination .page-numbers.current { background: #0b63ce; color: #fff; border-color: #0b63ce; }
.shop-pagination a.page-numbers:hover { border-color: #0b63ce; color: #0b63ce; }

/* ===== 商品详情 ===== */
.pd-wrap { padding: 18px 16px 40px; max-width: 1200px; margin: 0 auto; }
.breadcrumb { font-size: 12px; color: #888; margin-bottom: 12px; }
.pd-grid { display: grid; grid-template-columns: minmax(280px, 480px) 1fr; gap: 26px; background: #fff; border-radius: 10px; padding: 22px; box-shadow: 0 1px 3px rgba(16,28,46,.08); }

/* Main image */
.pd-main-image { width: 100%; border-radius: 6px; border: 1px solid #eef0f3; cursor: zoom-in; transition: opacity .15s; }

/* Gallery thumbnails: 4-column grid, multi-row */
.pd-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.pd-thumb {
    border-radius: 6px;
    border: 2px solid #eef0f3;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s, transform .15s;
    aspect-ratio: 1 / 1;
}
.pd-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumb:hover { border-color: #0b63ce; transform: translateY(-1px); }
.pd-thumb.is-active { border-color: #0b63ce; }

/* Video player */
.pd-video { margin-top: 12px; }
.pd-video video { width: 50%; border-radius: 6px; border: 1px solid #eef0f3; background: #000; display: block; max-height: 240px; }
.pd-title { font-size: 22px; margin-bottom: 10px; color: #14202f; }
.pd-price { font-size: 24px; color: #d0021b; font-weight: 700; margin-bottom: 10px; }
.pd-price del { color: #999; font-size: 15px; font-weight: 400; }
.pd-price ins { text-decoration: none; }
.pd-stock { font-size: 13px; margin-bottom: 14px; }
.pd-stock.ok { color: #1e8e3e; }
.pd-stock.out { color: #d0021b; }
.pd-actions { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.button { display: inline-block; background: #0b63ce; color: #fff; border-radius: 4px; padding: 9px 22px; font-size: 14px; border: 0; }
.button:hover { background: #084c9f; color: #fff; }
.button.alt { background: #d0021b; }
.button.alt:hover { background: #a80117; }
.pd-meta { font-size: 12px; color: #777; display: flex; flex-direction: column; gap: 4px; }
.pd-desc { background: #fff; border-radius: 10px; padding: 22px; margin-top: 18px; box-shadow: 0 1px 3px rgba(16,28,46,.08); }
.pd-desc h2, .pd-related h2 { font-size: 17px; margin-bottom: 12px; color: #14202f; }
.pd-desc-body { font-size: 14px; color: #444; }
.pd-desc-body p { margin-bottom: 10px; }
.pd-related { margin-top: 18px; }
.pd-related .hp-grid { grid-template-columns: repeat(5, 1fr); }

/* ===== 普通页面 / 文章 ===== */
.page-wrap { max-width: 900px; margin: 0 auto; padding: 30px 16px 50px; }
.page-article { background: #fff; border-radius: 10px; padding: 30px 34px; box-shadow: 0 1px 3px rgba(16,28,46,.08); }
.page-title { font-size: 24px; margin-bottom: 16px; color: #14202f; }
.page-content { font-size: 14px; color: #333; }
.page-content p { margin-bottom: 12px; }
.page-content h2 { font-size: 18px; margin: 18px 0 10px; }
.post-list article { background: #fff; border-radius: 8px; padding: 18px 22px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(16,28,46,.08); }
.post-list h2 { font-size: 17px; margin-bottom: 6px; }
.entry-meta { font-size: 12px; color: #999; margin-bottom: 8px; }

/* ===== 页脚 ===== */
.site-footer { background: #101c2e; color: #aab6c5; margin-top: 30px; }
.footer-inner {
    max-width: 1200px; margin: 0 auto;
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 24px; padding: 34px 16px 20px;
}
.footer-inner h4 { color: #fff; font-size: 14px; margin-bottom: 10px; }
.footer-inner p { font-size: 13px; line-height: 1.8; }
.f-col ul li { line-height: 28px; font-size: 13px; }
.f-col a { color: #aab6c5; }
.f-col a:hover { color: #fff; }
.footer-copy { border-top: 1px solid #1d2c42; text-align: center; padding: 14px; font-size: 12px; color: #8a97a8; }

/* WooCommerce 默认内容页（cart/checkout/account） */
.woocommerce-notices-wrapper .woocommerce-message,
.woocommerce-info, .woocommerce-error { list-style: none; }
.site-main { min-height: 200px; }

/* ===== 相册灯箱（点击放大查看） ===== */
#elec-lightbox {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(10, 20, 36, .92);
    display: none;
    align-items: center; justify-content: center;
}
#elec-lightbox.is-open { display: flex; }
#elec-lightbox .elb-img {
    max-width: 94vw; max-height: 92vh;
    width: auto; height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
    cursor: default;
}
#elec-lightbox .elb-close,
#elec-lightbox .elb-prev,
#elec-lightbox .elb-next {
    position: absolute;
    border: 0; background: rgba(255,255,255,.12);
    color: #fff; font-size: 26px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
#elec-lightbox .elb-close:hover,
#elec-lightbox .elb-prev:hover,
#elec-lightbox .elb-next:hover { background: rgba(255,255,255,.3); }
#elec-lightbox .elb-close { top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; }
#elec-lightbox .elb-prev { left: 12px; top: 50%; transform: translateY(-50%); width: 46px; height: 64px; border-radius: 6px; font-size: 34px; }
#elec-lightbox .elb-next { right: 12px; top: 50%; transform: translateY(-50%); width: 46px; height: 64px; border-radius: 6px; font-size: 34px; }
#elec-lightbox .elb-count {
    position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,.85); font-size: 13px;
    background: rgba(0,0,0,.35); padding: 4px 12px; border-radius: 12px;
}

/* ===== 响应式 ===== */
/* 平板：≤1024px，3 列 */
@media (max-width: 1024px) {
    .hp-grid { grid-template-columns: repeat(3, 1fr); }
    .pd-related .hp-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-inner { grid-template-columns: repeat(2, 1fr); }
}

/* 手机：≤600px，2 列 */
@media (max-width: 600px) {
    .hp-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .pd-related .hp-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .shop-layout { grid-template-columns: 1fr; }
    .shop-side { order: 0; }
    .pd-grid { grid-template-columns: 1fr; }
    .nav-list { gap: 24px; }
    .searchbox { max-width: none; }
    .card-title { min-height: 34px; }
}

/* 平板横屏以下隐藏文字菜单改为横滚 */
@media (max-width: 480px) {
    .topbar-inner { padding-right: 12px; }
    .main-nav { margin-left: 20px; overflow-x: auto; max-width: 40vw; scrollbar-width: none; }
    .main-nav::-webkit-scrollbar { display: none; }
    .searchbox { min-width: 120px; }
    .nav-list { gap: 20px; }
    .nav-list a { font-size: 24px; }
}
