/* ================================================================
   common.css —— 找工品 zhaogongpin.com 全站公共样式
   所有页面必须引入，页面独有样式放各自的 xxx.css
================================================================ */

/* ===== 全局变量（以产品详情页为准，含提示框系列变量） ===== */
:root {
    --main: #44729C;
    --hover: #355c7d;
    --text-dark: #2d3748;
    --text-gray: #718096;
    --text-light: #a0aec0;
    --border: #e2e8f0;
    --bg-gray: #f7fafc;
    --price: #d62828;
    --white: #fff;

    /* 提示框 / 联系方式专属变量 */
    --tip-bg: #fffbf0;
    --tip-border-left: #ff9c41;
    --tip-dash: #e2d9c8;
    --wechat-bg: #e8f5e9;
    --wechat-color: #2da44e;
    --mail-color: #1976d2;
    --price-bg: #fef2f2;
}

/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: "Segoe UI", Roboto, "Microsoft Yahei", sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background: var(--white);
}
ul {
    list-style: none;
}
a {
    text-decoration: none;
    color: inherit;
}
.wp {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 头部 ===== */
.header {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}
.header .wp {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 40px;
}
.logo {
    flex-shrink: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--main);
}
.logo span {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-gray);
    margin-left: 8px;
}

/* ===== 搜索框 ===== */
.search-box {
    position: relative;
    margin-left: auto;
    flex: 0 1 500px;
    height: 40px;
    display: flex;
}
#search {
    width: 100%;
}

/* ===== 主体布局 ===== */
.container {
    display: flex;
    min-height: calc(100vh - 130px);
    max-width: 1920px;
    margin: 0 auto;
}
.left {
    width: 240px;
    padding: 30px 15px;
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: calc(100vh - 72px);
    overflow-y: auto;
    background: var(--bg-gray);
    flex-shrink: 0;
}
.right {
    flex: 1;
    padding: 30px 40px;
}

/* ===== 左侧导航 ===== */
.nav li {
    margin: 4px 0;
}
.nav li a {
    display: block;
    padding: 10px 14px;
    border-radius: 4px;
    color: var(--text-dark);
    font-size: 14px;
    transition: background-color 0.2s ease;
}
.nav li a:hover:not(.active) {
    background: #ebeff5;
}
.nav li a.active {
    background: var(--main);
    color: var(--white);
}

/* ===== 面包屑 ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.bread-item {
    color: var(--text-gray);
    transition: color 0.25s ease;
}
.bread-item:hover {
    color: var(--main);
}
.bread-sep {
    color: var(--text-light);
    font-size: 13px;
}
.bread-current {
    color: var(--main);
    font-weight: 500;
}

/* ===== 通用模块标题 ===== */
.module-title {
    font-size: 18px;
    padding-bottom: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

/* ===== 产品网格列表（列表页 / 首页 / 店铺详情页通用） ===== */
.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.product-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--white);
    transition: all 0.25s ease;
}
.product-card:hover {
    border-color: var(--main);
    box-shadow: 0 2px 8px rgba(68, 114, 156, 0.12);
}
.product-card .card-img {
    width: 100%;
    height: 160px;
    background: var(--bg-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
}
.product-card .card-img img {
    width: 90%;
    height: 90%;
    object-fit: cover;
}
.product-card .card-info {
    padding: 14px;
}
.product-card .card-title {
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 42px;
    margin-bottom: 8px;
}
.product-card .card-price {
    color: var(--price);
    font-weight: 600;
    font-size: 15px;
}

/* ===== 分页（兼容 a 和 span，禁用/当前页用 span） ===== */
.page-box {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 40px 0;
}
.page-box a,
.page-box span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-dark);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.page-box a:hover {
    border-color: var(--main);
    color: var(--main);
}
.page-box a.active,
.page-box span.active {
    background-color: var(--main);
    border-color: var(--main);
    color: #fff;
}
.page-dot {
    padding: 0 8px;
    color: var(--text-gray);
    line-height: 38px;
}
.page-box a.disabled,
.page-box span.disabled {
    color: var(--text-light);
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== 广告位（旧类 .ad-area 保留兼容，新类 .ad-slot 推荐） ===== */
.ad-area {
    width: 100%;
    margin: 20px 0;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 4px;
    background: var(--bg-gray);
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}
.ad-sidebar {
    width: 100%;
    height: 250px;
    margin-top: 40px;
}
.ad-top-banner {
    height: 90px;
}
/* 新广告组件：空内容自动隐藏 */
.ad-slot:not(:empty) {
    width: 100%;
    min-height: 100px;
    margin: 24px 0;
    padding: 10px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background-color: #f7f8fa;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-light);
}
.ad-slot:empty {
    display: none !important;
}

/* ===== 页脚 ===== */
.footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    color: var(--text-light);
    background: var(--bg-gray);
    margin-top: 30px;
}

