/* ===== 商店面板 - 从底部滑出 ===== */

/* 遮罩层 */
.shop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.shop-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* 面板主体 - 从底部滑出 */
.shop-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5001;
    max-height: 82vh;
    background: linear-gradient(180deg, rgba(25, 25, 35, 0.98), rgba(15, 15, 22, 0.98));
    backdrop-filter: blur(30px) saturate(1.3);
    -webkit-backdrop-filter: blur(30px) saturate(1.3);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    --tab-primary: #34d399;
    --tab-secondary: #10b981;
    --tab-glow: rgba(52, 211, 153, 0.3);
}

.shop-panel.active {
    transform: translateY(0);
}

/* 拖拽指示条 */
.shop-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
    margin: 8px auto 4px;
    flex-shrink: 0;
}

/* 标题栏 */
.shop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 6px;
    flex-shrink: 0;
}

.shop-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.shop-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.shop-close:active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: scale(0.9);
}

/* 分类标签栏 */
.shop-tabs {
    display: flex;
    gap: 6px;
    padding: 4px 16px 8px;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.shop-tabs::-webkit-scrollbar {
    display: none;
}

.shop-tab {
    flex: 1;
    min-width: 0;
    padding: 8px 6px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.shop-tab:active {
    transform: scale(0.95);
}

.shop-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 0 12px var(--tab-glow);
}

/* 内容区域 */
.shop-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 12px 20px;
}

.shop-content::-webkit-scrollbar {
    width: 3px;
}

.shop-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* 安全区域（适配 iPhone 底部） */
.shop-safe-area {
    height: calc(4px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
}

/* ===== 加载状态 ===== */
.shop-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.shop-loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--tab-primary);
    border-radius: 50%;
    animation: shopSpin 0.7s linear infinite;
}

@keyframes shopSpin {
    to { transform: rotate(360deg); }
}

/* ===== 空状态 ===== */
.shop-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    gap: 10px;
}

.shop-empty-icon {
    font-size: 42px;
    line-height: 1;
    opacity: 0.6;
}

.shop-empty-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    line-height: 1.5;
}

/* ===== 商品网格 ===== */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 4px 0;
}

/* ===== 商品卡片 ===== */
.shop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px 6px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s ease;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    animation: shopItemFadeIn 0.35s ease both;
}

@keyframes shopItemFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shop-item:active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.08);
}

/* 商品图片容器 */
.shop-item-img-wrap {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    box-sizing: border-box;
}

.shop-item-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* 商品名称 */
.shop-item-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    line-height: 1.3;
    margin-bottom: 1px;
    letter-spacing: 0.2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* 底部信息栏（价格 + 按钮） */
.shop-item-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

/* 价格 */
.shop-item-price {
    font-size: 13px;
    font-weight: 700;
    color: #fbbf24;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.shop-item-price::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background: url('/photo/nongchang/okcoin1.png') no-repeat center center;
    background-size: contain;
    margin-right: 3px;
    vertical-align: middle;
}

/* 购买按钮 */
.shop-buy-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--tab-primary), var(--tab-secondary));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px var(--tab-glow);
    white-space: nowrap;
}

.shop-buy-btn:active {
    transform: scale(0.92);
    box-shadow: 0 1px 4px var(--tab-glow);
}

/* ===== 购买确认弹窗 ===== */
.shop-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.shop-confirm-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.shop-confirm-dialog {
    width: 280px;
    max-width: 85vw;
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.96), rgba(20, 20, 28, 0.96));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 24px 20px 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.shop-confirm-dialog.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.shop-confirm-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-confirm-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    letter-spacing: 0.3px;
}

.shop-confirm-info {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.shop-confirm-info b {
    color: #fbbf24;
    font-weight: 700;
}

/* 数量选择区域 */
.shop-qty-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0;
}

.shop-qty-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    letter-spacing: 0.3px;
}

.shop-qty-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.shop-qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}

.shop-qty-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.12);
}

.shop-qty-slider {
    flex: 1;
    max-width: 120px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.shop-qty-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--tab-primary);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px var(--tab-glow);
    cursor: pointer;
}

.shop-qty-value {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    min-width: 24px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.shop-qty-total {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
}

.shop-qty-total b {
    color: #fbbf24;
    font-weight: 700;
}

/* 确认按钮组 */
.shop-confirm-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

.shop-confirm-btn {
    flex: 1;
    padding: 11px 0;
    border: none;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.shop-confirm-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-confirm-cancel:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.97);
}

.shop-confirm-buy {
    background: linear-gradient(135deg, var(--tab-primary), var(--tab-secondary));
    color: #fff;
    box-shadow: 0 4px 16px var(--tab-glow);
}

.shop-confirm-buy:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px var(--tab-glow);
}

/* ===== 居中提示弹窗 ===== */
.shop-toast-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 10001;
    padding: 18px 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9), rgba(5, 150, 105, 0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    line-height: 1.6;
    letter-spacing: 0.3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-width: 80vw;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.shop-toast-center.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.shop-toast-center-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.9));
    border-color: rgba(248, 113, 113, 0.3);
}

.shop-toast-center b {
    font-weight: 800;
}

/* ===== 商品描述弹窗（点击图片显示） ===== */
.shop-desc-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 10001;
    padding: 20px 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.96), rgba(20, 20, 28, 0.96));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    text-align: center;
    line-height: 1.6;
    letter-spacing: 0.3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-width: 75vw;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.shop-desc-toast.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.shop-desc-toast-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shop-desc-toast-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.shop-desc-toast-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}
