/* ============================================
   Zibll 积分商城 - 前端精美样式
   ============================================ */

/* 通用变量 */
.zim-mall-wrap {
    --zim-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --zim-primary-color: #667eea;
    --zim-secondary-color: #764ba2;
    --zim-vip1: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    --zim-vip2: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    --zim-vip3: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    --zim-vip4: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
    --zim-money: #ef4444;
    --zim-points: #8b5cf6;
    --zim-success: #10b981;
    --zim-warning: #f59e0b;
    --zim-shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --zim-shadow: 0 4px 12px rgba(0,0,0,0.08);
    --zim-shadow-lg: 0 10px 30px rgba(102, 126, 234, 0.15);
    --zim-radius: 12px;
    --zim-radius-lg: 16px;
}

/* ======= 商城容器 ======= */
.zim-mall-wrap {
    padding: 20px 0 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* ======= 用户资产栏 ======= */
.zim-user-assets-bar {
    background: var(--zim-primary);
    border-radius: var(--zim-radius-lg);
    padding: 24px 30px;
    margin-bottom: 24px;
    box-shadow: var(--zim-shadow-lg);
    color: #fff;
    position: relative;
    overflow: hidden;
}
.zim-user-assets-bar::before {
    content: '';
    position: absolute;
    right: -60px;
    top: -60px;
    width: 240px;
    height: 240px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.zim-user-assets-bar::after {
    content: '';
    position: absolute;
    right: 40px;
    bottom: -80px;
    width: 180px;
    height: 180px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}
.zim-user-assets {
    display: flex;
    gap: 30px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}
.zim-user-assets .asset-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 120px;
}
.zim-user-assets .asset-item .label {
    font-size: 13px;
    opacity: 0.85;
    order: 1;
}
.zim-user-assets .asset-item .value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    order: 2;
}
.zim-user-assets .asset-item .icon,
.zim-user-assets .asset-item > i:first-child,
.zim-user-assets .asset-item > svg:first-child {
    font-size: 16px;
    opacity: 0.9;
    order: 0;
    margin-bottom: 4px;
}
.zim-user-assets .asset-item .value:before { display: none; }

/* ======= 商城头部 ======= */
.zim-mall-header {
    margin-bottom: 24px;
}
.zim-mall-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 16px 0;
    background: var(--zim-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}
.zim-mall-title:before {
    content: '🛒';
    margin-right: 10px;
    -webkit-text-fill-color: initial;
}

.zim-filter-bar {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border-radius: var(--zim-radius);
    box-shadow: var(--zim-shadow-sm);
    flex-wrap: wrap;
}
.zim-filter-bar .filter-item {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}
.zim-filter-bar .filter-item:hover {
    background: #f3f4f6;
    color: #374151;
}
.zim-filter-bar .filter-item.active {
    background: var(--zim-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ======= 空状态 ======= */
.zim-empty-box {
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: var(--zim-radius-lg);
    box-shadow: var(--zim-shadow-sm);
}
.zim-empty-box .empty-icon {
    font-size: 72px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.zim-empty-box .empty-text {
    font-size: 16px;
    color: #9ca3af;
}

/* ======= 商品网格 ======= */
.zim-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ======= 商品卡片 ======= */
.zim-product-card {
    background: #fff;
    border-radius: var(--zim-radius-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--zim-shadow-sm);
    position: relative;
    display: flex;
    flex-direction: column;
}
.zim-product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--zim-shadow-lg);
}
.zim-product-card.type-vip { border-top: 3px solid transparent; border-image: var(--zim-vip1) 1; }

.product-image-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
.product-image-wrap .product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}
.zim-product-card:hover .product-image {
    transform: scale(1.08);
}
/* VIP等级徽章 */
.vip-level-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--zim-vip1);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
/* 商品角标 */
.product-tag-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.product-tag-badge.jb-yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.product-tag-badge.jb-red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.product-tag-badge.jb-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.product-tag-badge.jb-green { background: linear-gradient(135deg, #10b981, #059669); }
.product-tag-badge.jb-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

/* 售罄遮罩 */
.sold-out-mask {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    z-index: 3;
    backdrop-filter: blur(2px);
}
.stock-info {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    z-index: 2;
}

/* 商品信息 */
.product-info {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #1f2937;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 44px;
}
.product-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #6b7280;
    flex-wrap: wrap;
}
.product-meta .meta-time {
    display: inline-flex;
    align-items: center;
}

/* 价格显示 */
.product-price {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.product-price .price-row {
    display: flex;
    align-items: baseline;
    gap: 2px;
}
.product-price .price-row.money .mark { font-size: 14px; font-weight: 600; color: var(--zim-money); }
.product-price .price-row.money .price {
    font-size: 24px;
    font-weight: 700;
    color: var(--zim-money);
    letter-spacing: -0.5px;
}
.product-price .price-row.points { color: var(--zim-points); }
.product-price .price-row.points .price {
    font-size: 18px;
    font-weight: 600;
    color: var(--zim-points);
}

/* 底部栏 */
.product-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px dashed #e5e7eb;
}
.product-sales {
    font-size: 12px;
    color: #9ca3af;
}
.buy-btn {
    background: var(--zim-primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
.buy-btn:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
    transform: translateY(-1px);
    color: #fff;
}
.buy-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    color: #9ca3af;
}
.buy-btn.login-first {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ======= 分页 ======= */
.zim-pagination {
    margin-top: 30px;
    text-align: center;
}
.zim-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--zim-shadow-sm);
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}
.zim-pagination .page-numbers:hover {
    color: var(--zim-primary-color);
    box-shadow: var(--zim-shadow);
}
.zim-pagination .page-numbers.current {
    background: var(--zim-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ======= 模态框 ======= */
.zim-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.zim-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    animation: zimFadeIn 0.2s;
}
@keyframes zimFadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes zimScaleIn {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.zim-modal-dialog {
    position: relative;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    background: #fff;
    border-radius: var(--zim-radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: zimScaleIn 0.25s ease-out;
    display: flex;
    flex-direction: column;
}
.zim-modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.zim-modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #1f2937;
}
.zim-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.15s;
}
.zim-modal-close:hover { background: #f3f4f6; color: #374151; }
.zim-modal-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
    flex: 1;
}

/* 购买模态框内容 */
.zim-buy-modal-content .product-info-block {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}
.zim-buy-modal-content .product-img {
    width: 90px;
    height: 90px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f3f4f6;
}
.zim-buy-modal-content .product-img img {
    width: 100%; height: 100%; object-fit: cover;
}
.zim-buy-modal-content .product-desc { flex: 1; min-width: 0; }
.zim-buy-modal-content .product-desc .product-title {
    font-size: 16px; font-weight: 600; margin: 0 0 6px; color: #1f2937;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: auto;
}
.zim-buy-modal-content .product-type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    background: #ede9fe;
    color: #7c3aed;
    font-size: 12px;
    font-weight: 500;
}
.zim-buy-modal-content .product-desc-text {
    margin-top: 8px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    max-height: 48px;
    overflow: hidden;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 4px 0;
}

