/* PFP图鉴页面样式 - 使用作用域选择器避免与主站冲突 */

/* 返回主页按钮 */
.pfp-gallery-page .back-to-home {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.pfp-gallery-page .back-to-home .btn {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 全局样式 - 仅作用于PFP图鉴页面 */
.pfp-gallery-page * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.pfp-gallery-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 - 精简版 */
.header {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    /* 移除transition，避免收缩时频闪 */
}

/* 头部顶部区域 - 包含标题和收缩按钮 */
.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.title {
    font-size: 22px; /* 缩小字体 */
    color: #667eea;
    margin-bottom: 10px; /* 减少间距 */
    text-align: center;
    transition: all 0.3s ease; /* 添加过渡 */
    flex: 1;
}

/* 手动收缩按钮 */
.toggle-header-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.toggle-header-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.toggle-header-btn .toggle-icon {
    transition: transform 0.3s ease;
    display: block;
    line-height: 1;
}

.header-controls {
    display: flex;
    justify-content: center;
    gap: 8px; /* 减少间距 */
    margin-bottom: 8px; /* 减少间距 */
    flex-wrap: wrap;
    transition: all 0.3s ease;
}

.filter-btn, .refresh-btn {
    padding: 8px 20px; /* 减少padding */
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px; /* 稍微缩小圆角 */
    cursor: pointer;
    font-size: 13px; /* 缩小字体 */
    font-weight: 600;
    transition: all 0.3s ease;
}

.filter-btn:hover, .refresh-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

.refresh-btn {
    border-color: #764ba2;
    color: #764ba2;
}

.refresh-btn:hover {
    background: #764ba2;
    border-color: #764ba2;
}

.stats {
    text-align: center;
    color: #666;
    font-size: 12px; /* 缩小字体 */
    margin-top: 8px; /* 减少间距 */
    transition: all 0.3s ease;
}

/* ==================== 头部收缩效果 - 简洁稳定版 ==================== */

/* 收缩时显示的简化栏 - 默认隐藏 */
.header-collapsed-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 6px;
    cursor: pointer;
}

.header-collapsed-bar .collapsed-info {
    font-size: 14px;
    color: #667eea;
    font-weight: 500;
}

.header-collapsed-bar .expand-btn {
    width: 28px;
    height: 28px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-collapsed-bar .expand-btn:hover {
    background: #667eea;
    color: white;
}

/* 可收缩的完整内容区域 - 默认显示 */
.header-content {
    /* 默认正常显示 */
}

/* ========== 收缩状态 ========== */
.header.collapsed {
    padding: 10px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.header.collapsed .header-collapsed-bar {
    display: flex;
}

.header.collapsed .header-content {
    display: none;
}

/* 加载提示 */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px 50px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    font-size: 18px;
    color: #667eea;
    z-index: 1000;
    display: none;
}

/* 主内容区 */
.main-content {
    padding: 30px 0;
    min-height: calc(100vh - 200px);
}

/* PFP列表 - 移动端优先 */
.pfp-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 移动端固定2列 */
    gap: 15px;
    margin-bottom: 40px;
}

/* PFP卡片 */
.pfp-card {
    background: white;
    border-radius: 15px;
    overflow: hidden; /* 保持圆角效果，但PC端会被覆盖 */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.pfp-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.pfp-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    font-weight: bold;
    font-size: 14px; /* 移动端缩小字体 */
}

.pfp-name {
    padding: 10px 15px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    display: none; /* 移动端隐藏名称 */
}

.pfp-image {
    width: 100%;
    height: 220px; /* 移动端减小高度 */
    object-fit: cover; /* 移动端裁剪适配 */
    background: #f5f5f5;
    transition: opacity 0.3s ease;
}

.pfp-image.loading {
    opacity: 0.5;
}

.pfp-image.loaded {
    opacity: 1;
}

.pfp-image.error {
    opacity: 0.3;
}

.pfp-features {
    padding: 15px;
    background: #fafafa;
    display: none; /* 移动端隐藏特征列表 */
}

.feature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-category {
    color: #667eea;
    font-weight: 600;
    min-width: 50px;
}

.feature-name {
    flex: 1;
    color: #333;
    margin: 0 10px;
}

.feature-value {
    color: #999;
    font-size: 12px;
}

/* 空消息 */
.empty-message {
    text-align: center;
    padding: 60px 20px;
    color: white;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

/* 分页样式 */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.pagination-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 40px;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: #f0f0ff;
    transform: scale(1.05);
}

.pagination-btn.active {
    background: #667eea;
    color: white;
}

.pagination-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-dots {
    padding: 0 8px;
    color: #999;
}

.pagination-info {
    margin-left: 15px;
    color: #666;
    font-size: 14px;
    white-space: nowrap;
}

/* 页脚 */
.footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 0;
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-top: 40px;
}

