/**
 * 送礼弹窗样式
 *
 * 基于 LS.ui.modal，使用 --ls-* CSS 变量
 * 浅色系，网格平铺，选中高亮动效
 */

/* ==================== 主容器 ==================== */
.ls-gift-popup {
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    height: 420px;
    overflow: hidden;
}

/* ==================== Tab 分类 ==================== */
.ls-gift-popup .gift-tabs {
    display: flex;
    gap: 0;
    padding: 0 16px;
    border-bottom: 1px solid var(--ls-border-light);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.ls-gift-popup .gift-tabs::-webkit-scrollbar {
    display: none;
}

.ls-gift-popup .gift-tab {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--ls-text-secondary);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s;
    user-select: none;
}

.ls-gift-popup .gift-tab:hover {
    color: var(--ls-text);
}

.ls-gift-popup .gift-tab.active {
    color: var(--ls-primary);
    font-weight: 500;
}

.ls-gift-popup .gift-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--ls-primary);
    border-radius: 1px;
}

/* ==================== Body 礼物网格 ==================== */
.ls-gift-popup .gift-body {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--ls-border) transparent;
}

.ls-gift-popup .gift-body::-webkit-scrollbar {
    width: 4px;
}

.ls-gift-popup .gift-body::-webkit-scrollbar-thumb {
    background: var(--ls-border);
    border-radius: 2px;
}

/* 面板 */
.ls-gift-popup .gift-panel {
    display: none;
}

.ls-gift-popup .gift-panel.active {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    align-content: start;
    padding: 12px 16px;
}

/* ==================== 礼物卡片 ==================== */
.ls-gift-popup .gift-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 4px 8px;
    border-radius: var(--ls-radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: var(--ls-bg);
    border: 2px solid transparent;
}

.ls-gift-popup .gift-item:hover {
    background: var(--ls-bg-hover);
    border-color: var(--ls-border);
}

.ls-gift-popup .gift-item.selected {
    border-color: var(--ls-primary);
    background: var(--ls-primary-light);
}

.ls-gift-popup .gift-item.selected .gift-img {
    animation: ls-gift-bounce 0.3s ease;
}

@keyframes ls-gift-bounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); }
    70% { transform: scale(0.96); }
    100% { transform: scale(1); }
}

/* 礼物图片 */
.ls-gift-popup .gift-item .gift-img {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    position: relative;
}

.ls-gift-popup .gift-item .gift-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ls-gift-popup .gift-item .gift-img .gift-placeholder {
    font-size: 30px;
    color: var(--ls-border);
}

/* 角标 */
.ls-gift-popup .gift-item .gift-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    display: flex;
    gap: 2px;
}

.ls-gift-popup .gift-item .gift-badge span {
    font-size: 9px;
    line-height: 14px;
    padding: 0 4px;
    border-radius: 3px;
    color: #fff;
    font-weight: 500;
}

.ls-gift-popup .gift-item .gift-badge .badge-mark {
    background: var(--ls-danger);
}

.ls-gift-popup .gift-item .gift-badge .badge-vip {
    background: #a855f7;
}

.ls-gift-popup .gift-item .gift-badge .badge-lv {
    background: var(--ls-secondary);
}

