/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 导航栏样式 */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.nav-brand h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    margin: 3px 0;
    transition: 0.3s;
}

/* 主内容区域 */
.main-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-header h2 {
    color: #333;
    font-size: 1.8rem;
}

.last-update {
    color: #666;
    font-size: 0.9rem;
}

/* 筛选控制 */
.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    align-items: center;
}

.faction-selector,
.search-box,
.refresh-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.faction-selector label {
    font-weight: 500;
    color: #333;
}

.faction-selector select,
.search-box input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
}

.search-box input {
    width: 200px;
}

.search-box button {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.search-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 按钮样式 */
.btn-primary,
.btn-secondary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 物品列表 */
.items-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.items-list {
    display: grid;
    gap: 1px;
    background: #f0f0f0;
}

.item-card {
    background: white;
    padding: 1rem;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 1rem;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.item-card:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.item-rank {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
    min-width: 40px;
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-name {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.item-id {
    font-size: 0.8rem;
    color: #666;
}

.item-level {
    font-size: 0.8rem;
    color: #888;
}

.item-price {
    font-size: 1.1rem;
    font-weight: bold;
    color: #28a745;
    text-align: right;
}

.item-time {
    font-size: 0.8rem;
    color: #666;
    text-align: right;
    min-width: 120px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
}

.pagination button {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 物品详情页 */
.item-detail-container {
    display: grid;
    gap: 2rem;
}

.item-basic-info,
.price-comparison,
.price-charts {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1.5rem;
}

/* 价格对比区域 */
.price-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.faction-price-info {
    display: flex;
    flex-direction: column;
}

.alliance-card {
    border-left: 4px solid #0078d4;
}

.horde-card {
    border-left: 4px solid #c41e3a;
}

.alliance-card h3 {
    color: #0078d4;
}

.horde-card h3 {
    color: #c41e3a;
}

/* 双图表区域 */
.price-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.chart-section {
    display: flex;
    flex-direction: column;
}

.chart-section .info-card {
    height: auto;
    min-height: auto;
    display: flex;
    flex-direction: column;
}

.chart-section .info-card h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #eee;
}

#alliance-chart-container,
#horde-chart-container {
    flex: 1;
    position: relative;
    min-height: 300px;
    height: 300px;
}

/* 当容器内没有图表时，使用较小的高度 */
#alliance-chart-container:has(.no-data),
#horde-chart-container:has(.no-data) {
    height: auto;
    min-height: auto;
    flex: 0 0 auto;
}

#alliance-chart,
#horde-chart {
    width: 100% !important;
    height: 100% !important;
}

.no-data {
    color: #999;
    text-align: center;
    padding: 1rem;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: auto;
    flex-shrink: 0;
}

.info-card h3 {
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    font-weight: 500;
    color: #666;
}

.info-row .price {
    font-weight: bold;
    color: #28a745;
    font-size: 1.1rem;
}

#price-chart-container {
    position: relative;
    height: 400px;
    margin-top: 1rem;
}

/* Debug页面 */
.debug-container {
    display: grid;
    gap: 2rem;
}

.debug-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1.5rem;
}

.admin-section h3 {
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
}

.control-panel {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-panel {
    display: grid;
    gap: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.status-item:last-child {
    border-bottom: none;
}

.status-indicator {
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-indicator.success {
    background: #d4edda;
    color: #155724;
}

.status-indicator.error {
    background: #f8d7da;
    color: #721c24;
}

.status-indicator.warning {
    background: #fff3cd;
    color: #856404;
}



/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #667eea;
        flex-direction: column;
        padding: 1rem;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-toggle {
        display: flex;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .faction-selector,
    .search-box,
    .refresh-controls {
        justify-content: center;
    }

    .search-box input {
        width: 100%;
    }

    .item-card {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        text-align: center;
    }

    .item-rank {
        text-align: center;
    }

    .item-price,
    .item-time {
        text-align: center;
    }

    .control-panel {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .main-content {
        padding: 0 1rem;
    }

    .nav-container {
        padding: 0 1rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.page.active {
    animation: fadeIn 0.5s ease;
}

.item-card {
    animation: fadeIn 0.3s ease;
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

