<?php
// 这个文件是CSS文件，不需要PHP标签
header('Content-Type: text/css');
?>
/* 前台样式 */

/* 全局样式 */
body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%; /* 禁止iOS自动调整字体大小 */
}

/* 文章内容区域 */
.content {
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
    white-space: normal;
    font-size: 1.1rem;
    line-height: 1.8;
}

.content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.content p {
    margin-bottom: 1.5rem;
}

.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
    margin: 2rem 0 1rem;
    font-weight: 600;
}

.content a {
    color: #007bff;
    text-decoration: none;
}

.content a:hover {
    text-decoration: underline;
}

.content blockquote {
    border-left: 4px solid #007bff;
    background-color: #f8f9fa;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

.content table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.content table th,
.content table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

.content table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
}

.content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

/* 语音播放控件 */
.audio-controls {
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.audio-controls button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
}

.audio-controls button:hover:not(:disabled) {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.audio-controls button:disabled {
    background: rgba(255,255,255,0.1);
    cursor: not-allowed;
    opacity: 0.5;
}

/* 分享按钮 */
.share-buttons {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.share-btn {
    transition: all 0.3s;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.share-btn.weibo:hover {
    background: #e6162d !important;
}

.share-btn.qzone:hover {
    background: #ffce00 !important;
    color: #333 !important;
}

.share-btn.toutiao:hover {
    background: #ff6a00 !important;
}

/* 评论区域 */
.comments {
    margin: 40px 0;
}

.comment {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 3px solid #007bff;
}

.comment strong {
    color: #007bff;
    font-size: 1.1rem;
}

.comment small {
    color: #6c757d;
    margin-left: 10px;
}

.comment p {
    margin: 10px 0 0;
    line-height: 1.6;
}

/* 密码保护页面 */
.password-protect {
    max-width: 500px;
    margin: 50px auto;
    padding: 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

.password-protect h2 {
    margin-bottom: 20px;
    color: #333;
}

.password-protect .error {
    color: #dc3545;
    margin: 10px 0;
    padding: 10px;
    background: #f8d7da;
    border-radius: 5px;
}

.password-protect input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.password-protect button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.password-protect button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* 文章卡片 */
.card {
    transition: all 0.3s;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

/* 分页 */
.pagination {
    margin: 30px 0;
}

.pagination .page-link {
    border: none;
    margin: 0 5px;
    border-radius: 8px;
    color: #007bff;
    transition: all 0.3s;
}

.pagination .page-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .comment, .password-protect {
    animation: fadeIn 0.5s ease;
}

/* 确保footer始终在底部 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
    width: 100%;
    margin-top: auto !important;
}

/* 修复可能的空白 */
.container-fluid, .container {
    padding-left: 15px;
    padding-right: 15px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* 确保背景色填满 */
.bg-dark {
    background-color: #343a40 !important;
}

/* 友情链接样式 */
footer .list-unstyled li a:hover {
    color: white !important;
    text-decoration: underline !important;
}

footer img {
    transition: transform 0.3s;
}

footer img:hover {
    transform: scale(1.1);
}

/* 社交图标 */
footer .fab {
    transition: all 0.3s;
}

footer .fab:hover {
    transform: translateY(-3px);
    color: white;
}

/* ========== 手机端自适应优化（针对所有移动设备）========== */

/* 超小屏幕（手机，小于576px） */
@media (max-width: 575.98px) {
    /* 全局字体调整 */
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    /* 容器内边距 */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    /* 卡片样式优化 */
    .card {
        border-radius: 10px;
        margin-bottom: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* 文章内容 */
    .content {
        font-size: 15px;
        line-height: 1.7;
    }
    
    .content img {
        border-radius: 8px;
        margin: 10px auto;
    }
    
    /* 导航栏优化 */
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-nav {
        padding: 10px 0;
    }
    
    .nav-link {
        padding: 8px 15px;
        border-radius: 8px;
    }
    
    /* 搜索栏 */
    .search-bar-section {
        margin: 15px 0;
    }
    
    .search-bar-input {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .search-bar-btn {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    /* 热门文章轮播 */
    .hot-carousel-section {
        max-width: 100%;
        margin-bottom: 20px;
    }
    
    .hot-carousel {
        height: 250px;
    }
    
    .carousel-caption h3 {
        font-size: 0.9rem;
    }
    
    /* 最新文章网格 */
    .latest-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }
    
    .latest-post-item {
        padding: 5px;
    }
    
    .latest-post-thumb {
        width: 30px;
        height: 30px;
    }
    
    .latest-post-title {
        font-size: 0.75rem;
    }
    
    /* 文章页面 */
    .post-navigation .nav-link {
        padding: 10px;
    }
    
    .post-navigation .nav-title {
        font-size: 0.85rem;
    }
    
    .share-buttons .btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    /* 评论区域 */
    .comment {
        padding: 12px;
    }
    
    .comment strong {
        font-size: 0.95rem;
    }
    
    .comment small {
        font-size: 0.75rem;
    }
    
    /* 分页 */
    .pagination .page-link {
        padding: 5px 10px;
        font-size: 0.85rem;
    }
    
    /* 底部 */
    footer {
        font-size: 0.85rem;
    }
    
    footer h5 {
        font-size: 1rem;
    }
    
    /* 语音播放控件 */
    .audio-controls {
        flex-direction: column;
    }
    
    .audio-controls button {
        width: 100%;
        margin-bottom: 5px;
    }
    
    /* 密码保护页面 */
    .password-protect {
        margin: 20px;
        padding: 20px;
    }
    
    .password-protect h2 {
        font-size: 1.5rem;
    }
}

/* 小屏幕（手机横屏/小平板，576px及以上） */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        max-width: 540px;
    }
    
    .latest-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hot-carousel {
        height: 280px;
    }
}

/* 中等屏幕（平板，768px及以上） */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }
    
    .hot-carousel {
        height: 300px;
    }
    
    .latest-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 大屏幕（桌面，992px及以上） */
@media (min-width: 992px) {
    .hot-carousel {
        height: 320px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增大点击区域 */
    .nav-link,
    .btn,
    .page-link,
    .post-item,
    .category-card {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* 移除悬停效果（触摸设备不需要） */
    .card:hover,
    .post-item:hover,
    .btn:hover {
        transform: none;
    }
    
    /* 增大表单元素 */
    input,
    select,
    textarea,
    button {
        font-size: 16px !important;
    }
}

/* 深色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    /* 如果您的网站支持深色模式，可以在这里添加样式 */
}

/* ========== 新增：取消分类卡片文章标题下划线 ========== */
.category-card .post-item .post-title,
.category-card .post-item a,
.category-card .post-item a.post-title,
.category-card .post-list .post-item .post-title,
.category-card .post-list .post-item a {
    text-decoration: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.category-card .post-item:hover .post-title,
.category-card .post-item:hover a,
.category-card .post-item:hover a.post-title,
.category-card .post-list .post-item:hover .post-title,
.category-card .post-list .post-item:hover a {
    text-decoration: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* 最新文章区域 */
.latest-post-item .latest-post-title,
.latest-post-item a,
.latest-posts-grid .latest-post-item .latest-post-title,
.latest-posts-grid .latest-post-item a {
    text-decoration: none !important;
    border-bottom: none !important;
}

.latest-post-item:hover .latest-post-title,
.latest-post-item:hover a {
    text-decoration: none !important;
}

/* 全局文章链接样式 */
a.post-title,
a.latest-post-title,
.post-item a,
.category-card a,
.latest-post-item a,
.post-list a,
[class*="post"] a,
[class*="Post"] a,
[class*="title"] a,
a[class*="post"],
a[class*="Post"],
a[class*="title"] {
    text-decoration: none !important;
    border-bottom: none !important;
}

/* 所有链接悬停状态 */
a:hover,
.post-item a:hover,
.category-card a:hover,
.latest-post-item a:hover,
[class*="post"] a:hover,
[class*="title"] a:hover {
    text-decoration: none !important;
}

/* 特别针对可能的下划线样式 */
u, ins {
    text-decoration: none !important;
}

/* 标题本身 */
.post-title,
.latest-post-title,
.card-title,
.entry-title,
.article-title {
    text-decoration: none !important;
    border-bottom: none !important;
}

/* ========== 手机端分类卡片优化（针对所有移动设备，特别是苹果）========== */
@media only screen and (max-width: 576px) {
    /* 分类网格强制单列 */
    .categories-grid {
        display: block !important;
        width: 100% !important;
    }

    /* 分类卡片 */
    .category-card {
        display: block !important;
        width: 100% !important;
        margin-bottom: 15px !important;
        padding: 12px !important;
        border-radius: 8px !important;
        background: #fff !important;
        box-sizing: border-box !important;
    }

    /* 卡片头部 */
    .category-card .card-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 8px !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
    }

    /* 分类标题 */
    .category-card .card-header h3 {
        font-size: 1rem !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .category-card .card-header h3 i {
        font-size: 0.9rem !important;
        margin-right: 4px !important;
    }

    .category-card .card-header h3 a {
        display: flex !important;
        align-items: center !important;
        text-decoration: none !important;
    }

    /* “全部”按钮 */
    .category-card .view-all-badge {
        font-size: 0.7rem !important;
        padding: 3px 8px !important;
        border-radius: 12px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        margin-left: 8px !important;
    }

    /* 文章列表 */
    .post-list {
        width: 100% !important;
    }

    /* 文章列表项 */
    .post-item {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        padding: 6px 4px !important;
        margin-bottom: 4px !important;
        border-radius: 6px !important;
        background: #f8f9fa !important;
        box-sizing: border-box !important;
    }

    /* 缩略图 */
    .post-thumb {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        margin-right: 8px !important;
        border-radius: 4px !important;
        object-fit: cover !important;
    }

    /* 文章标题 */
    .post-title {
        font-size: 0.85rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        color: #333 !important;
        line-height: 1.3 !important;
        text-decoration: none !important;
        flex: 1 !important;
    }

    /* 暂无文章提示 */
    .category-card p.text-muted {
        font-size: 0.85rem !important;
        padding: 8px 0 !important;
        margin: 0 !important;
        text-align: center !important;
        color: #6c757d !important;
    }

    /* 卡片之间的分隔线 */
    .category-card {
        border-bottom: 1px solid #e0e0e0 !important;
        padding-bottom: 15px !important;
    }

    .category-card:last-child {
        border-bottom: none !important;
    }

    /* 确保网格容器宽度正确 */
    .categories-section {
        width: 100% !important;
        padding: 0 10px !important;
        box-sizing: border-box !important;
    }
}

/* 针对iOS设备的特别修复 */
@supports (-webkit-touch-callout: none) {
    /* iOS专用样式 */
    .category-card {
        -webkit-transform: translateZ(0); /* 强制硬件加速 */
    }
    
    .post-item {
        -webkit-transform: translateZ(0);
    }
    
    .post-thumb {
        -webkit-transform: translateZ(0);
    }
}