/* 
 * Feeds Page Styles - 友链动态页面样式
 * Version: 3.0 (重写版)
 * 
 * 基于 links.css 风格统一重构
 * 保持与友情链接页面的视觉一致性
 */

/* ============================================
   1. 基础重置
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ============================================
   2. 页面容器（与 links.css 保持一致）
   ============================================ */
.feeds-page {
    max-width: 1280px;
    margin: 8px auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* ============================================
   3. Hero 区域（保持与 links 一致的边框和背景）
   ============================================ */
.feeds-hero {
    position: relative;
    padding: 48px 0;
    background: linear-gradient(135deg, #e8f4e6 0%, #d0e6ce 100%);
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 32px;
    overflow: hidden;
}

/* Hero 装饰背景 */
.feeds-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 60%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 47, 167, 0.03) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.feeds-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 40%;
    height: 150%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.03) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}

.feeds-hero .hero-container {
    position: relative;
    z-index: 1;
    padding: 0 20px;
    max-width: 1280px;
    margin: 0 auto;
}

.feeds-hero .hero-inner {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* 左侧内容区 */
.hero-left,
.hero-content {
    position: relative;
    min-height: 140px;
}

/* 动态流装饰背景（替代友链头像墙） */
.feeds-flow {
    position: absolute;
    inset: -20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 120px);
    grid-auto-rows: 30px;
    gap: 8px;
    opacity: 0.08;
    pointer-events: none;
    overflow: hidden;
}

.flow-item {
    background: linear-gradient(90deg, transparent, #4d906d, transparent);
    border-radius: 4px;
    animation: flow 15s linear infinite;
    animation-delay: calc(var(--i) * -0.5s);
}

@keyframes flow {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* Hero 内容 */
.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.feeds-hero .page-title {
    margin: 0 0 16px;
    font-size: 2.25rem;
    font-weight: 500;
    color: #4d906d;
    font-family: "KuaiKanShiJieTi", sans-serif;
}

.hero-text {
    margin-top: 16px;
    color: #4b5563;
    font-family: "Source Han Serif CN", var(--font-chinese);
    font-size: 0.95rem;
    line-height: 1.6;
}

.hero-text p {
    margin: 0 0 16px;
}

/* Hero 按钮区域 */
.hero-actions {
    position: absolute;
    bottom: 16px;
    left: 60px;
    right: 0px;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
    z-index: 10;
}

/* ============================================
   4. 统计卡片（与 links 页面站点卡片风格一致）
   ============================================ */
.feeds-info-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.card-header i {
    font-size: 1.25rem;
    color: #4d906d;
}

.card-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
}

/* 统计摘要 */
.stats-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.summary-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

.summary-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 8px;
    margin-right: 12px;
}

.summary-icon i {
    font-size: 1rem;
    color: #4d906d;
}

.summary-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-label {
    font-size: 0.875rem;
    color: #6b7280;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    transition: all 0.3s ease;
}

/* 分隔线 */
.card-divider {
    height: 1px;
    margin: 16px 0;
    border: 0;
    border-top: 1px solid #e5e7eb;
}

/* 最后更新信息 */
.last-update-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #6b7280;
}

.last-update-info i {
    font-size: 0.9rem;
    color: #9ca3af;
}

