/**
 * 子比拼团 - 前端样式（适配子比主题风格）
 * 主题色: #f04494
 */

/* ========== Loading 动画（点击立即拼团时显示）========== */
@keyframes zibllGbSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.zibll-gb-circle.empty.loading::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(240,64,148,.2);
    border-top-color: #f04494;
    border-radius: 50%;
    animation: zibllGbSpin 0.7s linear infinite;
}


/* ========== 拼团入口条（商品页内嵌） ========== */
.zibll-gb-entry-bar {
    background: #fff;
    border: 1.5px solid rgba(240,64,148,.2);
    border-radius: 16px;
    padding: 18px 20px;
    margin: 14px 0;
}

/* ========== 头像行（核心）========== */
.zibll-gb-avatar-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.zibll-gb-slot-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.zibll-gb-role-label {
    font-size: 11px;
    color: #f04494;
    font-weight: 600;
}

.zibll-gb-divider {
    width: 1px;
    height: 48px;
    background: rgba(240,64,148,.15);
    margin-top: 6px;
    flex-shrink: 0;
}

/* ========== 拼团商品页操作区（single-product-group-buy.php）========== */
.zibll-gb-action-area {
    margin-top: 20px;
    padding: 24px;
    background: var(--main-bg-color, #fff);
    border-radius: var(--main-radius, 8px);
    border: 1px solid var(--main-border-color, #eee);
}
.zibll-gb-action-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}
.zibll-gb-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--theme-color, #f04494), #e6162d);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    margin-right: 10px;
}
.zibll-gb-action-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--key-color, #333);
}
.zibll-gb-action-price {
    margin-left: auto;
    padding: 4px 12px;
    background: rgba(240, 64, 148, .08);
    color: var(--theme-color, #f04494);
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
}
.zibll-gb-action-rule {
    padding: 12px 16px;
    background: var(--muted-bg-color, #fafafa);
    border-radius: 6px;
    font-size: 14px;
    color: var(--main-color, #666);
    line-height: 1.8;
    margin-bottom: 16px;
}
.zibll-gb-btn-area { width: 100%; }

/* 操作按钮：复用主题 .but 样式，仅保证整行铺满（对应原内联 width:100%） */
.zibll-gb-btn-area .but {
    display: block;
    width: 100%;
}

/* 状态提示（统一渲染，替代模板内联样式） */
.zibll-gb-status {
    padding: 14px 24px;
    text-align: center;
    font-size: 14px;
    border-radius: 6px;
    line-height: 1.6;
    border: 1px solid transparent;
}
.zibll-gb-status-msg { font-weight: 600; }
.zibll-gb-status-sub { font-size: 12px; opacity: .7; }
.zibll-gb-status-link {
    font-weight: 500;
    display: inline-block;
    text-decoration: none;
}
.zibll-gb-status-link:hover { text-decoration: underline; }
.zibll-gb-status--success {
    background: #f0fdf4;
    color: #16a34a;
    border-color: rgba(22, 163, 74, .2);
}
.zibll-gb-status--success .zibll-gb-status-link { color: #16a34a; }
.zibll-gb-status--failed {
    background: #fef2f2;
    color: #dc2626;
    border-color: rgba(220, 38, 38, .2);
}
.zibll-gb-status--failed .zibll-gb-status-link { color: #dc2626; }
.zibll-gb-status--pending {
    background: #fffbeb;
    color: #d97706;
    border-color: rgba(217, 119, 6, .2);
}
.zibll-gb-status--pending .zibll-gb-status-link { color: #d97706; }
.zibll-gb-status--lock {
    background: var(--muted-bg-color, #f5f5f5);
    color: var(--muted-2-color, #999);
    border-color: var(--main-border-color, #eee);
}
.zibll-gb-status--lock .zibll-gb-status-link { color: var(--theme-color, #f04494); margin-left: 8px; }

/* 页面内提示容器（替代 alert 弹窗） */
.zibll-gb-msg {
    display: none;
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid transparent;
}

.zibll-gb-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.25s ease;
    box-sizing: border-box;
    position: relative;
}

.zibll-gb-circle.empty {
    border: 1.8px solid rgba(240,64,148,.3);
    background: rgba(240,64,148,.04);
    cursor: pointer;
}
.zibll-gb-circle.empty svg { width: 22px; height: 22px; }
.zibll-gb-circle.empty svg line {
    stroke: #f04494;
    stroke-width: 2.2;
    stroke-linecap: round;
}
.zibll-gb-circle.empty:hover {
    border-color: #f04494;
    background: rgba(240,64,148,.08);
    transform: scale(1.06);
}
.zibll-gb-circle.empty:hover svg line { stroke: #f04494; }
.zibll-gb-circle.empty.loading { opacity: 0.45; pointer-events: none; }

.zibll-gb-circle.filled {
    border: 2px solid rgba(240,64,148,.2);
    overflow: hidden;
    background: #f9f9f9;
}
.zibll-gb-circle.filled .avatar-img {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
}

.zibll-gb-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(240,64,148,.15);
}
.zibll-gb-price-info { font-size: 13px; color: #555; }
.zibll-gb-price-info::before { content: '🔥'; font-size: 11px; margin-right: 3px; }
.zibll-gb-time-info {
    font-size: 12px; color: #f04494; font-weight: 600;
    background: rgba(240,64,148,.08); padding: 3px 10px; border-radius: 10px;
}

/* ================================================
   拼团详情页（独立页面 ?zibll_gb=13）
   完全自包含的样式，不依赖主题商品页上下文
   ================================================ */

/* 页面容器 - 确保有基本间距 */
body .zibll-gb-detail-page main#shop { background: #f5f5f5; min-height: 80vh; }

/* 商品头部区域 */
.zibll-gb-detail-page .single-product-header {
    background: var(--main-bg-color,#fff);
    padding: 30px 0 20px;
}
.zibll-gb-detail-page .single-header-box {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}
.zibll-gb-detail-page .single-product-cover-box {
    width: 420px;
    flex-shrink: 0;
    border-radius: var(--main-radius, 8px);
    overflow: hidden;
    background: var(--muted-bg-color,#f7f7f7);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.zibll-gb-detail-page .single-product-cover-box img {
    width: 100%; height: auto; display: block;
}
/* 无封面时的占位 */
.zibll-gb-detail-page .single-product-cover-box:empty,
.zibll-gb-detail-page .single-product-cover-box:has(img[src=""]),
.zibll-gb-detail-page .single-product-cover-box:has(img[src*="placeholder"]) {
    background: linear-gradient(135deg, #f0f0f0, #e8e8e8);
    position: relative;
}
.zibll-gb-detail-page .single-product-cover-box:empty::after {
    content: '';
    display: block;
    width: 120px; height: 90px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23ccc' viewBox='0 0 24 24'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.35;
}

.zibll-gb-detail-page .single-product-detail-box {
    flex: 1; min-width: 0; padding-top: 5px;
}

/* 标题 */
.zibll-gb-detail-page .single-product-title h1 {
    font-size: 22px !important;
    font-weight: 700;
    line-height: 1.4;
    color: #222 !important;
    margin-bottom: 10px !important;
}
.zibll-gb-detail-page .single-product-title h1 a {
    color: inherit; text-decoration: none;
}
.zibll-gb-detail-page .single-product-desc {
    font-size: 13px; color: #888; line-height: 1.6;
}

/* 价格区 */
.zibll-gb-detail-page .product-price-box {
    padding: 16px 0;
    border-bottom: 1px dotted var(--main-border-color,rgba(50,50,50,.06));
}
.zibll-gb-detail-page .price-box {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
}
.zibll-gb-detail-page .original-price-box {
    margin-left: 12px;
}
.zibll-gb-detail-page .original-price del {
    color: var(--muted-3-color,#bbb); font-size: 14px;
}

/* 拼团公式条 */
.zibll-gb-formula {
    background: rgba(240,64,148,.04);
    border: 1px solid rgba(240,64,148,.15);
    border-radius: 10px;
    padding: 14px 18px !important;
    margin: 14px 0 !important;
}
.zibll-gb-formula-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
}
.zibll-gb-f-item { display: flex; flex-direction: column; align-items: center; }
.zibll-gb-flabel { font-size: 11px; color: var(--muted-2-color,#aaa); margin-bottom: 2px; }
.zibll-gb-fvalue { font-size: 15px; font-weight: 600; color: var(--key-color,#333); }
.zibll-gb-fop { font-size: 18px; color: var(--muted-3-color,#ccc); font-weight: 300; }

/* 发货信息 */
.zibll-gb-detail-page .product-shipping-box {
    padding: 12px 0;
    border-bottom: 1px dotted var(--main-border-color,rgba(50,50,50,.06));
}
.zibll-gb-detail-page .shipping-auto-desc {
    font-size: 12px; color: var(--muted-2-color,#aaa); margin-top: 3px;
}

/* 数量选择器 */
.zibll-gb-detail-page .product-buy-num-box {
    padding: 14px 0;
}
.zibll-gb-qty-wrap {
    display: inline-flex;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}
.zibll-gb-qty-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: #fafafa; border: none; cursor: pointer;
    font-size: 18px; color: #555; transition: background 0.15s;
}
.zibll-gb-qty-btn:hover { background: #f0f0f0; }
.zibll-gb-qty-input {
    width: 54px; height: 38px; text-align: center;
    border: none; border-left: 1px solid #e0e0e0; border-right: 1px solid #e0e0e0;
    font-size: 15px; font-weight: 600; outline: none; background: #fff;
}

/* 按钮组 */
.zibll-gb-detail-page .product-pay-button-box {
    padding: 18px 0 4px;
}
.zibll-gb-detail-page .but-group.shop-paybtn-group {
    display: flex; gap: 10px;
}
.zibll-gb-detail-page .shop-paybtn-group .but {
    padding: 12px 28px !important;
    font-size: 15px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
}
.zibll-gb-detail-page .shop-pay-action-btns {
    gap: 6px !important;
}
.zibll-gb-detail-page .shop-pay-action-btns .but.cir {
    width: 40px !important; height: 40px !important;
    border-radius: 50% !important;
    border: 1px solid #eee !important;
    background: #fafafa !important;
}

/* ====== 拼团进度区域（详情页底部）====== */
.zibll-gb-progress-section,
.zibll-gb-detail-page .zib-widget {
    background: var(--main-bg-color,#fff);
    border: 1px solid var(--main-border-color,rgba(50,50,50,.06));
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 14px;
}

.zibll-gb-progress {
    width: 100%; height: 12px;
    background: var(--muted-bg-color,#f0f0f0);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
}
.zibll-gb-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #f04494, #e6162d);
    border-radius: 6px;
    transition: width 0.6s ease;
    min-width: 4%;
}

/* 成员列表 */
.zibll-gb-members {
    display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px;
}
.zibll-gb-member { text-align: center; width: 72px; }
.zibll-gb-avatar-wrap {
    position: relative; display: inline-block; margin-bottom: 6px;
}
.zibll-gb-avatar-wrap .avatar-img,
.zibll-gb-empty-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.zibll-gb-empty-avatar {
    display: flex; align-items: center; justify-content: center;
    background: var(--muted-bg-color,#f5f5f5);
    color: var(--muted-3-color,#ddd);
    font-size: 20px;
    font-weight: 700;
    border: 2px dashed var(--main-border-color,rgba(50,50,50,.06));
    margin: 0 auto;
}
.zibll-gb-name {
    font-size: 12px; color: var(--main-color,#666);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.zibll-gb-member.empty .zibll-gb-name { color: var(--muted-2-color,#bbb); }

.zibll-gb-tag {
    position: absolute;
    left: 50%; bottom: -2px;
    transform: translateX(-50%);
    font-size: 9px;
    padding: 1px 7px;
    border-radius: 8px;
    line-height: 1.4;
    white-space: nowrap;
}
.zibll-gb-tag.leader { background: #f04494; color: #fff; }
.zibll-gb-tag.paid { background: #52c41a; color: #fff; top: -2px; bottom: auto; }

/* 状态文字 */
.zibll-gb-status-text { font-weight: 600; font-size: 14px; }
.zibll-gb-status-text.c-green { color: #52c41a; }
.zibll-gb-status-text.c-red { color: #f04494; }

/* 倒计时 */
.zibll-gb-countdown { font-weight: 700; color: #f04494; margin: 0 4px; }

/* 返回按钮 */
.zibll-gb-detail-page .zib-widget a.but.c-white {
    border: 1px solid var(--main-border-color,rgba(50,50,50,.06)) !important;
    border-radius: 6px !important;
    color: var(--main-color,#666) !important;
    background: var(--muted-bg-color,#fafafa) !important;
    transition: all 0.2s;
}
.zibll-gb-detail-page .zib-widget a.but.c-white:hover {
    border-color: #f04494 !important;
    color: #f04494 !important;
    background: #fff !important;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
    /* 入口条 */
    .zibll-gb-entry-bar { padding: 14px 12px; border-radius: 12px; }
    .zibll-gb-avatar-row { gap: 8px; }
    .zibll-gb-slot-wrap { gap: 3px; }
    .zibll-gb-role-label { font-size: 10px; }
    .zibll-gb-circle { width: 44px; height: 44px; }
    .zibll-gb-divider { height: 40px; margin-top: 4px; }
    .zibll-gb-info-bar { margin-top: 10px; padding-top: 10px; }
    .zibll-gb-price-info { font-size: 12px; }
    .zibll-gb-time-info { font-size: 11px; padding: 2px 8px; }

    /* 详情页 */
    .zibll-gb-detail-page .single-header-box {
        flex-direction: column; gap: 0;
    }
    .zibll-gb-detail-page .single-product-cover-box {
        width: 100%; max-height: 320px; min-height: 220px;
    }
    .zibll-gb-detail-page .single-product-detail-box { padding-top: 16px; }
    .zibll-gb-detail-page .single-product-title h1 { font-size: 18px !important; }

    .zibll-gb-formula-inner { gap: 6px; flex-wrap: wrap; }
    .zibll-gb-fvalue { font-size: 13px; }
    .zibll-gb-fop { font-size: 14px; }

    .zibll-gb-detail-page .shop-paybtn-group { flex-direction: column; }
    .zibll-gb-detail-page .shop-paybtn-group .but { width: 100%; text-align: center; }

    .zibll-gb-member { width: 60px; }
    .zibll-gb-members { gap: 12px; }
    .zibll-gb-avatar-wrap .avatar-img,
    .zibll-gb-empty-avatar { width: 42px; height: 42px; }
    .zibll-gb-detail-page .product-pay-button-box { padding: 12px 0 0; }

    /* 拼团商品页操作区 */
    .zibll-gb-action-area { padding: 18px 16px; }
    .zibll-gb-action-title { font-size: 16px; }
    .zibll-gb-action-price { font-size: 12px; padding: 3px 10px; }
    .zibll-gb-action-rule { font-size: 13px; }
}

@media (max-width: 480px) {
    .zibll-gb-formula-inner { gap: 4px; }
    .zibll-gb-flabel { font-size: 10px; }
    .zibll-gb-fvalue { font-size: 12px; }
    .zibll-gb-fop { font-size: 12px; }
}

/* ========== 暗色模式适配 ========== */
.dark-theme .zibll-gb-entry-bar,
body.dark .zibll-gb-entry-bar {
    background: var(--main-bg-color,#323335);
    border-color: rgba(240,64,148,.15);
}
.dark-theme .zibll-gb-circle.empty,
body.dark .zibll-gb-circle.empty {
    background: rgba(240,64,148,.08);
    border-color: rgba(240,64,148,.25);
}
.dark-theme .zibll-gb-circle.filled,
body.dark .zibll-gb-circle.filled {
    border-color: rgba(240,64,148,.15);
}
.dark-theme .zibll-gb-formula,
body.dark .zibll-gb-formula {
    background: rgba(240,64,148,.06);
    border-color: rgba(240,64,148,.12);
}
.dark-theme .zibll-gb-progress-section,
.dark-theme .zibll-gb-detail-page .zib-widget,
body.dark .zibll-gb-progress-section,
body.dark .zibll-gb-detail-page .zib-widget {
    background: var(--main-bg-color,#323335);
    border-color: var(--main-border-color,rgba(114,114,114,.1));
}
.dark-theme .zibll-gb-progress,
body.dark .zibll-gb-progress {
    background: rgba(255,255,255,.08);
}
.dark-theme .zibll-gb-empty-avatar,
body.dark .zibll-gb-empty-avatar {
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.08);
}
.dark-theme .zibll-gb-detail-page .single-product-header,
body.dark .zibll-gb-detail-page .single-product-header {
    background: var(--main-bg-color,#323335);
}

/* 拼团商品页操作区 - 暗色适配 */
.dark-theme .zibll-gb-action-area,
body.dark .zibll-gb-action-area {
    background: var(--main-bg-color, #323335);
    border-color: var(--main-border-color, rgba(114, 114, 114, .1));
}
.dark-theme .zibll-gb-action-title,
body.dark .zibll-gb-action-title {
    color: var(--key-color, #e8e8e8);
}
.dark-theme .zibll-gb-action-rule,
body.dark .zibll-gb-action-rule {
    background: rgba(255, 255, 255, .05);
    color: var(--main-color, #bbb);
}
.dark-theme .zibll-gb-status--success,
body.dark .zibll-gb-status--success {
    background: rgba(22, 163, 74, .12);
}
.dark-theme .zibll-gb-status--failed,
body.dark .zibll-gb-status--failed {
    background: rgba(220, 38, 38, .12);
}
.dark-theme .zibll-gb-status--pending,
body.dark .zibll-gb-status--pending {
    background: rgba(217, 119, 6, .12);
}
