/* =============================================
   引用管理 - 外部网站页面样式
   ============================================= */

/* 主容器 */
.reference-container {
    flex: 1;
    padding: 20px;
    min-height: calc(100vh - 60px);
    background: #f5f7fa;
}

/* =============================================
   筛选区域
   ============================================= */
.filter-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: #666;
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
}

.category-filter:hover {
    background: #e8f0fe;
    color: #1a73e8;
}

.category-filter.active {
    background: #1a73e8;
    color: #fff;
}

.category-filter .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0,0,0,0.08);
}

.category-filter.active .count {
    background: rgba(255,255,255,0.2);
}

/* 标签行 */
.tags-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.tags-icon {
    color: #f59e0b;
    font-size: 14px;
    margin-right: 4px;
}

.ref-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    cursor: pointer;
    transition: all 0.2s;
}

.ref-tag:hover {
    background: #e0e7ff;
    color: #4f46e5;
}

/* =============================================
   工具栏
   ============================================= */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.result-count {
    font-size: 14px;
    color: #888;
}

.result-count strong {
    color: #333;
    font-weight: 700;
}

/* =============================================
   引用列表 - 卡片布局
   ============================================= */
.reference-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 16px;
}

.reference-item {
    break-inside: avoid;
}

/* 引用卡片 */
.ref-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.ref-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* 卡片头部 */
.ref-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.ref-card-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ref-category-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #1a73e8;
    background: #e8f0fe;
    white-space: nowrap;
}

.ref-name {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ref-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #888;
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ref-open-btn:hover {
    background: #f0f0f0;
    color: #1a73e8;
}

/* iframe 包装器 - 缩放显示完整宽度，隐藏滚动条 */
.ref-iframe-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    background: #fafafa;
}

/* iframe 缩放使宽度适配容器 */
.ref-iframe-wrapper iframe {
    width: 200%;
    height: 200%;
    border: none;
    transform: scale(0.5);
    transform-origin: 0 0;
}

/* 卡片底部（标签） */
.ref-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 16px;
    border-top: 1px solid #f0f0f0;
}

.ref-tag-sm {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #888;
    background: #f5f5f5;
}

/* =============================================
   骨架屏
   ============================================= */
.skeleton-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 16px;
}

.skeleton-list-item {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-line.skeleton-name {
    width: 60%;
    height: 18px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =============================================
   空状态
   ============================================= */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.empty-state i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: #666;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: #999;
}

/* =============================================
   加载更多
   ============================================= */
.load-more {
    text-align: center;
    padding: 20px 0;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 32px;
    border-radius: 24px;
    font-size: 14px;
    color: #666;
    background: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =============================================
   响应式
   ============================================= */
@media (max-width: 1024px) {
    .reference-list {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    }
}

@media (max-width: 768px) {
    .reference-container {
        padding: 12px;
    }

    .reference-list {
        grid-template-columns: 1fr;
    }

    .ref-iframe-wrapper {
        height: 220px;
    }

    .filter-section {
        padding: 12px 16px;
    }

    .category-filter {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .ref-iframe-wrapper {
        height: 180px;
    }

    .ref-card-header {
        padding: 10px 12px;
    }

    .ref-name {
        font-size: 14px;
    }
}