.last-update-info .btn-refresh-inline {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.last-update-info .btn-refresh-inline i {
    font-size: 14px;
}

.last-update-info .btn-refresh-inline:hover {
    color: #4d906d;
}

.last-update-info .btn-refresh-inline:hover i {
    animation: spin 1s linear infinite;
}

.last-update-info .btn-refresh-inline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.last-update-info .btn-refresh-inline.is-refreshing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   5. 按钮样式
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.btn.primary {
    color: #ffffff;
    background: #4d906d;
    border-color: #4d906d;
}

.btn.primary:hover {
    background: #001d6b;
    border-color: #001d6b;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   6. 友链动态列表区域
   ============================================ */
.feeds-section {
    padding: 0 20px 40px;
}

.feeds-container {
    max-width: 1280px;  /* 添加最大宽度限制 */
    margin: 0 auto;     /* 居中对齐 */
    padding: 0 20px;    /* 添加内边距 */
}

/* 操作栏（与 links 页面保持一致） */
.feeds-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

/* 布局切换 */
.feeds-layout-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: #f3f4f6;
    border-radius: 8px;
}

.feeds-layout-toggle .lt-btn {
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feeds-layout-toggle .lt-btn:last-child {
    margin-right: 0;
}

.feeds-layout-toggle .lt-btn i {
    font-size: 14px;
}

.feeds-layout-toggle .lt-btn:hover {
    background: #ffffff;
    color: #4d906d;
}

.feeds-layout-toggle .lt-btn[aria-pressed="true"] {
    background: #ffffff;
    color: #4d906d;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 时间轴网格 */
.feeds-timeline {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
}

.feeds-timeline.layout-3 {
    grid-template-columns: repeat(3, 1fr);
}

.feeds-timeline.layout-2 {
    grid-template-columns: repeat(2, 1fr);
}

.feeds-timeline.layout-1 {
    grid-template-columns: 1fr;
}

/* ============================================
   7. 友链动态卡片
   ============================================ */
.feed-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
}

.feed-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-4px);
    border-color: #4d906d;
}