/* 支付方式 */
.pay-methods { margin: 18px 0 10px; }
.pay-methods-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}
.pay-method {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.pay-method:hover { border-color: #c7d2fe; background: #f5f3ff; }
.pay-method.active-method {
    border-color: var(--zim-primary-color);
    background: linear-gradient(135deg, rgba(102,126,234,0.06), rgba(118,75,162,0.06));
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}
.pay-method-check {
    width: 20px;
    font-size: 18px;
    color: #d1d5db;
    transition: all 0.2s;
}
.pay-method.active-method .pay-method-check { color: var(--zim-primary-color); }
.pay-method-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #92400e;
    flex-shrink: 0;
}
.pay-method.points-method .pay-method-icon {
    background: linear-gradient(135deg, #ddd6fe, #c4b5fd);
    color: #5b21b6;
}
.pay-method-info { flex: 1; min-width: 0; }
.pay-method-name { font-weight: 600; font-size: 14px; color: #1f2937; }
.pay-method-desc { font-size: 12px; color: #6b7280; margin-top: 2px; }
.pay-method-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--zim-money);
    white-space: nowrap;
}
.pay-method-price.points-price { color: var(--zim-points); font-size: 16px; }
.pay-method-price .mark { font-size: 13px; font-weight: 600; }

.balance-tip, .points-tip {
    font-size: 12px;
    padding: 8px 12px;
    background: #ecfdf5;
    color: #047857;
    border-radius: 8px;
    margin-bottom: 12px;
}
.points-tip.insufficient { background: #fef2f2; color: #b91c1c; }

/* 支付按钮行 */
.pay-action-row {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.pay-btn {
    flex: 1;
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pay-btn.points-pay-btn {
    background: #fff;
    border: 2px solid var(--zim-points);
    color: var(--zim-points);
}
.pay-btn.points-pay-btn:hover:not(:disabled) {
    background: var(--zim-points);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.25);
}
.pay-btn.money-pay-btn.primary {
    background: var(--zim-primary);
    color: #fff;
}
.pay-btn.money-pay-btn.primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}
.pay-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 加载中按钮 */
.pay-btn.loading {
    position: relative;
    color: transparent !important;
}
.pay-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: zimSpin 0.8s linear infinite;
}
.pay-btn.points-pay-btn.loading::after {
    border-color: rgba(139, 92, 246, 0.3);
    border-top-color: var(--zim-points);
}
@keyframes zimSpin {
    to { transform: rotate(360deg); }
}

/* Toast提示 */
.zim-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 999999;
    font-size: 14px;
    max-width: 90%;
    animation: zimToastIn 0.25s;
    backdrop-filter: blur(10px);
}
.zim-toast.success { background: rgba(16, 185, 129, 0.95); }
.zim-toast.error { background: rgba(239, 68, 68, 0.95); }
@keyframes zimToastIn {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ======= 响应式 ======= */
@media (max-width: 1100px) {
    .zim-products-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .zim-mall-wrap { padding: 15px 0 30px; }
    .zim-user-assets-bar { padding: 20px; margin-bottom: 20px; }
    .zim-user-assets { gap: 20px; }
    .zim-user-assets .asset-item .value { font-size: 22px; }
    .zim-mall-title { font-size: 22px; }
    .zim-products-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .product-info { padding: 12px 14px 14px; }
    .product-title { font-size: 14px; min-height: 40px; }
    .product-price .price-row.money .price { font-size: 20px; }
    .buy-btn { padding: 7px 12px; font-size: 12px; }
}
@media (max-width: 480px) {
    .zim-products-grid { grid-template-columns: 1fr; }
    .zim-user-assets { justify-content: space-between; }
    .zim-filter-bar .filter-item { padding: 6px 14px; font-size: 13px; }
    .zim-modal-dialog { width: 94%; border-radius: 12px; }
    .zim-modal-header { padding: 14px 18px; }
    .zim-modal-body { padding: 16px 18px 18px; }
}
