/* 全局样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* 导航栏样式增强 */
nav ul li a {
    position: relative;
}

nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #3b82f6;
    transition: width 0.3s ease;
}

nav ul li a:hover::after {
    width: 100%;
}

/* 卡片悬停效果 */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 图片加载效果 */
img {
    transition: opacity 0.3s ease;
}

img.loading {
    opacity: 0;
}

/* 按钮动画 */
.btn-primary {
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

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

/* 响应式表格 */
.table-responsive {
    overflow-x: auto;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #374151;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 页脚链接样式 */
footer a {
    transition: color 0.2s ease;
}

/* 搜索框样式 */
.search-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    outline: none;
}

/* 加载动画 */
.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #3b82f6;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误页面样式 */
.error-container {
    text-align: center;
    padding: 6rem 2rem;
}

.error-code {
    font-size: 8rem;
    font-weight: bold;
    color: #3b82f6;
    opacity: 0.2;
    margin-bottom: 1rem;
}

/* 卡片列表网格布局 */
.card-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

/* 确保卡片项正确显示 */
.card-item {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.card-item.hidden,
.card-item[style*="display: none"] {
    display: none !important;
}

/* 确保页面可以正常滚动 */
html, body {
    overflow-x: hidden;
    overflow-y: auto;
    height: 100%;
    min-height: 100vh;
}

/* 搜索结果定位修复 */
.search-results {
    position: absolute;
    z-index: 50;
    max-height: 400px;
    overflow-y: auto;
    pointer-events: auto;
}

.search-results.hidden {
    pointer-events: none;
}

/* 对比表格样式 */
#comparison-table table {
    table-layout: fixed;
    min-width: 100%;
}

#comparison-table th,
#comparison-table td {
    vertical-align: top;
    word-wrap: break-word;
}

#comparison-table .sticky {
    position: sticky;
    left: 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }
    
    .error-code {
        font-size: 6rem;
    }
    
    #comparison-table table {
        table-layout: auto;
    }
}

@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .error-code {
        font-size: 4rem;
    }
}

/* 改进的卡片占位图样式 */
.card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    z-index: 1;
}

.card-placeholder-content {
    position: relative;
    z-index: 2;
}

.card-placeholder-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 0.5rem;
}

.card-placeholder-types {
    font-size: 1rem;
    color: rgba(255,255,255,0.9);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 类型特定的渐变背景 */
.card-placeholder.fire {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
}

.card-placeholder.water {
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
}

.card-placeholder.grass {
    background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
}

.card-placeholder.psychic {
    background: linear-gradient(135deg, #f472b6 0%, #db2777 100%);
}

.card-placeholder.dragon {
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
}

.card-placeholder.fighting {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.card-placeholder.dark {
    background: linear-gradient(135deg, #6b7280 0%, #374151 100%);
}

.card-placeholder.steel {
    background: linear-gradient(135deg, #cbd5e1 0%, #64748b 100%);
}

.card-placeholder.electric {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.card-placeholder.ghost {
    background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
}

.card-placeholder.fairy {
    background: linear-gradient(135deg, #f9a8d4 0%, #ec4899 100%);
}

.card-placeholder.ice {
    background: linear-gradient(135deg, #7dd3fc 0%, #0ea5e9 100%);
}

.card-placeholder.bug {
    background: linear-gradient(135deg, #86efac 0%, #22c55e 100%);
}

.card-placeholder.rock {
    background: linear-gradient(135deg, #a8a29e 0%, #78716c 100%);
}

.card-placeholder.ground {
    background: linear-gradient(135deg, #fcd34d 0%, #eab308 100%);
}

.card-placeholder.poison {
    background: linear-gradient(135deg, #c084fc 0%, #9333ea 100%);
}

.card-placeholder.flying {
    background: linear-gradient(135deg, #93c5fd 0%, #3b82f6 100%);
}

.card-placeholder.normal {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
}