/**
 * 好物页面插件前端样式
 */

/* 分类标题居中，自适应布局；两侧配渐隐细线提升质感 */
.goods-exhibition-category-title {
    width: 100%;
    max-width: 800px;
    margin: 40px auto 20px;
    font-weight: 700;
    font-size: 1.8rem;
    text-align: center;
    word-break: break-word;
    box-sizing: border-box;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none !important; /* 覆盖主题对 h2 添加的默认下边框实线（!important 确保压过主题高优先级规则） */
}

/* 标题两侧渐隐线条：靠近文字一侧实、外侧渐虚，颜色随标题文字自动适配明暗主题 */
.goods-exhibition-category-title::before,
.goods-exhibition-category-title::after {
    content: '';
    flex: 1;
    min-width: 24px;
    max-width: 120px;
    height: 1px;
    opacity: 0.35;
}

.goods-exhibition-category-title::before {
    margin-right: 20px;
    background: linear-gradient(to left, currentColor, transparent);
}

.goods-exhibition-category-title::after {
    margin-left: 20px;
    background: linear-gradient(to right, currentColor, transparent);
}

@media (max-width: 600px) {
    .goods-exhibition-category-title {
        font-size: 1.4rem;
        margin: 30px auto 15px;
    }

    .goods-exhibition-category-title::before,
    .goods-exhibition-category-title::after {
        min-width: 18px;
        max-width: 60px;
    }

    .goods-exhibition-category-title::before {
        margin-right: 14px;
    }

    .goods-exhibition-category-title::after {
        margin-left: 14px;
    }
}

/* 全局盒模型 */
.goods-exhibition-container,
.goods-exhibition-container * {
    box-sizing: border-box;
}

/* 外层滑动容器 */
.goods-exhibition-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    background-color: #fdfdfd;
    border-radius: 24px !important; /* 防止主题 reset 清零圆角，导致 box-shadow 呈直角矩形 */
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.07);
}

/* 横向滑动条容器 - 隐藏滚动条 */
.goods-exhibition-slider {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    /* 注意：overflow-x 非 visible 时，overflow-y 会被计算为 auto，即垂直方向也裁切。
       卡片阴影向下扩散约 22px（hover 时约 34px），底部内边距必须大于扩散距离，
       否则阴影被 padding box 底边硬切成直角。此处用负外边距抵消增量，页面布局不变。 */
    padding-bottom: 42px;
    margin-bottom: -34px;
    scrollbar-width: none;
}
.goods-exhibition-slider::-webkit-scrollbar {
    display: none;
}

/* 商品卡片 */
.goods-exhibition-item {
    flex: 0 0 33.3333%;
    margin: 0 12px;
    min-width: 280px;
    max-width: 360px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.05);
    cursor: default;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: left;
    text-decoration: none;
    color: inherit;
}

/* 有链接的卡片 */
.goods-exhibition-item.has-link {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.goods-exhibition-item.has-link:hover,
.goods-exhibition-item.has-link:focus {
    text-decoration: none;
}

/* 悬浮动画 */
.goods-exhibition-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 20px rgba(0, 0, 0, 0.09);
}

/* 文字内容 */
.goods-exhibition-content {
    padding: 20px 20px 8px 20px;
    flex-grow: 1;
}

/* 标题 - 允许换行，不再截断 */
.goods-exhibition-content > h3.goods-exhibition-title {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 0.4em !important;
    margin: 0 0 6px !important;
    font-weight: 700 !important;
    font-size: 18px !important;
    letter-spacing: -0.03em !important;
    color: #000 !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    word-break: break-word !important;
}

/* NEW标签 - 珊瑚渐变小胶囊（HTML span 替代旧版内嵌 SVG：继承页面字体渲染，明暗主题下均有良好观感） */
.goods-exhibition-new-badge {
    display: inline-flex !important;
    align-items: center !important;
    height: 20px !important;
    padding: 0 9px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #ff6b4a, #ff3b30) !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: 0.1em !important;
    flex-shrink: 0 !important;
    user-select: none !important;
    pointer-events: none !important;
    box-shadow: 0 2px 6px rgba(255, 77, 48, 0.35) !important;
}