/* ==================== 响应式设计 - 移动端优先 ==================== */

/* 平板及以上 (≥768px) - 显示名称，隐藏特征 */
@media (min-width: 768px) {
    .pfp-list {
        grid-template-columns: repeat(3, 1fr); /* 平板3列 */
        gap: 20px;
    }

    .pfp-name {
        display: block; /* 平板显示名称 */
    }

    /* 特征保持隐藏，仅在抽屉中显示 */

    .pfp-number {
        font-size: 16px; /* 恢复字体大小 */
    }
}

/* PC端及以上 (≥1200px) - 隐藏特征，仅抽屉中显示 */
@media (min-width: 1200px) {
    .pfp-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        grid-auto-rows: auto; /* 关键：Grid行高自适应内容 */
        gap: 25px;
        align-items: start;
    }

    .pfp-card {
        height: auto !important;
        overflow: visible !important; /* 关键：防止图片被裁剪 */
    }

    .pfp-image {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        object-fit: contain !important;
        display: block !important;
    }

    /* 特征保持隐藏，仅在抽屉中显示 */
}

/* 大屏PC (≥1600px) */
@media (min-width: 1600px) {
    .pfp-list {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* 小屏幕调整 (≤768px) - 保留原有小屏优化 */
@media (max-width: 768px) {
    .title {
        font-size: 22px;
    }

    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-btn, .refresh-btn {
        width: 100%;
    }

    .pagination {
        flex-wrap: wrap;
        padding: 10px 15px;
    }

    .pagination-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* 极小屏幕 (≤480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .pfp-list {
        gap: 10px;
    }
}

/* 模态框样式 */
.pfp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pfp-modal.show {
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.pfp-modal.show .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

.modal-header {
    padding: 20px 60px 20px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h2 {
    font-size: 24px;
    margin: 0;
}

.modal-body {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: calc(90vh - 80px);
    overflow: auto;
}

.modal-body img {
    max-width: 100%;
    max-height: calc(90vh - 120px);
    object-fit: contain;
    border-radius: 8px;
}

/* 模态框响应式样式 */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 24px;
        top: 10px;
        right: 10px;
    }
}

/* 图片加载性能优化（借鉴 show_pfp_local.html） */
.pfp-image {
    background-color: #f5f5f5;  /* 占位背景色，防止重排 */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* 卡片渲染性能优化 */
.pfp-card {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* ==================== 搜索控件样式 ==================== */
.search-controls {
    margin: 8px 0; /* 减少间距 */
    display: flex;
    flex-direction: column;
    gap: 8px; /* 减少间距 */
    align-items: center;
    transition: all 0.3s ease;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 2px solid #667eea;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: #ccc;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.3s ease;
}

.search-clear-btn:hover {
    background: #999;
}

.search-options {
    display: flex;
    gap: 20px;
}

.search-option-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.search-option-label input[type="radio"] {
    cursor: pointer;
}

.search-option-label:hover {
    color: #667eea;
}

/* 筛选状态指示器 */
.active-filters {
    text-align: center;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    font-size: 13px;
    color: #667eea;
    margin-top: 10px;
}

/* ==================== 特征筛选面板样式 ==================== */
.feature-filter-section {
    margin: 20px 0;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.feature-filter-toggle {
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: white;
    color: #667eea;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.feature-filter-toggle:hover {
    background: #f8f9ff;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.feature-filter-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

.selected-count {
    margin-left: auto;
    background: #667eea;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.feature-filter-panel {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
}

/* 逻辑选择器 */
.filter-logic-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.logic-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.logic-option-label input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

/* 分类标签页 */
.feature-categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.category-tab {
    padding: 8px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.category-tab:hover {
    border-color: #667eea;
    color: #667eea;
}

.category-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* 特征列表 */
.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.feature-list .feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.feature-list .feature-item:hover {
    background: #f8f9ff;
    border-color: #667eea;
}

.feature-checkbox {
    cursor: pointer;
}

.feature-list .feature-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.feature-count {
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
}

.feature-percent {
    font-size: 11px;
    color: #999;
}

/* 操作按钮 */
.filter-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-primary, .btn-secondary {
    padding: 10px 30px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #f8f9ff;
}

/* ==================== 响应式设计 (新增筛选功能) ==================== */
@media (max-width: 768px) {
    .search-controls {
        width: 100%;
    }

    .search-input-wrapper {
        max-width: 100%;
    }

    .feature-list {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
    }
}
