/* 市场系统样式 - 统一所有市场页面 */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-hover: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent: #4a9eff;
    --success: #28a745;
    --border: #333;
}

/* ==================== 通用市场容器样式 ==================== */
/* 主容器 - 适应所有市场页面 */
.market-container,
.my-sales-container,
.exchange-container,
.gift-container,
.lottery-container {
    background: rgba(15, 15, 15, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    width: 1200px;
    max-width: 1200px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 1;
}

/* 有侧边栏时的居中布局 */
body.has-sidebar .market-container,
body.has-sidebar .my-sales-container,
body.has-sidebar .exchange-container,
body.has-sidebar .gift-container,
body.has-sidebar .lottery-container {
    margin-left: 50%;
    transform: translateX(-490px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 侧边栏收起时 */
body.has-sidebar.sidebar-collapsed .market-container,
body.has-sidebar.sidebar-collapsed .my-sales-container,
body.has-sidebar.sidebar-collapsed .exchange-container,
body.has-sidebar.sidebar-collapsed .gift-container,
body.has-sidebar.sidebar-collapsed .lottery-container {
    margin-left: 50%;
    transform: translateX(-575px);
}

/* ==================== 市场首页专用样式 ==================== */
/* 市场首页特殊布局 */
.market-container.market-index {
    background: rgba(26, 26, 26, 0.65) !important;
    backdrop-filter: blur(10px) !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border-radius: 0 !important;
    overflow: hidden;
    border: none !important;
    box-shadow: none !important;
    min-height: 100vh !important;
    height: 100vh !important;
}

/* 页面容器 */
.market-page-container {
    max-width: 1400px;
    margin: 30px auto 0 !important;
    background: rgba(30, 30, 30, 0.5) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 !important;
    min-height: calc(100vh - 156px) !important;
    height: calc(100vh - 156px) !important;
}

/* 页面头部 */
.market-page-header {
    background: rgba(30, 30, 30, 0.5) !important;
    padding: 25px 30px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    margin: 0 !important;
}

.market-page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin: 0 !important;
}

.market-page-title i {
    color: var(--accent);
}

.market-server-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* 主内容区 */
.market-main-container {
    display: flex;
    height: calc(100vh - 286px) !important;
    margin: 0 !important;
    min-height: calc(100vh - 286px) !important;
}

/* 左侧角色列表 */
.market-character-panel {
    width: 350px;
    background: rgba(26, 26, 26, 0.4) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(5px);
    margin: 0 !important;
}

.market-panel-header {
    padding: 20px;
    background: rgba(30, 30, 30, 0.5) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    margin: 0 !important;
}

.market-panel-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.market-panel-title i {
    color: var(--accent);
}

.market-character-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin: 0 !important;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    align-content: start;
}

.market-character-card {
    background: rgba(30, 30, 30, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(3px);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.market-character-card:hover {
    background: rgba(42, 42, 42, 0.5) !important;
    border-color: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.market-character-card.active {
    background: rgba(42, 42, 42, 0.5) !important;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.3);
}

.market-character-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.market-character-level {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1;
}

/* 右侧仓库 */
.market-storage-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 0 !important;
}

.market-storage-header {
    padding: 20px;
    background: rgba(30, 30, 30, 0.5) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    margin: 0 !important;
}

.market-storage-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(26, 26, 26, 0.3) !important;
    backdrop-filter: blur(5px);
    margin: 0 !important;
}

.market-storage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.market-storage-item {
    background: rgba(30, 30, 30, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(3px);
}

.market-storage-item:hover {
    background: rgba(42, 42, 42, 0.5) !important;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.market-item-icon {
    font-size: 36px;
    color: var(--accent);
    text-align: center;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.market-item-info {
    flex: 1;
}

.market-item-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.market-item-id, .market-item-position {
    font-size: 12px;
    color: var(--text-secondary);
}

.market-item-action {
    margin-top: 10px;
    text-align: center;
}

.market-btn-success {
    background: var(--success);
    border: none;
    padding: 5px 15px;
    font-size: 12px;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.market-btn-success:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

/* ==================== 我的寄售页面样式 ==================== */
/* 页面头部 */
.page-header {
    background: rgba(10, 10, 10, 0.9);
    padding: 25px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.page-title i {
    color: var(--accent);
}

.page-subtitle {
    color: #b0b0b0;
    font-size: 14px;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.btn-custom {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.25), rgba(74, 158, 255, 0.15));
    border: 1px solid rgba(74, 158, 255, 0.4);
    color: #f0f0f0;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.btn-custom:hover {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.35), rgba(74, 158, 255, 0.25));
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 158, 255, 0.3);
    color: #fff;
}

.btn-custom i {
    font-size: 16px;
}

/* 标签页样式 */
.nav-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 30px;
}

.nav-tabs .nav-link {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #b0b0b0;
    padding: 12px 24px;
    border-radius: 8px 8px 0 0;
    margin-right: 5px;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    background: rgba(30, 30, 30, 0.9);
    border-color: var(--accent);
    color: #f0f0f0;
}

.nav-tabs .nav-link.active {
    background: rgba(10, 10, 10, 0.95);
    border-color: var(--accent);
    color: #f0f0f0;
}

/* 表格样式 */
.table-responsive {
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.table {
    color: #e0e0e0;
    background: transparent;
}

.table thead th {
    background: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    border-bottom: 2px solid rgba(74, 158, 255, 0.3);
    color: #d0d0d0;
    font-weight: 600;
    padding: 15px;
    position: relative;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.table tbody td {
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px;
    vertical-align: middle;
    background: transparent;
    transition: all 0.3s ease;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: rgba(74, 158, 255, 0.1);
    backdrop-filter: blur(5px);
}

.table tbody tr:hover td {
    color: #f0f0f0;
}

.item-icon,
.item-icon-small {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
    vertical-align: middle;
    margin-right: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.item-icon:hover,
.item-icon-small:hover {
    transform: scale(1.1);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
}

.btn-action {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(220, 53, 69, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.btn-action:hover {
    background: rgba(220, 53, 69, 0.3);
    border-color: #dc3545;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

/* 徽章样式 */
.badge {
    font-size: 11px;
    padding: 5px 10px;
    backdrop-filter: blur(5px);
    border-radius: 20px;
}

.badge.bg-success {
    background: rgba(40, 167, 69, 0.25) !important;
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.4);
}

.badge.bg-info {
    background: rgba(23, 162, 184, 0.25) !important;
    color: #17a2b8;
    border: 1px solid rgba(23, 162, 184, 0.4);
}

.badge.bg-warning {
    background: rgba(255, 193, 7, 0.25) !important;
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #b0b0b0;
}

.empty-state i {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #e0e0e0;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 30px;
}

/* 加载动画 */
.market-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.market-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: market-spin 1s linear infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

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

/* 滚动条样式 */
.market-character-list::-webkit-scrollbar,
.market-storage-content::-webkit-scrollbar {
    width: 8px;
}

.market-character-list::-webkit-scrollbar-track,
.market-storage-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.market-character-list::-webkit-scrollbar-thumb,
.market-storage-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.market-character-list::-webkit-scrollbar-thumb:hover,
.market-storage-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1200px) {
    body.has-sidebar .market-container,
    body.has-sidebar .my-sales-container,
    body.has-sidebar .exchange-container,
    body.has-sidebar .gift-container,
    body.has-sidebar .lottery-container {
        margin-left: 250px;
        transform: none;
        width: calc(100% - 260px);
        max-width: none;
    }
    
    body.has-sidebar.sidebar-collapsed .market-container,
    body.has-sidebar.sidebar-collapsed .my-sales-container,
    body.has-sidebar.sidebar-collapsed .exchange-container,
    body.has-sidebar.sidebar-collapsed .gift-container,
    body.has-sidebar.sidebar-collapsed .lottery-container {
        margin-left: 80px;
        transform: none;
        width: calc(100% - 90px);
    }
}

/* 角色选择器 - 通用样式 */
.character-selector {
    background: rgba(20, 20, 20, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.character-selector h3 {
    color: #f0f0f0;
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.character-selector h3 i {
    color: #4a9eff;
}

.character-options {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.character-options::-webkit-scrollbar {
    display: none;
}

.character-option {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #e0e0e0;
    flex-shrink: 0;
}

.character-option:nth-child(1) { background: rgba(74, 158, 255, 0.15); border-color: rgba(74, 158, 255, 0.3); }
.character-option:nth-child(2) { background: rgba(155, 89, 182, 0.15); border-color: rgba(155, 89, 182, 0.3); }
.character-option:nth-child(3) { background: rgba(231, 76, 60, 0.15); border-color: rgba(231, 76, 60, 0.3); }
.character-option:nth-child(4) { background: rgba(243, 156, 18, 0.15); border-color: rgba(243, 156, 18, 0.3); }
.character-option:nth-child(5) { background: rgba(46, 204, 113, 0.15); border-color: rgba(46, 204, 113, 0.3); }
.character-option:nth-child(6) { background: rgba(52, 152, 219, 0.15); border-color: rgba(52, 152, 219, 0.3); }
.character-option:nth-child(7) { background: rgba(230, 126, 34, 0.15); border-color: rgba(230, 126, 34, 0.3); }
.character-option:nth-child(8) { background: rgba(26, 188, 156, 0.15); border-color: rgba(26, 188, 156, 0.3); }

.character-option:hover {
    background: rgba(74, 158, 255, 0.2);
    border-color: #4a9eff;
    transform: translateY(-2px);
}

.character-option.active {
    background: rgba(74, 158, 255, 0.3);
    border-color: #4a9eff;
    color: #4a9eff;
    font-weight: 600;
}

.character-option i {
    font-size: 14px;
    flex-shrink: 0;
}

.character-name {
    font-weight: 500;
    font-size: 12px;
    white-space: nowrap;
}

.character-level {
    font-size: 10px;
    color: #888;
    margin-left: 2px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .market-container,
    .my-sales-container,
    .exchange-container,
    .gift-container,
    .lottery-container {
        margin: 15px 10px;
        padding: 15px;
        width: calc(100% - 20px);
        max-width: none;
    }
    
    body.has-sidebar .market-container,
    body.has-sidebar .my-sales-container,
    body.has-sidebar .exchange-container,
    body.has-sidebar .gift-container,
    body.has-sidebar .lottery-container {
        margin-left: 10px;
        transform: none;
        width: calc(100% - 20px);
    }
    .market-main-container {
        flex-direction: column;
        height: auto !important;
    }
    
    .market-character-panel {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .market-character-list {
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }
    
    .market-character-card {
        min-width: 150px;
        margin-right: 10px;
        margin-bottom: 0;
    }
    
    .market-container,
    .my-sales-container {
        padding: 20px;
        margin: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-custom {
        width: 100%;
        justify-content: center;
    }
    
    .table-responsive {
        padding: 10px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 10px;
        font-size: 14px;
    }
    
    /* 移动端角色选择器优化 */
    .character-option {
        padding: 4px 6px;
        font-size: 12px;
    }
    .character-option i {
        font-size: 14px;
    }
}

/* 重置可能覆盖的样式 */
.my-sales-container,
.my-sales-container *,
.table-responsive,
.table-responsive * {
    background: transparent !important;
}

.my-sales-container {
    background: rgba(15, 15, 15, 0.85) !important;
}

.table-responsive {
    background: rgba(10, 10, 10, 0.8) !important;
}
