/* ========================================
   com-detail.css - 详情页公共组件
   ========================================
   包含：
   - 面包屑导航
   - 阅读进度条
   - 错误页
   - 文章详情布局
   - 图片画廊/灯箱（+ 各应用主题色作用域）
   - 详情页按钮（.detail-actions / .detail-btn-*）
   - 详情页侧边栏（.detail-sidebar / .detail-info-*）
   - 详情页主内容区（.detail-section / .detail-section-title / .detail-description）
   - 暗色模式
   - 简介侧边栏（.intro-*）
   - 各应用 border-bottom / 图标主题色作用域

   依赖：variables.css（前置）
   ======================================== */

/* ========================================
   面包屑导航
   ======================================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-white);
    border-radius: 8px;
}
.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb-separator { color: var(--text-placeholder); }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

/* ========================================
   通用阅读进度条
   ======================================== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--border-color);
    z-index: 10001;
}
.reading-progress-bar {
    height: 100%;
    width: 0;
    background: var(--color-news-gradient);
    transition: width 0.1s;
}
body[data-app="news"] .reading-progress-bar {
    background: var(--color-news-gradient);
}
body[data-app="job"] .reading-progress-bar {
    background: var(--color-job-gradient);
}
body[data-app="secondhand"] .reading-progress-bar {
    background: var(--color-secondhand-gradient);
}
body[data-app="house"] .reading-progress-bar {
    background: var(--color-house-gradient);
}
body[data-app="service"] .reading-progress-bar {
    background: var(--color-service-gradient);
}
body[data-app="love"] .reading-progress-bar {
    background: var(--color-love-gradient);
}
body[data-app="event"] .reading-progress-bar {
    background: var(--color-event-gradient);
}

/* ========================================
   错误页面样式
   ======================================== */
.error-page-header {
    text-align: center;
    padding: 200px 20px 40px;
}
.error-page-icon {
    font-size: 120px;
    color: var(--color-primary);
    margin-bottom: 20px;
    animation: error-float 3s ease-in-out infinite;
}
@keyframes error-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}
.error-page-header p {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 15px;
}
.error-page-content {
    text-align: center;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}
.error-message {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.8;
}
.error-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}
.error-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}
.error-btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.error-btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}
.error-btn-secondary {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}
.error-btn-secondary:hover {
    background: var(--color-primary);
    color: #ffffff;
}

/* ========================================
   公共 - 文章详情布局
   各模块详情页可使用 .article-detail-layout 作为根容器
   ======================================== */

/* ========================================
   公共 - 图片画廊与灯箱
   各模块详情页使用 .gallery/.gallery-main/.gallery-thumbs/.thumb 作为基础类
   颜色变量由各模块自定义 --color-xxx-start / --color-xxx-end
   ======================================== */
