/* 热门分类按钮样式 */
.popular-category-btn {
    padding: 8px 16px;
    background-color: #e5e7eb;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    border: none;
    position: relative;
    overflow: hidden;
}

.popular-category-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #4F62C9;
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.popular-category-btn:hover {
    background-color: #d1d5db;
    transform: translateY(-2px);
}

.popular-category-btn:hover::after {
    transform: scaleX(1);
}

.popular-category-btn.active {
    background-color: #4F62C9;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.popular-category-btn.active::after {
    transform: scaleX(1);
    background-color: white;
}

/* 排序下拉框样式 */
.sort-select {
    padding: 8px 30px 8px 12px;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.sort-select:hover {
    background-color: #e5e7eb;
}

.sort-select:focus {
    outline: none;
    border-color: #4F62C9;
    background-color: #e5e7eb;
}

.horizontal-scroll {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

/* 扩展卡片样式 */
.extension-card {
    background-color: white;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    position: relative;
    border-radius: 12px;
    min-width: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.extension-card:hover {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4), 0 8px 25px -5px rgba(99, 102, 241, 0.15);
    border-color: transparent;
}

.extension-card:active {
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.extension-card.checking-availability {
    opacity: 0.8;
}

.extension-card.unavailable {
    opacity: 0.7;
    filter: grayscale(80%);
    border-color: #d1d5db;
}

.extension-card.unavailable .extension-card-content {
    opacity: 0.9;
}

.extension-card.unavailable .download-btn {
    background-color: #94a3b8;
    cursor: not-allowed;
}

.extension-card.unavailable .download-btn:hover {
    background-color: #94a3b8;
    transform: none;
}

/* 扩展库卡片封面：统一 16:9 比例 */
.cover-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f1f5f9;
}

.extension-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease;
}

.extension-card:hover .extension-card-img {
    filter: brightness(1.05);
}

.extension-card-content {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.extension-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    flex-grow: 1;
    color: #1e293b;
}

.extension-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-top: 12px;
}

.extension-card-rating {
    color: #FFB400;
    display: flex;
    align-items: center;
}

.extension-card-rating i {
    margin-right: 4px;
}

.extension-card-author {
    color: #64748b;
}

.extension-card-type {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.repost-badge {
    position: absolute;
    top: 36px;
    right: 8px;
    background-color: rgba(255, 165, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* CYSO 扩展徽章（单独显示，不与其他标签合并） */
.cyso-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #4F62C9;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.35);
    z-index: 5;
}

.extension-card-date {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 8px;
}

/* 卡片统计行（评分、点赞、下载） */
.card-stats-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #64748b;
}
.card-stat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.card-stars {
    color: #f59e0b;
    letter-spacing: -1px;
}
.card-stars-empty {
    color: #cbd5e1;
    letter-spacing: -1px;
}
.card-rating-num {
    color: #64748b;
    font-size: 0.7rem;
    margin-left: 2px;
}
.card-stat i {
    font-size: 0.7rem;
}

.unavailable-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
}

.unavailable-text {
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    text-align: center;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

/* 筛选器样式 */
.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group h3 {
    font-size: 0.9rem;
    color: #4b5563;
    margin-bottom: 12px;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.filter-option:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.filter-option:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.filter-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4F62C9;
    cursor: pointer;
    margin-right: 8px;
}

.filter-option span {
    color: #374151;
    font-size: 0.9rem;
}

.filter-option input:checked + span {
    color: #4F62C9;
    font-weight: 500;
}

/* 详情弹窗样式 */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.detail-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-modal.active .modal-content {
    transform: scale(1);
}

.detail-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 8px;
    color: #94a3b8;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.close-modal:hover {
    background-color: #f1f5f9;
}

.modal-body {
    padding: 20px;
}

.ext-full-image {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 20px;
    height: 300px;
    object-fit: cover;
    object-position: center;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ext-full-image:hover {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4), 0 12px 30px -8px rgba(99, 102, 241, 0.2);
}

.ext-full-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: 12px;
    z-index: 1;
}

.ext-full-image:hover::before {
    opacity: 1;
}

.ext-meta-full {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    background-color: #f8fafc;
    border-radius: 8px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.meta-item:hover {
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.2);
}

.meta-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 4px;
}

.meta-value {
    font-weight: 500;
    color: #1e293b;
}

.ext-desc-full {
    line-height: 1.7;
    color: #334155;
    font-size: 1rem;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.ext-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.download-btn {
    background-color: #4F62C9;
    color: white;
    width: 100%;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.1);
}

.download-btn:hover {
    background-color: #3D4FA8;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3), 0 4px 8px rgba(79, 70, 229, 0.15);
}

/* 查看详情按钮（次按钮） */
.view-detail-btn {
    background-color: white;
    color: #4F62C9;
    border: 1px solid #c7d2fe;
    width: 100%;
    margin-top: 8px;
}

.view-detail-btn:hover {
    background-color: #eef2ff;
    border-color: #4F62C9;
}

/* 重置按钮样式 */
#reset-filters {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    padding: 8px 16px;
    border: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

#reset-filters::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-color: rgba(79, 70, 229, 0.1);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

#reset-filters:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

#reset-filters:hover::before {
    left: 0;
}

#reset-filters:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

.modal-download.unavailable {
    background-color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
}

.modal-download.unavailable:hover {
    background-color: #94a3b8;
    transform: none;
    box-shadow: none;
}

/* 滚动条样式 */
#extensions-container::-webkit-scrollbar {
    width: 6px;
}

#extensions-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#extensions-container::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

#extensions-container::-webkit-scrollbar-thumb:hover {
    background: #a5b4fc;
}

/* 全局动画类 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

/* 骨架屏样式 */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* 优化加载状态 */
.extension-card.loading {
    animation: pulse 1.5s infinite;
}

/* 渐变背景 */
.bg-gradient-primary {
    background: #4F62C9;
}

.bg-gradient-secondary {
    background: linear-gradient(135deg, #10B981 0%, #0EA5E9 100%);
}

/* 微渐变效果 */
.gradient-border {
    position: relative;
    border-radius: 12px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: #4F62C9;
    z-index: -1;
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gradient-border:hover::before {
    opacity: 1;
}

/* 多行文本截断 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 主内容区域过渡效果 */
#main-content {
    transition: margin-right 0.3s ease-in-out;
}

@media (max-width: 768px) {
    /* 移动端主内容区域过渡效果 */
    #main-content {
        transition: transform 0.3s ease-in-out;
    }
}

/* 响应式优化 */
@media (max-width: 768px) {
    .filter-group {
        min-width: 100%;
    }

    .extension-card-content {
        padding: 12px;
    }

    .extension-card-title {
        font-size: 1rem;
    }

    .extension-card-meta {
        font-size: 0.8125rem;
    }
}

/* 动画效果增强 */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 20px rgba(79, 70, 229, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    }
}

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

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.extension-card {
    animation: fadeIn 0.5s ease-out;
}