/* 商品描述 - 限制2行 + 省略号 */
.goods-exhibition-description {
    font-size: 14px;
    line-height: 1.5;
    color: #444;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 价格 */
.goods-exhibition-price {
    font-weight: 600;
    font-size: 16px;
    color: #666;
    margin-bottom: 4px;
}

/* "了解更多"链接提示 */
.goods-exhibition-more-link {
    display: block;
    font-size: 13px;
    color: #0071e3;
    margin-top: 6px;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.goods-exhibition-item:hover .goods-exhibition-more-link {
    opacity: 1;
}

/* 图片容器 - 固定宽高比，统一卡片高度 */
.goods-exhibition-image-container {
    padding: 0 20px 20px 20px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden; /* 防止图片占位背景出现直角 */
    border-radius: 0 0 24px 24px; /* 与卡片底部圆角保持一致 */
}

.goods-exhibition-image-container .goods-exhibition-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 24px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    user-select: none;
    background: #f5f5f7;
}

/* ========================================
   箭头按钮 - 渐显效果
   ======================================== */
.goods-exhibition-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.6);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    color: #999;
    font-size: 24px;
    line-height: 1;
    transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

/* hover wrapper 时才显示箭头 */
.goods-exhibition-wrapper:hover .goods-exhibition-arrow {
    opacity: 1;
}

.goods-exhibition-arrow:hover {
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.goods-exhibition-arrow:focus {
    outline: none;
    box-shadow: 0 0 4px 2px rgba(0, 0, 0, 0.25);
    opacity: 1;
}

.goods-exhibition-arrow-left {
    left: 8px;
}
.goods-exhibition-arrow-right {
    right: 8px;
}

/* 空状态 */
.goods-exhibition-empty {
    text-align: center;
    padding: 30px;
    font-size: 14px;
    color: #86868b;
}

/* 平板端: 显示2个商品 */
@media (max-width: 1024px) and (min-width: 481px) {
    .goods-exhibition-item {
        flex: 0 0 50%;
        min-width: auto;
        max-width: none;
        margin: 0 12px;
    }
}

/* 手机端: 显示1.5个商品 */
@media (max-width: 480px) {
    .goods-exhibition-wrapper {
        padding: 20px 10px;
    }
    .goods-exhibition-item {
        flex: 0 0 72%;
        min-width: auto;
        max-width: none;
        margin: 0 8px 0 0;
    }
    .goods-exhibition-arrow {
        display: none !important;
    }
}

/* ========================================
   海报幻灯片样式
   ======================================== */

/* 海报容器 - 完全覆盖基础wrapper样式，无padding、无背景色间距 */
.goods-exhibition-wrapper.poster-slider {
    margin: 0 auto;
    padding: 0;
    border-radius: 18px !important; /* 与基础 wrapper 的 !important 同优先级，维持海报 18px 圆角不变 */
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    background: #fff;
}

.goods-exhibition-wrapper.poster-slider .poster-inner {
    position: relative;
    overflow: hidden;
    min-height: 0;
}

/* 海报滑动轨道 - 覆盖基础slider的padding */
.goods-exhibition-wrapper.poster-slider .poster-slider-track {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 0;
    /* 重置基础slider为补偿卡片阴影而设的-34px底部负外边距：
       该负边距会把poster-inner（overflow:hidden BFC）的自动高度缩减34px，
       导致海报底部被固定裁掉34px，可视高宽比随窗口宽度漂移（越窄越扁） */
    margin-bottom: 0;
    touch-action: pan-x;
}

.goods-exhibition-wrapper.poster-slider .goods-exhibition-item.poster-item {
    scroll-snap-align: start;
    flex: 0 0 100%;
    max-width: 100%;
    min-width: 100%;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    transition: none;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.goods-exhibition-wrapper.poster-slider .goods-exhibition-item.poster-item:hover {
    transform: none;
    box-shadow: none;
}

/* 海报图片容器 - 固定宽高比，强制裁切铺满 */
.goods-exhibition-poster-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 6;
    overflow: hidden;
    flex-shrink: 0;
    min-height: 0;
    min-width: 0;
}

/* 海报图片 - 绝对定位铺满容器 */
.goods-exhibition-poster-img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    max-width: none;
    object-fit: cover;
    object-position: center;
    user-select: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

/* 海报文字 - 叠加在图片底部 */
.goods-exhibition-wrapper.poster-slider .goods-exhibition-content.poster-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-wrap: wrap; /* 允许价格换行至标题下方 */
    align-items: center;
    gap: 16px;
    /* 底部预留圆点指示器的空间，避免圆点叠在描述文字上 */
    padding: 14px 24px 34px;
    background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 100%);
    text-shadow: none;
    max-width: none;
    border-radius: 0;
    backdrop-filter: none;
    z-index: 10;
}