.gallery {
    margin-bottom: 20px;
    background: var(--bg-white, #fff);
    padding: 15px;
    border-radius: 12px;
}

.gallery-main {
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
    background: var(--bg-secondary, #f8f9fa);
}

.gallery-main img {
    width: 100%;
    height: 450px;
    object-fit: contain;
    display: block;
}

.gallery-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.gallery-thumb {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s;
}

body[data-app="secondhand"] .gallery-thumb:hover,
body[data-app="secondhand"] .gallery-thumb.active {
    border-color: var(--color-secondhand-start);
}
body[data-app="job"] .gallery-thumb:hover,
body[data-app="job"] .gallery-thumb.active {
    border-color: var(--color-job-start);
}
body[data-app="house"] .gallery-thumb:hover,
body[data-app="house"] .gallery-thumb.active {
    border-color: var(--color-house-start);
}
body[data-app="service"] .gallery-thumb:hover,
body[data-app="service"] .gallery-thumb.active {
    border-color: var(--color-service-start);
}
body[data-app="event"] .gallery-thumb:hover,
body[data-app="event"] .gallery-thumb.active {
    border-color: var(--color-event-start);
}
body[data-app="love"] .gallery-thumb:hover,
body[data-app="love"] .gallery-thumb.active {
    border-color: var(--color-love-start);
}

.gallery-thumb img {
    width: 100%;
    height: 80px;
    object-fit: cover;
}

/* 图片灯箱（公共） */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    padding: 10px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.lightbox-close {
    top: -60px;
    right: 0;
    font-size: 36px;
}

.lightbox-prev {
    left: -60px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-info {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
}

/* ========================================
   公共 - 详情页主内容区
   ======================================== */
.detail-section {
    background: var(--bg-white, #fff);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.detail-section-title {
    font-size: 16px;
    color: var(--text-dark, #333);
    border-bottom: thin solid transparent;
    margin-bottom: 16px;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-section-title i {
    color: var(--color-module-start, #667eea);
}

body[data-app="secondhand"] .detail-section-title {
    border-bottom-color: var(--color-secondhand-start);
}
body[data-app="job"] .detail-section-title i {
    color: var(--color-job-start);
}
body[data-app="love"] .detail-section-title {
    border-bottom-color: var(--color-love-start);
}
body[data-app="event"] .detail-section-title i {
    color: var(--color-event-start);
}
body[data-app="service"] .detail-section-title i {
    color: var(--color-service-start);
}
body[data-app="house"] .detail-section-title i {
    color: var(--color-house-start);
}

.detail-description {
    font-size: 14px;
    color: var(--text-secondary, #666);
    line-height: 1.9;
}

/* ========================================
   公共 - dark 模式（图片画廊、灯箱、详情按钮、侧边栏）
   ======================================== */
body.theme-dark .gallery { background: #1e1e1e; }
body.theme-dark .gallery-main { background: #2a2a2a; }

body.theme-dark .gallery-thumb { border-color: #333; }

body.theme-dark .gallery-thumb:hover { border-color: var(--color-module-start); }

body.theme-dark .gallery-thumb.active { border-color: var(--color-module-end); }

body.theme-dark .lightbox { background: rgba(0,0,0,0.95); }

body.theme-dark .detail-section { background: #1e1e1e; }

body.theme-dark .detail-section-title {
    color: #e0e0e0;
    border-bottom-color: var(--border-color);
}

body.theme-dark .detail-description {
    color: #aaa;
}

/* ========================================
   公共 - 左侧"简介"侧边栏（love/event/service/house/secondhand 专用）
   独立命名空间，避免与右侧 .detail-section 冲突
   ======================================== */
.intro-sidebar {
    background: var(--bg-white, #fff);
    border-radius: 12px;
    padding: 24px;
    position: sticky;
    top: 80px;
}

.intro-section {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 20px;
}

.intro-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-light, #f0f0f0);
    font-size: 14px;
}

.intro-info-row:last-child { border-bottom: none; }

.intro-info-label {
    color: var(--text-light, #999);
    display: flex;
    align-items: center;
    gap: 6px;
}

.intro-info-label i {
    color: var(--color-module-start, #667eea);
    width: 14px;
}

.intro-info-value {
    color: var(--text-dark, #333);
    font-weight: 500;
}

.intro-info-highlight {
    color: var(--color-module-end, #764ba2);
    font-weight: bold;
}

.intro-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.intro-actions .intro-btn-primary i.fas { color: var(--text-white) !important; }
.intro-actions .intro-btn-aux i.fas { color: var(--text-secondary) !important; }

.intro-btn-primary {
    width: 100%;
    padding: 14px;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.intro-btn-primary:hover { opacity: 0.9; }

/* 各应用 - 主按钮渐变 */
body[data-app="secondhand"] .intro-btn-primary {
    background: var(--color-secondhand-gradient);
}
body[data-app="job"] .intro-btn-primary {
    background: var(--color-job-gradient);
}
body[data-app="house"] .intro-btn-primary {
    background: var(--color-house-gradient);
}
body[data-app="service"] .intro-btn-primary {
    background: var(--color-service-gradient);
}
body[data-app="love"] .intro-btn-primary {
    background: var(--color-love-gradient);
}
body[data-app="event"] .intro-btn-primary {
    background: var(--color-event-gradient);
}

.intro-btn-row {
    display: flex;
    gap: 10px;
}

.intro-btn-aux {
    flex: 1;
    padding: 10px;
    background: var(--bg-secondary, #f8f9fa);
    color: var(--text-secondary, #666);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.intro-btn-aux:hover {
    color: var(--color-module-start, #667eea);
    border-color: var(--color-module-start, #667eea);
}

.intro-btn-aux:hover i {
    color: var(--color-module-start, #667eea);
}

/* dark 模式（intro-*） */
body.theme-dark .intro-sidebar { background: #1e1e1e; }

body.theme-dark .intro-info-row { border-bottom-color: #333; }

body.theme-dark .intro-info-label { color: #888; }

body.theme-dark .intro-info-value { color: #e0e0e0; }

body.theme-dark .intro-info-highlight { color: var(--color-module-end); }

body.theme-dark .intro-btn-aux {
    background: #2a2a2a;
    border-color: #333;
    color: #ccc;
}

body.theme-dark .intro-btn-aux:hover {
    color: var(--color-module-end);
    border-color: var(--color-module-end);
}

/* ========================================
   详情页 - 各应用 sidebar 信息行 border-bottom 主题色
   ======================================== */
body[data-app="job"] .intro-section i.fas,
body[data-app="job"] .detail-section i.fas {
    color: var(--color-job-start);
}
body[data-app="secondhand"] .intro-section i.fas,
body[data-app="secondhand"] .detail-section i.fas {
    color: var(--color-secondhand-start);
}
body[data-app="house"] .intro-section i.fas,
body[data-app="house"] .detail-section i.fas {
    color: var(--color-house-start);
}
body[data-app="service"] .intro-section i.fas,
body[data-app="service"] .detail-section i.fas {
    color: var(--color-service-start);
}
body[data-app="love"] .intro-section i.fas,
body[data-app="love"] .detail-section i.fas {
    color: var(--color-love-start);
}
body[data-app="event"] .intro-section i.fas,
body[data-app="event"] .detail-section i.fas {
    color: var(--color-event-start);
}

/* 响应式设计（公共） */
@media (max-width: 768px) {
    .gallery-thumbs {
        grid-template-columns: repeat(4, 1fr);
    }
    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }
}

@media (max-width: 480px) {
    .gallery-main img {
        height: 300px;
    }
    .gallery-thumbs {
        grid-template-columns: repeat(4, 1fr);
    }
}