/**
 * group-buy-widget.css
 * 团购组件样式 - zibll 主题扩展
 * 前缀: gb- (group buy)
 * 作用：显示在文章详情页支付盒子位置的团购组件
 * 来源：从 UI 重设计原型提取
 */

/* ============================================================
   团购组件 - 全新设计
   前缀: gb- (group buy)
   ============================================================ */

/* --- 1. 容器 --- */
.gb-box {
    background: var(--main-bg-color);
    border-radius: var(--main-radius);
    box-shadow: 0 2px 16px var(--main-shadow);
    overflow: hidden;
    position: relative;
}

/* 顶部彩条 */
.gb-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b6b, #f04494, #ff9a56);
}
.gb-box--success::before { background: linear-gradient(90deg, #43a047, #66bb6a, #a5d6a7); }
.gb-box--failed::before { background: linear-gradient(90deg, #e53935, #ef5350, #ef9a9a); }
.gb-box--ongoing::before { background: linear-gradient(90deg, #ff9800, #ffb74d, #ffe082); }

/* --- 2. 头部：商品信息区 (左图右文) --- */
.gb-header {
    display: flex;
    gap: 16px;
    padding: 20px 20px 0;
}

.gb-thumb {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background: var(--body-bg-color);
}
.gb-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gb-thumb-tag {
    position: absolute;
    left: 0;
    bottom: 0;
    background: linear-gradient(135deg, #ff5e7f 30%, #ff967e 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 0 6px 0 0;
    line-height: 1.3;
}

.gb-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.gb-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--key-color);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gb-desc {
    font-size: 13px;
    color: var(--muted-color);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}
.gb-meta {
    display: flex;
    gap: 8px;
    margin-top: 8px !important;
    padding-top: 0;
}

/* --- Meta 胶囊标签 --- */
.gb-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.gb-meta-pill--group {
    background: rgba(240, 68, 148, 0.08);
    color: #e8365d;
    border: 1px solid rgba(240, 68, 148, 0.12);
}
.gb-meta-pill--time {
    background: rgba(255, 152, 0, 0.08);
    color: #f57c00;
    border: 1px solid rgba(255, 152, 0, 0.12);
}
.gb-meta-pill--success {
    background: rgba(76, 175, 80, 0.08);
    color: #43a047;
    border: 1px solid rgba(76, 175, 80, 0.12);
}
.gb-meta-pill--closed {
    background: rgba(158, 158, 158, 0.08);
    color: #757575;
    border: 1px solid rgba(158, 158, 158, 0.12);
}

/* --- 3. 内联价格行 --- */
.gb-price-inline {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 10px !important;
    flex-wrap: wrap;
}
.gb-discount-tag {
    display: inline-block;
    padding: 3px 8px;
    background: linear-gradient(135deg, #fd7a64 10%, #fb2d2d 100%);
    color: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    flex-shrink: 0;
}
.gb-discount-tag--success {
    background: linear-gradient(135deg, #60e464 10%, #5cb85b 100%);
}
.gb-price-main {
    display: flex;
    align-items: baseline;
    gap: 2px;
}
.gb-price-symbol {
    font-size: 14px;
    font-weight: 700;
    color: #e8365d;
}
.gb-price-value {
    font-size: 22px;
    font-weight: 800;
    color: #e8365d;
    line-height: 1;
    letter-spacing: -0.5px;
}
.gb-price-original {
    font-size: 13px;
    color: var(--muted-2-color);
    text-decoration: line-through;
}
.gb-price-save {
    font-size: 12px;
    font-weight: 600;
    color: #e8365d;
    padding: 2px 8px;
    background: rgba(232, 54, 93, 0.08);
    border-radius: 10px;
}
.gb-price-inline--success .gb-price-symbol,
.gb-price-inline--success .gb-price-value {
    color: #2e7d32;
}
.gb-price-inline--success .gb-price-save {
    color: #2e7d32;
    background: rgba(46, 125, 50, 0.08);
}

/* --- 4. 拼团进度区（成员头像 + 空位） --- */
.gb-progress-section {
    margin: 16px 20px 0;
    padding: 16px;
    background: var(--muted-border-color);
    border-radius: 8px;
}
.gb-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.gb-progress-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--key-color);
    display: flex;
    align-items: center;
    gap: 6px;
}
.gb-progress-label i { color: #ff9800; font-size: 14px; }
.gb-progress-countdown {
    font-size: 12px;
    color: var(--muted-2-color);
    display: flex;
    align-items: center;
    gap: 4px;
}
.gb-progress-countdown i { font-size: 12px; color: var(--muted-3-color); }

/* 头像圆形组 */
.gb-avatars {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 4px 0;
}
.gb-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2.5px solid var(--main-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    margin-left: -8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}
.gb-avatar img,
.gb-avatar .gb-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.gb-avatar:first-child { margin-left: 0; }
.gb-avatar--leader { z-index: 3; }
.gb-avatar--member { z-index: 2; }
.gb-avatar--leader .gb-avatar-leader-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #f59f54 10%, #ff6922 100%);
    border-radius: 50%;
    border: 1.5px solid var(--main-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    color: #fff;
}

/* 空位（虚线圆） */
.gb-avatar--empty {
    background: var(--main-bg-color);
    border: 2px dashed var(--muted-3-color);
    color: var(--muted-3-color);
    font-size: 16px;
    z-index: 1;
}
.gb-avatar--empty i { font-size: 13px; }

/* 进度条 */
.gb-bar-wrap {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.gb-bar {
    flex: 1;
    height: 6px;
    background: var(--muted-border-color);
    border-radius: 3px;
    overflow: hidden;
}
.gb-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
    min-width: 6px;
}
.gb-bar-fill--orange {
    background: linear-gradient(90deg, #ff9800, #ffb74d);
}
.gb-bar-fill--green {
    background: linear-gradient(90deg, #43a047, #66bb6a);
}
.gb-bar-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--main-color);
    white-space: nowrap;
}

/* --- 5. 状态提示条 --- */
.gb-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    margin: 14px 20px 0;
    line-height: 1.4;
}
.gb-status i { font-size: 14px; flex-shrink: 0; }
.gb-status--info {
    background: rgba(21, 101, 192, 0.08);
    color: #4a90d9;
    border: 1px solid rgba(21, 101, 192, 0.15);
}
.gb-status--info i { color: #4a90d9; }
.gb-status--warning {
    background: rgba(255, 152, 0, 0.08);
    color: #e6a030;
    border: 1px solid rgba(255, 152, 0, 0.15);
}
.gb-status--warning i { color: #e6a030; }
.gb-status--success {
    background: rgba(76, 175, 80, 0.08);
    color: #5cb85b;
    border: 1px solid rgba(76, 175, 80, 0.15);
}
.gb-status--success i { color: #5cb85b; }
.gb-status--danger {
    background: rgba(229, 57, 53, 0.08);
    color: #e55555;
    border: 1px solid rgba(229, 57, 53, 0.15);
}
.gb-status--danger i { color: #e55555; }

/* --- 6. 操作按钮 --- */
.gb-actions {
    padding: 16px 20px 20px;
    display: flex;
    gap: 10px;
}
.gb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
    white-space: nowrap;
    text-decoration: none;
    color: #fff;
    outline: none;
    line-height: 1.3;
    flex: 1;
}
.gb-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    color: #fff;
    text-decoration: none;
}
.gb-btn:active { transform: translateY(0); }
.gb-btn--red {
    background: linear-gradient(135deg, #fd7a64 10%, #fb2d2d 100%);
    box-shadow: 0 2px 8px rgba(251, 45, 45, 0.25);
}
.gb-btn--blue {
    background: linear-gradient(135deg, #59c3fb 10%, #268df7 100%);
    box-shadow: 0 2px 8px rgba(38, 141, 247, 0.25);
}
.gb-btn--green {
    background: linear-gradient(135deg, #60e464 10%, #5cb85b 100%);
    box-shadow: 0 2px 8px rgba(92, 184, 91, 0.25);
}
.gb-btn--orange {
    background: linear-gradient(135deg, #f59f54 10%, #ff6922 100%);
    box-shadow: 0 2px 8px rgba(255, 105, 34, 0.25);
}
.gb-btn--outline {
    background: var(--main-bg-color);
    border: 1.5px solid var(--theme-color);
    color: var(--theme-color);
    box-shadow: none;
}
.gb-btn--outline:hover {
    background: var(--muted-border-color);
    color: var(--theme-color);
    opacity: 1;
}
.gb-hint {
    font-size: 12px;
    color: var(--muted-2-color);
    text-align: center;
    padding: 0 20px 14px;
}

/* --- 7. 拼团列表 --- */
.gb-groups {
    margin: 0 20px 16px;
    padding: 14px;
    background: var(--body-bg-color);
    border-radius: 8px;
}
.gb-groups-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--key-color);
    margin-bottom: 10px;
}
.gb-groups-head i { color: #ff6b6b; font-size: 15px; }
.gb-groups-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted-2-color);
    font-weight: 400;
}

.gb-group-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}
.gb-group-list::-webkit-scrollbar { width: 4px; }
.gb-group-list::-webkit-scrollbar-track { background: transparent; }
.gb-group-list::-webkit-scrollbar-thumb { background: var(--muted-3-color); border-radius: 2px; }

.gb-group-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--main-bg-color);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.gb-group-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.gb-group-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}
.gb-group-avatar img,
.gb-group-avatar .gb-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.gb-group-info {
    flex: 1;
    min-width: 0;
}
.gb-group-name-row {
    display: flex;
    align-items: center;
    gap: 5px;
}
.gb-group-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--main-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gb-group-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 5px;
    background: linear-gradient(135deg, #f59f54 10%, #ff6922 100%);
    color: #fff;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    flex-shrink: 0;
}
.gb-group-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted-2-color);
}
.gb-group-meta .gb-need {
    color: #e8365d;
    font-weight: 600;
}
.gb-group-meta .gb-time {
    color: #ff9800;
    font-weight: 600;
}
.gb-group-meta .gb-dot {
    color: var(--muted-3-color);
}
.gb-group-join {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #59c3fb 10%, #268df7 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(38, 141, 247, 0.2);
}
.gb-group-join:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(38, 141, 247, 0.3);
}

/* --- 8. 空状态 --- */
.gb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    text-align: center;
}
.gb-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--muted-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.gb-empty-icon i { font-size: 22px; color: var(--muted-3-color); }
.gb-empty-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--main-color);
}
.gb-empty-hint {
    font-size: 12px;
    color: var(--muted-2-color);
    margin-top: 3px;
}

