/* ===== 仓库面板 - 参照商店面板从底部滑出风格 ===== */

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

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

/* 面板主体 - 从底部滑出 */
.warehouse-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));
    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: #fbbf24;
    --tab-secondary: #f59e0b;
    --tab-glow: rgba(251, 191, 36, 0.3);
}

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

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

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

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

.warehouse-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;
}

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

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

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

.warehouse-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;
}

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

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

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

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

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

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

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

.warehouse-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: whSpin 0.7s linear infinite;
}

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

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

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

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

/* ===== 物品网格 ===== */
.warehouse-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 4px 0;
}

/* ===== 物品卡片 ===== */
.warehouse-item {
    aspect-ratio: 1;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.15s ease;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    animation: whItemIn 0.35s ease both;
    position: relative;
    overflow: hidden;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

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

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

/* 物品图片 - 撑满卡片 */
.warehouse-item-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    padding: 6px;
    box-sizing: border-box;
}

/* 数量角标 - 右下角 */
.warehouse-item-qty {
    position: absolute;
    bottom: 3px;
    right: 3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    color: #fbbf24;
    line-height: 1;
    letter-spacing: 0.2px;
    pointer-events: none;
}

/* ===== 稀有度边框效果 ===== */
.warehouse-item--rare {
    border-color: rgba(96, 165, 250, 0.2);
    background: rgba(96, 165, 250, 0.04);
}

.warehouse-item--epic {
    border-color: rgba(168, 85, 247, 0.25);
    background: rgba(168, 85, 247, 0.05);
}

.warehouse-item--legendary {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.06);
}

/* ===== 底部介绍框 ===== */
.warehouse-info-bar {
    flex-shrink: 0;
    padding: 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.32, 0.72, 0, 1), padding 0.35s ease;
    background: rgba(255, 255, 255, 0.04);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    z-index: 1;
    contain: layout style;
}

.warehouse-info-bar.active {
    max-height: 220px;
    padding: 14px 16px 16px;
}

.info-bar-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.info-bar-img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: contain;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    margin-top: 2px;
    padding: 4px;
    box-sizing: border-box;
}

.info-bar-detail {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-bar-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.info-bar-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-bar-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.5;
}

.info-bar-meta b {
    color: rgba(255, 255, 255, 0.75);
}

.info-bar-price b {
    color: #fbbf24;
    font-size: 14px;
}

/* 每行信息（单价/拥有/全部出售） */
.info-bar-row {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.6;
    padding: 1px 0;
}

.info-bar-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
    min-width: 72px;
}

.info-bar-value {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.info-bar-value b {
    font-size: 14px;
    color: #fbbf24;
}

.info-bar-sell-btn {
    flex-shrink: 0;
    padding: 12px 22px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a2e;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.25);
    letter-spacing: 0.5px;
    align-self: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.info-bar-sell-btn:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.15);
}

/* ===== 出售弹窗 ===== */
.sell-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}

.sell-dialog-overlay.active {
    display: flex;
}

.sell-dialog {
    width: 300px;
    max-width: 85vw;
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.96), rgba(20, 20, 28, 0.96));
    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);
}

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

.sell-dialog-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    letter-spacing: 0.3px;
}

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

.sell-dialog-info b {
    color: #fbbf24;
    font-weight: 700;
}

.sell-dialog-slider-wrap {
    width: 100%;
}

.sell-dialog-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
    margin-bottom: 8px;
}

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

.sell-dialog-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

.sell-dialog-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--tab-primary);
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.sell-dialog-qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.sell-dialog-qty-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
}

.sell-dialog-qty-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sell-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;
    line-height: 1;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

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

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

.sell-dialog-total {
    text-align: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px 0;
}

.sell-dialog-total b {
    font-size: 18px;
    color: #fbbf24;
}

.sell-dialog-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

.sell-dialog-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;
}

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

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

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

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

/* ===== 出售成功/失败提示 ===== */
.sell-toast {
    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));
    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);
}

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

.sell-toast-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);
}

.sell-toast b {
    color: #fbbf24;
}

/* ===== 宠物启用按钮和状态样式 ===== */
.info-bar-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
}

.info-bar-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-bar-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    letter-spacing: 0.3px;
}

.info-bar-status-active {
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.15);
}

.info-bar-status-inactive {
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.info-bar-activate-btn {
    flex-shrink: 0;
    padding: 8px 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #f472b6, #ec4899);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(244, 114, 182, 0.25);
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.info-bar-activate-btn:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(244, 114, 182, 0.15);
}

.info-bar-activate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.info-bar-activate-btn[disabled] {
    background: linear-gradient(135deg, #34d399, #10b981);
    box-shadow: 0 4px 16px rgba(52, 211, 153, 0.2);
    opacity: 0.8;
}

/* ===== 土地道具"使用"按钮 ===== */
.info-bar-land-use-btn {
    flex-shrink: 0;
    padding: 10px 24px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
    text-align: center;
}

.info-bar-land-use-btn:active {
    transform: scale(0.94);
    box-shadow: 0 2px 10px rgba(168, 85, 247, 0.15);
}

/* ===== 土地选择弹窗 ===== */
.land-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}

.land-selector-overlay.active {
    display: flex;
}

.land-selector-dialog {
    width: 340px;
    max-width: 90vw;
    max-height: 85vh;
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.96), rgba(20, 20, 28, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 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;
    gap: 12px;
    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);
    overflow: hidden;
}

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

.land-selector-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    padding-right: 32px;
}

.land-selector-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

.land-selector-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}

.land-selector-close {
    position: absolute;
    top: -4px;
    right: -4px;
    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;
}

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

.land-selector-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    overflow-y: auto;
    max-height: 50vh;
    padding: 2px 0;
}

.land-selector-grid::-webkit-scrollbar {
    width: 2px;
}

.land-selector-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
}

.land-selector-item {
    aspect-ratio: 1;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.land-selector-item--active {
    cursor: pointer;
}

.land-selector-item--active:active {
    transform: scale(0.93);
    background: rgba(255, 255, 255, 0.08);
}

.land-selector-item--inactive {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.land-selector-item-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-sizing: border-box;
}

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

.land-selector-footer {
    display: flex;
    justify-content: center;
    padding-top: 4px;
}

.land-selector-cancel-btn {
    padding: 10px 32px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.land-selector-cancel-btn:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.97);
}