/* 礼物名称 */
.ls-gift-popup .gift-item .gift-name {
    font-size: 12px;
    color: var(--ls-text);
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* 礼物价格 */
.ls-gift-popup .gift-item .gift-price {
    font-size: 11px;
    color: var(--ls-text-muted);
    line-height: 16px;
}

.ls-gift-popup .gift-item.selected .gift-price {
    color: var(--ls-primary);
}

/* ==================== Footer ==================== */
.ls-gift-popup .gift-footer {
    display: flex;
    align-items: center;
    padding: 10px 16px 12px;
    gap: 12px;
    border-top: 1px solid var(--ls-border-light);
    background: var(--ls-bg);
}

/* 余额 */
.ls-gift-popup .gift-balance {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.ls-gift-popup .gift-balance .balance-row {
    font-size: 12px;
    color: var(--ls-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ls-gift-popup .gift-balance .balance-val {
    color: var(--ls-warning);
    font-weight: 600;
}

.ls-gift-popup .gift-balance .balance-link {
    color: var(--ls-primary);
    cursor: pointer;
    font-size: 11px;
    margin-left: 2px;
}

.ls-gift-popup .gift-balance .balance-link:hover {
    text-decoration: underline;
}

/* 礼物属性（魅力值 + 礼物积分） */
.ls-gift-popup .gift-attr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-top: 1px solid var(--ls-border-light);
    min-height: 20px;
    flex-shrink: 0;
}

.ls-gift-popup .gift-attr-item {
    font-size: 11px;
    line-height: 20px;
    padding: 0 6px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.ls-gift-popup .gift-attr-item .remix-icon {
    font-size: 12px;
}

.ls-gift-popup .gift-attr-item.attr-positive {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.08);
}

.ls-gift-popup .gift-attr-item.attr-negative {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

/* 数量选择器 */
.ls-gift-popup .gift-quantity {
    display: flex;
    align-items: center;
    border: 1px solid var(--ls-border);
    border-radius: 20px;
    overflow: hidden;
    background: var(--ls-card-bg);
}

.ls-gift-popup .gift-quantity .qty-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ls-text-secondary);
    font-size: 13px;
    transition: all var(--ls-transition);
    user-select: none;
}

.ls-gift-popup .gift-quantity .qty-btn:hover {
    color: var(--ls-text);
    background: var(--ls-bg-hover);
}

.ls-gift-popup .gift-quantity .qty-btn.disabled {
    color: var(--ls-border);
    cursor: not-allowed;
}

.ls-gift-popup .gift-quantity .qty-input {
    width: 30px;
    height: 28px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--ls-border);
    border-right: 1px solid var(--ls-border);
    font-size: 13px;
    color: var(--ls-text);
    outline: none;
    background: transparent;
    -moz-appearance: textfield;
}

.ls-gift-popup .gift-quantity .qty-input::-webkit-outer-spin-button,
.ls-gift-popup .gift-quantity .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 送礼按钮 */
.ls-gift-popup .gift-send-btn {
    background: var(--ls-primary);
    color: #fff;
    height: 34px;
    line-height: 34px;
    padding: 0 24px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.ls-gift-popup .gift-send-btn:hover {
    background: var(--ls-primary-hover);
}

.ls-gift-popup .gift-send-btn .btn-load {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ls-gift-spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes ls-gift-spin {
    to { transform: rotate(360deg); }
}

/* ==================== 加载中 ==================== */
.ls-gift-popup .gift-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.ls-gift-popup .gift-loading .btn-load {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--ls-border);
    border-top-color: var(--ls-primary);
    border-radius: 50%;
    animation: ls-gift-spin 0.6s linear infinite;
}

/* ==================== 空状态 ==================== */
.ls-gift-popup .gift-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--ls-text-muted);
    font-size: 13px;
    grid-column: 1 / -1;
    gap: 8px;
    padding: 40px 20px;
}

.ls-gift-popup .gift-empty .remix-icon {
    font-size: 48px;
    color: var(--ls-border);
}

.ls-gift-popup .gift-empty p {
    margin: 0;
    text-align: center;
    line-height: 1.5;
}

/* ==================== SVGA 播放按钮 ==================== */
.ls-gift-popup .gift-svga-btn {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.ls-gift-popup .gift-item:hover .gift-svga-btn,
.ls-gift-popup .gift-item.selected .gift-svga-btn {
    opacity: 1;
}

.ls-gift-popup .gift-svga-btn:hover {
    background: var(--ls-primary);
}

/* ==================== 评论区送礼样式 ==================== */
.ls-ci-content .ls-gift-comment {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px 2px 4px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 4px;
    font-size: 12px;
    color: #9a3412;
    line-height: 20px;
    vertical-align: middle;
}

.ls-ci-content .ls-gift-comment-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
    vertical-align: middle;
}

.ls-ci-content .ls-gift-comment-icon {
    font-size: 14px;
    color: #ea580c;
    flex-shrink: 0;
}

.ls-ci-content .ls-gift-comment-text {
    white-space: nowrap;
}

.ls-ci-content .ls-gift-comment-text b {
    color: #c2410c;
    font-weight: 500;
}

/* 暗色模式 */
[data-theme="dark"] .ls-ci-content .ls-gift-comment {
    background: rgba(234, 88, 12, 0.1);
    border-color: rgba(234, 88, 12, 0.25);
    color: #fdba74;
}

[data-theme="dark"] .ls-ci-content .ls-gift-comment-icon {
    color: #fb923c;
}

[data-theme="dark"] .ls-ci-content .ls-gift-comment-text b {
    color: #fdba74;
}
