/**
 * 单品直降Tab样式
 * Flash Sale Activity Styling
 */

/* ==================== 表格容器样式 ==================== */
/* 🔴 覆盖 product-ranking.css 中 .tab-pane .card:last-of-type 的限制样式 */
/* 让单品直降页面表格内容自然展开，不使用内部滚动条 */
#flashSaleListTab .card:last-of-type {
    display: block;
    max-height: none;
}

#flashSaleListTab .card:last-of-type .card-body {
    display: block;
    flex: none;
    overflow: visible;
    padding: 1rem;
}

#flashSaleListTab .card:last-of-type .card-body > .table-responsive {
    flex: none;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0;
}

/* ==================== 活动商品图片展示 ==================== */
.flash-sale-products {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 300px;
}

.flash-sale-product-item {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color, #e0e0e0);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.flash-sale-product-item:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.flash-sale-product-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.flash-sale-product-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background-color: #f5f5f5;
    border: 1px solid var(--border-color, #e0e0e0);
    color: var(--text-secondary, #666);
    font-size: 12px;
    font-weight: 500;
}

/* ==================== 活动时间显示 ==================== */
.flash-sale-time {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.flash-sale-time-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.flash-sale-time-item i {
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.flash-sale-time-label {
    color: var(--text-secondary, #666);
    min-width: 40px;
}

.flash-sale-time-value {
    color: var(--text-primary, #333);
}

/* ==================== 状态标签 ==================== */
.flash-sale-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.flash-sale-status.status-active {
    background-color: #e6f7e6;
    color: #52c41a;
}

.flash-sale-status.status-ended {
    background-color: #f5f5f5;
    color: #999;
}

.flash-sale-status.status-pending {
    background-color: #fff7e6;
    color: #faad14;
}

/* ==================== 优惠类型标签 ==================== */
.flash-sale-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.flash-sale-type.type-fixed {
    background-color: #e6f4ff;
    color: #1890ff;
}

.flash-sale-type.type-reduce {
    background-color: #fff0f0;
    color: #ff4d4f;
}

.flash-sale-type.type-discount {
    background-color: #f0f5ff;
    color: #722ed1;
}

/* ==================== 活动类型标签 ==================== */
.flash-sale-business {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background-color: #f5f5f5;
    color: var(--text-secondary, #666);
}

.flash-sale-business.business-limit-quantity {
    background-color: #fff2e8;
    color: #fa541c;
}

.flash-sale-business.business-limit-time {
    background-color: #fffbe6;
    color: #faad14;
}

.flash-sale-business.business-ordinary {
    background-color: #f6ffed;
    color: #52c41a;
}

/* ==================== 活动名称样式 ==================== */
.flash-sale-title {
    font-weight: 500;
    color: var(--text-primary, #333);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flash-sale-title:hover {
    color: var(--primary-color, #667eea);
    cursor: pointer;
}

/* ==================== 活动ID显示 ==================== */
.flash-sale-id {
    font-size: 11px;
    color: var(--text-disabled, #999);
    margin-top: 2px;
}

/* ==================== 表格行样式 ==================== */
#flashSaleTableBody tr:hover {
    background-color: #fafafa;
}

/* ==================== 加载状态 ==================== */
.flash-sale-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}

.flash-sale-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color, #667eea);
}

.flash-sale-loading-text {
    margin-top: 16px;
    color: var(--text-secondary, #666);
}

/* ==================== 空状态 ==================== */
.flash-sale-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}

.flash-sale-empty i {
    font-size: 4rem;
    color: #d9d9d9;
}

.flash-sale-empty-text {
    margin-top: 16px;
    color: var(--text-secondary, #666);
}

/* ==================== Cookie同步状态 ==================== */
.cookie-sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
}

.cookie-sync-status.status-success {
    background-color: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #52c41a;
}

.cookie-sync-status.status-error {
    background-color: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
}

.cookie-sync-status.status-warning {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    color: #faad14;
}

/* ==================== 图片预览弹窗 ==================== */
.flash-sale-product-preview {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1060;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 16px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

.flash-sale-product-preview-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1055;
}

.flash-sale-product-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-width: 600px;
}

.flash-sale-product-preview-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color, #e0e0e0);
}

.flash-sale-product-preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.flash-sale-product-preview-name {
    padding: 8px;
    font-size: 12px;
    color: var(--text-secondary, #666);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== 自动续期开关样式 ==================== */
.flash-sale-auto-renew {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flash-sale-auto-renew .form-check-input {
    width: 2.5em;
    height: 1.25em;
    cursor: pointer;
}

.flash-sale-auto-renew .form-check-input:checked {
    background-color: #52c41a;
    border-color: #52c41a;
}

.flash-sale-auto-renew .form-check-input:focus {
    border-color: #52c41a;
    box-shadow: 0 0 0 0.2rem rgba(82, 196, 26, 0.25);
}

.flash-sale-auto-renew .form-check-label {
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

/* 同步数据按钮样式 */
#syncDataBtn {
    background-color: #faad14;
    border-color: #faad14;
    color: #fff;
}

#syncDataBtn:hover {
    background-color: #d48806;
    border-color: #d48806;
}

#syncDataBtn:disabled {
    background-color: #ffd666;
    border-color: #ffd666;
}
