/**
 * 背包系统增强样式 v2.0
 * 优化交互和动画效果
 */

/* ==================== 动画定义 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes countUpdate {
    0%, 100% {
        transform: scale(1);
        color: inherit;
    }
    50% {
        transform: scale(1.2);
        color: #10b981;
    }
}

/* ==================== 物品卡片样式 ==================== */
.item-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.item-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent
    );
    transition: left 0.5s;
}

.item-card:hover::before {
    left: 100%;
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
}

.item-card.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
    opacity: 0;
}

/* 物品卡片 - 选中状态 */
.item-card.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

/* 物品图标容器 */
.item-icon-container {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.item-icon-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.1) 100%
    );
    opacity: 0;
    transition: opacity 0.3s;
}

.item-card:hover .item-icon-container::after {
    opacity: 1;
}

/* 物品图标 */
.item-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.item-card:hover .item-icon {
    transform: scale(1.1);
}

/* ==================== 标签页样式 ==================== */
.inventory-tabs {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.inventory-tabs::-webkit-scrollbar {
    height: 6px;
}

.inventory-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.inventory-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    position: relative;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transform: translateX(-50%);
    transition: width 0.3s;
}

.tab-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
    color: #e2e8f0;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
    border-color: rgba(59, 130, 246, 0.5);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tab-btn.active::after {
    width: 80%;
}

/* 标签计数徽章 */
.tab-count {
    padding: 2px 8px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    transition: all 0.3s;
}

.tab-btn.active .tab-count {
    background: rgba(59, 130, 246, 0.4);
    color: #ffffff;
    animation: pulse 2s infinite;
}

.tab-count.updated {
    animation: countUpdate 0.6s ease-out;
}

/* ==================== 按钮样式 ==================== */
.btn-action {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-action::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-action:active::before {
    width: 300px;
    height: 300px;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-action:active {
    transform: translateY(0);
}

/* 使用按钮 */
.btn-use {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-use:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* 出售按钮 */
.btn-sell {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-sell:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* 装备按钮 */
.btn-equip {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.btn-equip:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* ==================== 加载动画 ==================== */
.loading-skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 25%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
    height: 120px;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== 空状态样式 ==================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #94a3b8;
    animation: fadeIn 0.5s ease-out;
}

.empty-state-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
    animation: pulse 2s infinite;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #e2e8f0;
}

.empty-state-desc {
    font-size: 16px;
    color: #64748b;
}

/* ==================== 搜索框样式 ==================== */
.inventory-search {
    padding: 12px 16px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    transition: all 0.3s;
    width: 100%;
}

.inventory-search:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.inventory-search::placeholder {
    color: #64748b;
}

/* ==================== 筛选器样式 ==================== */
.inventory-filters {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-size: 14px;
    color: #94a3b8;
    white-space: nowrap;
}

.filter-select {
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-select:hover {
    border-color: rgba(59, 130, 246, 0.3);
}

.filter-select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================== 物品数量徽章 ==================== */
.item-count-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    background: rgba(59, 130, 246, 0.9);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ==================== 物品稀有度颜色 ==================== */
.rarity-common { border-left: 4px solid #94a3b8; }
.rarity-uncommon { border-left: 4px solid #10b981; }
.rarity-rare { border-left: 4px solid #3b82f6; }
.rarity-epic { border-left: 4px solid #8b5cf6; }
.rarity-legendary { border-left: 4px solid #f59e0b; }

/* ==================== 工具提示 ==================== */
.tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    padding: 12px;
    color: #e2e8f0;
    font-size: 13px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip.show {
    opacity: 1;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .item-card {
        padding: 12px;
    }
    
    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .inventory-filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        flex: 1;
    }
}

/* ==================== 滚动条美化 ==================== */
.tab-content-container::-webkit-scrollbar {
    width: 8px;
}

.tab-content-container::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
}

.tab-content-container::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    transition: background 0.3s;
}

.tab-content-container::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* ==================== 网格布局优化 ==================== */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

@media (max-width: 1200px) {
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .items-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }
}