.goods-exhibition-wrapper.poster-slider .poster-content .goods-exhibition-title {
    color: #fff !important;
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    margin: 0 !important;
    /* 允许标题收缩并显示省略号，防止长标题把价格挤出屏幕（价格保持不收缩） */
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.goods-exhibition-wrapper.poster-slider .poster-content .goods-exhibition-description {
    font-size: 1.1rem;
    margin: 0;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: unset;
    display: block;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.goods-exhibition-wrapper.poster-slider .poster-content .goods-exhibition-price {
    font-weight: 600;
    font-size: 1.2rem;
    color: #ff6b4a;
    white-space: nowrap;
    flex-shrink: 0;
    /* 独占一行强制换行：价格位于标题下方，左对齐 */
    flex-basis: 100%;
    margin-left: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* 海报箭头 - 定位在图片区域垂直居中 */
.goods-exhibition-wrapper.poster-slider .goods-exhibition-arrow {
    z-index: 20;
    opacity: 0;
    background: rgba(255, 255, 255, 0.85);
    top: 50%;
    transform: translateY(-100%);
}
.goods-exhibition-wrapper.poster-slider:hover .goods-exhibition-arrow {
    opacity: 1;
}

/* ========================================
   海报圆点指示器 - 在图片底部文字区域内
   ======================================== */
.goods-exhibition-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding: 0;
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    background: transparent;
}

.goods-exhibition-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.3s ease, transform 0.3s ease;
}

.goods-exhibition-dot.active {
    background: #fff;
    transform: scale(1.25);
}

.goods-exhibition-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* ========================================
   手机端海报响应式
   ======================================== */
@media (max-width: 480px) {
    /* 注意：选择器须与桌面规则 .goods-exhibition-content.poster-content 同特异性，
       此前低特异性导致 padding/gap 被桌面值覆盖，移动端文字块偏高 */
    .goods-exhibition-wrapper.poster-slider .goods-exhibition-content.poster-content {
        /* 文字块收紧置于中间靠下区域；底部 26px 预留圆点空间（移动端圆点 bottom:12px、高5px） */
        padding: 5px 14px 26px;
        gap: 4px;
    }

    .goods-exhibition-wrapper.poster-slider .poster-content .goods-exhibition-title {
        font-size: 1.1rem !important;
    }

    .goods-exhibition-wrapper.poster-slider .poster-content .goods-exhibition-description {
        display: none;
    }

    .goods-exhibition-wrapper.poster-slider .poster-content .goods-exhibition-price {
        font-size: 1rem !important;
        /* 抵消基础 .goods-exhibition-price 的 4px 底边距，避免文字块增高 */
        margin-bottom: 0;
    }

    .goods-exhibition-wrapper.poster-slider .goods-exhibition-arrow {
        display: none !important;
    }

    .goods-exhibition-poster-img-wrap {
        /* 与桌面端严格统一 16:6，不设最低高度 */
        aspect-ratio: 16 / 6;
    }

    .goods-exhibition-wrapper.poster-slider .goods-exhibition-poster-img {
        width: 100%;
        height: 100%;
        min-width: 0;
        max-width: none;
        object-fit: cover;
        object-position: center;
    }

    .goods-exhibition-dots {
        bottom: 12px;
    }

    .goods-exhibition-dot {
        width: 5px;
        height: 5px;
    }
}

/* ========================================
   移动端滑动提示（Peek 动画）
   ======================================== */
@keyframes goods-exhibition-peek {
    0% { transform: translateX(0); }
    40% { transform: translateX(-20px); }
    100% { transform: translateX(0); }
}

.goods-exhibition-slider.peek-hint {
    animation: goods-exhibition-peek 0.8s ease-out 1;
}

/* ========================================
   夜间模式 / Dark Mode
   支持 prefers-color-scheme 和常见主题 dark class
   ======================================== */
@media (prefers-color-scheme: dark) {
    /* 分类标题 */
    .goods-exhibition-category-title {
        color: #f0f0f0;
    }

    /* 商品滑动容器 */
    .goods-exhibition-wrapper {
        background-color: #1c1c1e;
        box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
    }

    /* 商品卡片 */
    .goods-exhibition-item {
        background: #2c2c2e;
        box-shadow: 0 8px 14px rgba(0, 0, 0, 0.2);
    }
    .goods-exhibition-item:hover {
        box-shadow: 0 14px 20px rgba(0, 0, 0, 0.3);
    }

    /* 标题 */
    .goods-exhibition-content > h3.goods-exhibition-title {
        color: #f0f0f0 !important;
    }

    /* 描述 */
    .goods-exhibition-description {
        color: #a1a1a6;
    }

    /* 价格 */
    .goods-exhibition-price {
        color: #b0b0b5;
    }

    /* 了解更多 */
    .goods-exhibition-more-link {
        color: #64b5f6;
    }

    /* 图片容器背景 */
    .goods-exhibition-image-container .goods-exhibition-image {
        background: #3a3a3c;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    }

    /* 箭头按钮 */
    .goods-exhibition-arrow {
        background: rgba(60, 60, 60, 0.8);
        color: #ccc;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
    .goods-exhibition-arrow:hover {
        background: rgba(80, 80, 80, 0.95);
        color: #fff;
    }

    /* 空状态 */
    .goods-exhibition-empty {
        color: #8e8e93;
    }

    /* 海报容器 */
    .goods-exhibition-wrapper.poster-slider {
        background: #1c1c1e;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    }

    /* 海报箭头 */
    .goods-exhibition-wrapper.poster-slider .goods-exhibition-arrow {
        background: rgba(60, 60, 60, 0.85);
        color: #ddd;
    }

    /* 链接色保持不变（已是白色/高亮色） */
}

/* 兼容常见主题的 dark mode class */
body.dark-mode .goods-exhibition-category-title,
body[data-theme="dark"] .goods-exhibition-category-title,
.dark .goods-exhibition-category-title {
    color: #f0f0f0;
}

body.dark-mode .goods-exhibition-wrapper,
body[data-theme="dark"] .goods-exhibition-wrapper,
.dark .goods-exhibition-wrapper {
    background-color: #1c1c1e;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
}

body.dark-mode .goods-exhibition-item,
body[data-theme="dark"] .goods-exhibition-item,
.dark .goods-exhibition-item {
    background: #2c2c2e;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.2);
}

body.dark-mode .goods-exhibition-item:hover,
body[data-theme="dark"] .goods-exhibition-item:hover,
.dark .goods-exhibition-item:hover {
    box-shadow: 0 14px 20px rgba(0, 0, 0, 0.3);
}

body.dark-mode .goods-exhibition-content > h3.goods-exhibition-title,
body[data-theme="dark"] .goods-exhibition-content > h3.goods-exhibition-title,
.dark .goods-exhibition-content > h3.goods-exhibition-title {
    color: #f0f0f0 !important;
}

body.dark-mode .goods-exhibition-description,
body[data-theme="dark"] .goods-exhibition-description,
.dark .goods-exhibition-description {
    color: #a1a1a6;
}

body.dark-mode .goods-exhibition-price,
body[data-theme="dark"] .goods-exhibition-price,
.dark .goods-exhibition-price {
    color: #b0b0b5;
}

body.dark-mode .goods-exhibition-more-link,
body[data-theme="dark"] .goods-exhibition-more-link,
.dark .goods-exhibition-more-link {
    color: #64b5f6;
}

body.dark-mode .goods-exhibition-image-container .goods-exhibition-image,
body[data-theme="dark"] .goods-exhibition-image-container .goods-exhibition-image,
.dark .goods-exhibition-image-container .goods-exhibition-image {
    background: #3a3a3c;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

body.dark-mode .goods-exhibition-arrow,
body[data-theme="dark"] .goods-exhibition-arrow,
.dark .goods-exhibition-arrow {
    background: rgba(60, 60, 60, 0.8);
    color: #ccc;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

body.dark-mode .goods-exhibition-arrow:hover,
body[data-theme="dark"] .goods-exhibition-arrow:hover,
.dark .goods-exhibition-arrow:hover {
    background: rgba(80, 80, 80, 0.95);
    color: #fff;
}

body.dark-mode .goods-exhibition-wrapper.poster-slider,
body[data-theme="dark"] .goods-exhibition-wrapper.poster-slider,
.dark .goods-exhibition-wrapper.poster-slider {
    background: #1c1c1e;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

body.dark-mode .goods-exhibition-wrapper.poster-slider .goods-exhibition-arrow,
body[data-theme="dark"] .goods-exhibition-wrapper.poster-slider .goods-exhibition-arrow,
.dark .goods-exhibition-wrapper.poster-slider .goods-exhibition-arrow {
    background: rgba(60, 60, 60, 0.85);
    color: #ddd;
}

body.dark-mode .goods-exhibition-empty,
body[data-theme="dark"] .goods-exhibition-empty,
.dark .goods-exhibition-empty {
    color: #8e8e93;
}
