/*
前台css样式
拼团功能样式
***/

/* 拼团按钮（缩小版） - 使用与立即购买按钮相同的样式 */
.zibll-group-buy-widget {
    display: inline-block;
    margin: 0;
    position: relative;
}

/* 拼团按钮继承立即购买按钮的样式，只需要覆盖特定属性 */
.group-buy-trigger-btn {
    display: inline-block;
    text-decoration: none;
    flex: 1;
    text-align: center;
    position: relative;
    /* 其他样式由 .cashier-link.but.jb-red 提供 */
}

/* 限时徽章样式 */
.group-buy-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #F06292 0%, #EC407A 100%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 9px;
    border-radius: 14px;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(240, 98, 146, 0.6);
    z-index: 1000;
    transform: scale(1);
    animation: badgePulse 2s ease-in-out infinite;
    letter-spacing: 0.8px;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 徽章脉冲动画 */
@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 3px 10px rgba(240, 98, 146, 0.6);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 14px rgba(240, 98, 146, 0.8);
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .group-buy-badge {
        font-size: 11px;
        padding: 3px 7px;
        top: -7px;
        right: -7px;
        letter-spacing: 0.6px;
    }
}

/* 按钮横向排列容器 */
.group-buy-buttons-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.group-buy-buttons-row .zibll-group-buy-widget {
    flex: 1;
}

/* 确保立即购买按钮保持原样，不受flex影响 */
.group-buy-buttons-row .cashier-link:not(.group-buy-trigger-btn) {
    flex: none;
    width: auto;
    min-width: auto;
}

/* 拼团弹窗 */
.group-buy-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-buy-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.group-buy-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.group-buy-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.group-buy-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

/* 弹窗内的拼团内容 */
.group-buy-modal-content .zibll-group-buy-widget {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.group-buy-modal-content .group-buy-progress {
    margin-bottom: 20px;
}

.group-buy-modal-content .progress-bar {
    width: 100%;
    height: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

.group-buy-modal-content .progress-text {
    text-align: center;
    font-size: 14px;
    color: #666;
}

.group-buy-modal-content .progress-text .target-count {
    font-size: 16px;
    color: #999;
}

.group-buy-modal-content .group-buy-btn {
    margin: 15px auto 0;
    display: block;
    text-align: center;
}

/* 弹窗内的拼团按钮使用与立即购买相同的样式 */
.group-buy-modal-content .group-buy-btn.cashier-link {
    /* 样式由 .cashier-link.but.jb-red 提供 */
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(135deg, #fd7a64 10%, #fb2d2d 100%) !important;
    border: none;
    color: #fff;
}

.group-buy-modal-content .group-buy-btn.cashier-link:hover {
    background: linear-gradient(135deg, #fb2d2d 10%, #fd7a64 100%) !important;
}

/* 状态图标样式 */
.group-buy-status-icon {
    width: 48px;
    height: 48px;
    display: block;
    margin: 0 auto 10px;
}

.group-buy-modal-content .group-buy-status {
    text-align: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-top: 15px;
}

.group-buy-modal-content .group-buy-status p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.group-buy-modal-content .group-buy-status-in-progress,
.group-buy-modal-content .group-buy-status-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.group-buy-modal-content .group-buy-status-icon {
    width: 48px;
    height: 48px;
    display: block;
}

.group-buy-modal-content .group-buy-status .success {
    color: #ff5473;
    font-weight: bold;
    font-size: 16px;
}

.group-buy-modal-content .group-buy-status .success p {
    margin: 0;
    color: #ff5473;
}

.group-buy-modal-content .group-buy-status strong {
    color: #ff5473;
    font-size: 18px;
}

/* 分享链接区域样式 */
.group-buy-share-section {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
}

.group-buy-share-link {
    display: flex;
    gap: 8px;
    align-items: center;
}

.group-buy-share-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    cursor: text;
}

.group-buy-copy-btn {
    padding: 8px 15px;
    background: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.group-buy-copy-btn:hover {
    background: #45a049;
}

.group-buy-copy-btn:active {
    transform: scale(0.98);
}

.group-buy-modal-content .group-buy-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    padding-right: 30px;
}

/* 倒计时样式 */
.group-buy-countdown {
    margin-bottom: 20px;
    padding: 12px;
    background: #fff5f5;
    border: 1px solid #ffe0e0;
    border-radius: 8px;
    text-align: center;
}

.group-buy-countdown .countdown-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: #ff4757;
    margin-bottom: 10px;
    font-weight: 600;
}

.countdown-clock-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    animation: clockRing 1s ease-in-out infinite;
    flex-shrink: 0;
}

.countdown-clock-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

@keyframes clockRing {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(10deg);
    }
}

.group-buy-countdown .countdown-timer {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: wrap;
}

.group-buy-countdown .countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
}

.group-buy-countdown .countdown-value {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #ff4757 0%, #ff6b7a 100%);
    padding: 6px 10px;
    border-radius: 6px;
    min-width: 36px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
    transition: all 0.3s ease;
    animation: numberUrgent 1.2s ease-in-out infinite;
    letter-spacing: 0.5px;
}

@keyframes numberUrgent {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(255, 71, 87, 0.5);
    }
}

.group-buy-countdown .countdown-value:hover {
    transform: scale(1.08);
}

.group-buy-countdown .countdown-unit {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    font-weight: 500;
}

.group-buy-countdown .countdown-separator {
    font-size: 18px;
    font-weight: bold;
    color: #ff4757;
    margin: 0 2px;
    line-height: 1.8;
    animation: blinkUrgent 1s ease-in-out infinite;
}

@keyframes blinkUrgent {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* 倒计时结束状态 */
.group-buy-countdown.countdown-ended .countdown-label {
    color: #999;
    font-weight: bold;
    font-size: 12px;
    animation: none;
}

.group-buy-countdown.countdown-ended .countdown-clock-icon {
    animation: none;
    color: #999;
}

.group-buy-countdown.countdown-ended {
    background: #f5f5f5;
    border-color: #ddd;
}

.zibll-group-buy-widget .group-buy-progress {
    margin-bottom: 15px;
}

.zibll-group-buy-widget .progress-bar {
    width: 100%;
    height: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

.group-buy-modal-content .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff5473 0%, #ff6b8a 100%);
    border-radius: 15px;
    transition: width 0.3s ease;
    position: relative;
}

.zibll-group-buy-widget .progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.zibll-group-buy-widget .progress-text {
    text-align: center;
    font-size: 14px;
    color: #666;
}

.group-buy-modal-content .progress-text .current-count {
    font-size: 20px;
    font-weight: bold;
    color: #ff5473;
}

.zibll-group-buy-widget .progress-text .target-count {
    font-size: 16px;
    color: #999;
}

.zibll-group-buy-widget .group-buy-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.zibll-group-buy-widget .group-buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.zibll-group-buy-widget .group-buy-btn:active {
    transform: translateY(0);
}

.zibll-group-buy-widget .group-buy-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.zibll-group-buy-widget .group-buy-status {
    text-align: center;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-top: 10px;
}

.zibll-group-buy-widget .group-buy-status p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.zibll-group-buy-widget .group-buy-status p.success,
.zibll-group-buy-widget .group-buy-status .success {
    color: #4CAF50;
    font-weight: bold;
    font-size: 16px;
}

.zibll-group-buy-widget .group-buy-status .success p {
    margin: 0;
    color: #4CAF50;
}

.zibll-group-buy-widget .group-buy-status strong {
    color: #ff6b6b;
    font-size: 18px;
}