/* ================================================================
   Pagefind 站内搜索组件（统一以详情页版本为准：drawer 500-800px）
================================================================ */
.pagefind-ui__search-input {
    height: 40px;
    border-radius: 4px 0 0 4px;
    border: 1px solid var(--border);
    border-right: none;
    padding: 0 15px;
    font-size: 14px;
    outline: none;
    flex: 1;
    transition: border-color 0.2s;
}
.pagefind-ui__search-input:focus {
    border-color: var(--main);
}
.pagefind-ui__search-button {
    height: 40px;
    width: 80px;
    border-radius: 0 4px 4px 0;
    background: var(--main);
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}
.pagefind-ui__search-button:hover {
    background: var(--hover);
}
.pagefind-ui__drawer {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    width: auto;
    min-width: 500px;
    max-width: 800px;
    max-height: 480px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 8px;
}
.pagefind-ui__result {
    display: block;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    cursor: default;
}
.pagefind-ui__result:last-child {
    border-bottom: none;
}
.pagefind-ui__result:hover {
    background: var(--bg-gray);
}
.pagefind-ui__result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    text-decoration: none;
    display: block;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pagefind-ui__result-title:hover {
    color: var(--main);
}
/* 隐藏不需要的结果字段 */
.pagefind-ui__result-excerpt,
.pagefind-ui__result-price,
.pagefind-ui__result-image,
.pagefind-ui__result-meta {
    display: none !important;
}
.pagefind-ui__more {
    display: block;
    width: 100%;
    padding: 10px;
    text-align: center;
    color: var(--main);
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.pagefind-ui__more:hover {
    background: var(--bg-gray);
    color: var(--hover);
}
.pagefind-ui__message {
    padding: 20px 16px;
    color: var(--text-gray);
    text-align: center;
    font-size: 14px;
}
.pagefind-ui__result-count {
    font-size: 13px;
    color: var(--text-light);
    padding: 6px 16px 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

/* ================================================================
   全局响应式断点（所有页面共用）
================================================================ */
@media (max-width: 1024px) {
    .wp {
        padding: 0 16px;
    }
    .left {
        width: 200px;
        padding: 20px 12px;
    }
    .right {
        padding: 24px 24px;
    }
    .product-list {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
    }
    .product-card .card-img {
        height: 140px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        min-height: auto;
    }
    .left {
        display: none;
    }
    .right {
        padding: 20px 16px;
    }
    .header .wp {
        flex-wrap: wrap;
        gap: 12px;
    }
    .search-box {
        margin-left: 0;
        flex: 1 1 100%;
    }
    .pagefind-ui__drawer {
        left: 0;
        right: 0;
        min-width: auto;
        max-width: 100%;
    }
    .product-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }
    .product-card .card-img {
        height: 130px;
    }
}

@media (max-width: 480px) {
    .product-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .product-card .card-img {
        height: 110px;
    }
    .product-card .card-info {
        padding: 10px;
    }
    .product-card .card-title {
        font-size: 13px;
        min-height: 38px;
    }
    .product-card .card-price {
        font-size: 14px;
    }
}