/* --- 9. 拼团成功庆祝 --- */
.gb-success-card {
    text-align: center;
    padding: 24px 20px 20px;
}
.gb-success-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #60e464 10%, #5cb85b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    box-shadow: 0 4px 16px rgba(92, 184, 91, 0.3);
}
.gb-success-icon i { font-size: 24px; color: #fff; }
.gb-success-title {
    font-size: 16px;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: 4px;
}
.gb-success-desc {
    font-size: 13px;
    color: var(--muted-color);
    margin-bottom: 16px;
}
.gb-success-members {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 16px;
}

/* --- 10. 拼团失败 --- */
.gb-fail-card {
    text-align: center;
    padding: 20px 20px 16px;
}
.gb-fail-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(229, 57, 53, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
}
.gb-fail-icon i { font-size: 20px; color: #e55555; }
.gb-fail-title {
    font-size: 15px;
    font-weight: 600;
    color: #e55555;
    margin-bottom: 4px;
}
.gb-fail-desc {
    font-size: 12px;
    color: var(--muted-2-color);
}

/* --- 11. 提示行 --- */
.gb-tip-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 0 4px;
    font-size: 12px;
}
.gb-tip-row .gb-tip-price { color: var(--theme-color); font-weight: 600; }
.gb-tip-row .gb-tip-divider { color: var(--muted-3-color); }
.gb-tip-row .gb-tip-muted { color: var(--muted-2-color); }

/* ============================================================
   响应式适配
   ============================================================ */
@media (max-width: 767px) {
    .gb-header { gap: 12px; }
    .gb-thumb { width: 90px; height: 90px; }
    .gb-title { font-size: 14px; }
    .gb-price-value { font-size: 18px; }
    .gb-avatars .gb-avatar { width: 34px; height: 34px; margin-left: -6px; }
    .gb-actions { flex-direction: column; gap: 8px; }
}
@media (max-width: 479px) {
    .gb-thumb { width: 72px; height: 72px; }
    .gb-title { font-size: 13px; }
    .gb-price-value { font-size: 16px; }
    .gb-price-inline { gap: 6px; }
}

/* 最近成团成功 */
.gb-success-section {
    border-top: 1px solid var(--main-border-color);
    padding-top: 12px;
}
.gb-success-scroll-wrap {
    max-height: 80px;
    overflow: hidden;
    position: relative;
}
.gb-success-scroll-wrap::-webkit-scrollbar {
    display: none;
}
.gb-success-item {
    transition: background 0.2s;
}
.gb-success-item:hover {
    background: var(--body-bg-color) !important;
}