.feed-item-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 标题 */
.feed-title {
    margin: 0 0 12px;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

.feed-title a {
    color: #0f172a;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-title a:hover {
    color: #4d906d;
}

/* 摘要 */
.feed-excerpt {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: auto;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 底部信息 */
.feed-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.feed-source {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.source-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: #f3f4f6;
}

.avatar-fallback {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.source-name {
    color: #6b7280;
    font-size: 0.875rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-name:hover {
    color: #4d906d;
}

.feed-time {
    color: #9ca3af;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* 空状态 */
.no-feeds {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.no-feeds i {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

/* ============================================
   8. 加载动画
   ============================================ */
.feeds-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.loader-rect {
    display: flex;
    gap: 4px;
    height: 32px;
}

.loader-rect > div {
    width: 4px;
    height: 100%;
    background: #4d906d;
    border-radius: 2px;
    animation: rect-anim 0.9s ease-in-out infinite;
}

.loader-rect > div:nth-child(1) { animation-delay: 0s; }
.loader-rect > div:nth-child(2) { animation-delay: 0.05s; }
.loader-rect > div:nth-child(3) { animation-delay: 0.10s; }
.loader-rect > div:nth-child(4) { animation-delay: 0.15s; }
.loader-rect > div:nth-child(5) { animation-delay: 0.20s; }

@keyframes rect-anim {
    0%, 100% { transform: scaleY(0.75); }
    50% { transform: scaleY(1.25); }
}

/* ============================================
   9. 响应式设计
   ============================================ */
@media (max-width: 1200px) {
    .feeds-hero .hero-inner {
        grid-template-columns: 1fr;
    }
    
    .feeds-timeline.layout-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .feeds-timeline.layout-3,
    .feeds-timeline.layout-2 {
        grid-template-columns: 1fr;
    }
    
    .feeds-hero .hero-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .feeds-info-card {
        max-width: 500px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .feeds-page {
        margin: 12px;
        border-radius: 0;
    }
    
    .feeds-hero {
        padding: 24px 0;
    }
    
    .feeds-container {
        padding: 0 16px 16px;
    }
    
    .feeds-timeline {
        gap: 16px;
    }
    
    .feeds-layout-toggle {
        display: none;
    }
    
    .feeds-timeline.layout-3,
    .feeds-timeline.layout-2 {
        grid-template-columns: 1fr;
    }
    
    .feeds-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .feeds-layout-toggle {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .feeds-hero .page-title {
        font-size: 1.75rem;
    }
    
    .hero-text {
        font-size: 0.875rem;
    }
    
    .feed-item-container {
        padding: 16px;
    }
    
    .feeds-hero .hero-inner {
        padding: 0 16px;
    }
    
    .feeds-section {
        padding: 0 16px 32px;
    }
}

/* ============================================
   10. 深色模式
   ============================================ */
[data-theme="dark"] .feeds-page {
    background: var(--color-background);
    border-color: var(--color-border);
}

[data-theme="dark"] .feeds-hero {
    background: linear-gradient(135deg, rgba(0, 47, 167, 0.05) 0%, rgba(0, 47, 167, 0.02) 100%);
    border-bottom-color: var(--color-border);
}

[data-theme="dark"] .feeds-flow {
    opacity: 0.05;
}

[data-theme="dark"] .feeds-hero .page-title {
    color: #3b82f6;
}

[data-theme="dark"] .hero-text {
    color: var(--color-text-light);
}

[data-theme="dark"] .feeds-info-card {
    background: var(--color-background);
    border-color: var(--color-border);
}

[data-theme="dark"] .card-header {
    border-bottom-color: var(--color-border);
}

[data-theme="dark"] .card-header h3 {
    color: var(--color-text);
}

[data-theme="dark"] .summary-item {
    background: var(--color-background-light);
}

[data-theme="dark"] .summary-item:hover {
    background: rgba(0, 47, 167, 0.1);
}

[data-theme="dark"] .summary-icon {
    background: var(--color-background);
}

[data-theme="dark"] .summary-value {
    color: var(--color-text);
}

[data-theme="dark"] .card-divider {
    border-top-color: var(--color-border);
}

[data-theme="dark"] .btn {
    background: var(--color-background);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] .btn:hover {
    background: var(--color-background-light);
}

[data-theme="dark"] .btn.primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

[data-theme="dark"] .btn.primary:hover {
    background: #001d6b;
    border-color: #001d6b;
}

[data-theme="dark"] .feeds-layout-toggle {
    background: var(--color-background-light);
}

[data-theme="dark"] .feeds-layout-toggle .lt-btn {
    color: var(--color-text-light);
}

[data-theme="dark"] .feeds-layout-toggle .lt-btn:hover {
    background: var(--color-background);
    color: var(--color-primary);
}

[data-theme="dark"] .feeds-layout-toggle .lt-btn[aria-pressed="true"] {
    background: var(--color-background);
    color: var(--color-primary);
}

[data-theme="dark"] .feed-item {
    background: var(--color-background);
    border-color: var(--color-border);
}

[data-theme="dark"] .feed-item:hover {
    border-color: var(--color-primary);
}

[data-theme="dark"] .feed-title a {
    color: var(--color-text);
}

[data-theme="dark"] .feed-title a:hover {
    color: var(--color-primary);
}

[data-theme="dark"] .feed-excerpt {
    color: var(--color-text-light);
}

[data-theme="dark"] .feed-footer {
    border-top-color: var(--color-border);
}

[data-theme="dark"] .source-avatar,
[data-theme="dark"] .avatar-fallback {
    background: var(--color-background-light);
}

[data-theme="dark"] .source-name {
    color: var(--color-text-light);
}

[data-theme="dark"] .source-name:hover {
    color: var(--color-primary);
}

[data-theme="dark"] .no-feeds {
    color: var(--color-text-light);
}

[data-theme="dark"] .loader-rect > div {
    background: var(--color-primary);
}

/* ============================================
   7. 加载更多按钮
   ============================================ */
.load-more-btn {
    display: block;
    margin: 40px auto 20px;
    padding: 12px 32px;
    background: #ffffff;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 47, 167, 0.1);
}

.load-more-btn:hover {
    background: var(--color-primary);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 47, 167, 0.2);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.load-more-btn i {
    margin-right: 8px;
    font-size: 0.9em;
}

/* 加载中状态 */
.load-more-btn .fa-spinner {
    animation: spin 1s linear infinite;
}

/* 深色模式 */
[data-theme="dark"] .load-more-btn {
    background: var(--color-background);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

[data-theme="dark"] .load-more-btn:hover {
    background: var(--color-primary);
    color: #ffffff;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .load-more-btn {
        padding: 10px 24px;
        font-size: 0.9rem;
    }
}