/*
Theme Name: 自媒体资讯主题
Theme URI: https://example.com
Author: 小宇
Author URI: https://example.com
Description: 简洁现代的自媒体资讯主题，支持文章、图片、视频展示，广告位管理，备案信息设置，H5响应式设计
Version: 7.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ddz-media
Tags: responsive,自媒体,资讯,图片,视频
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.8;
    color: #333;
    background: #f5f5f5;
}

/* H5响应式 */
@media screen and (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 10px;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 头部导航 */
.site-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
}

.site-logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.main-nav a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: #007bff;
}

/* 头部用户区域 - 与导航平行 */
.header-user-section {
    display: flex;
    align-items: center;
    margin-left: 30px;
}

/* 登录按钮样式优化 */
.user-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.user-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.user-login-btn .user-icon {
    font-size: 1rem;
}

/* 已登录用户信息 */
.user-logged-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-logged-info .user-avatar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #333;
}

.user-logged-info .user-avatar-link img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-logged-info .user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.user-logout-btn {
    padding: 5px 12px;
    color: #999;
    text-decoration: none;
    font-size: 0.8rem;
    border: 1px solid #eee;
    border-radius: 15px;
    transition: all 0.3s;
}

.user-logout-btn:hover {
    color: #dc3545;
    border-color: #dc3545;
}

@media screen and (max-width: 768px) {
    .header-user-section {
        margin-left: 0;
        margin-top: 15px;
        justify-content: flex-start;
    }
    
    .header-inner {
        flex-wrap: wrap;
    }
    
    .user-login-btn {
        padding: 10px 16px;
    }
}

/* 移动端菜单 */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

@media screen and (max-width: 768px) {
    .main-nav {
        display: none;
    }
    
    .main-nav.active {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        padding: 20px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 15px;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
}

/* 广告位样式 */
.ad-space {
    margin: 20px 0;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-space embed,
.ad-space iframe,
.ad-space img {
    max-width: 100%;
    height: auto;
}

.ad-header { min-height: 60px; }
.ad-sidebar { min-height: 250px; }
.ad-content-top { min-height: 80px; }
.ad-content-bottom { min-height: 80px; }
.ad-footer { min-height: 60px; background: #f9f9f9; }

/* 首页布局 */
.home-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    margin: 30px 0;
}

@media screen and (max-width: 992px) {
    .home-layout {
        grid-template-columns: 1fr;
    }
}

.home-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 自媒体风格 - 焦点文章 */
.featured-posts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media screen and (max-width: 768px) {
    .featured-posts {
        grid-template-columns: 1fr;
    }
}

.featured-post {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.featured-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.featured-post img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.featured-post .post-info {
    padding: 15px;
}

.featured-post .post-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.featured-post .post-title a {
    color: #333;
    text-decoration: none;
}

.featured-post .post-meta {
    font-size: 0.85rem;
    color: #999;
}

/* 文章列表 */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-item {
    display: flex;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.post-item img {
    width: 220px;
    height: 160px;
    object-fit: cover;
}

@media screen and (max-width: 576px) {
    .post-item {
        flex-direction: column;
    }
    
    .post-item img {
        width: 100%;
        height: 200px;
    }
}

.post-item .post-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.post-item .post-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.post-item .post-title a {
    color: #333;
    text-decoration: none;
}

.post-item .post-excerpt {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.post-item .post-meta {
    font-size: 0.85rem;
    color: #999;
}

/* 图片文章卡片 */
.image-posts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

@media screen and (max-width: 992px) {
    .image-posts {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 576px) {
    .image-posts {
        grid-template-columns: repeat(2, 1fr);
    }
}

.image-post-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

.image-post-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-post-card:hover img {
    transform: scale(1.1);
}

.image-post-card .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 40px 15px 15px;
}

.image-post-card .post-title {
    color: #fff;
    font-size: 0.9rem;
    margin: 0;
}

.image-post-card .post-title a {
    color: #fff;
    text-decoration: none;
}

/* 视频文章卡片 */
.video-posts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media screen and (max-width: 768px) {
    .video-posts {
        grid-template-columns: 1fr;
    }
}

.video-post-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.video-post-card .video-cover {
    position: relative;
    aspect-ratio: 16/9;
}

.video-post-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-post-card .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
}

.video-post-card .post-info {
    padding: 15px;
}

.video-post-card .post-title {
    font-size: 1rem;
    margin-bottom: 8px;
}

.video-post-card .post-title a {
    color: #333;
    text-decoration: none;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.widget {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

/* 文章详情页 */
.single-post {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.single-post .post-header {
    margin-bottom: 25px;
}

.single-post .post-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 15px;
    line-height: 1.4;
}

.single-post .post-meta {
    color: #999;
    font-size: 0.9rem;
}

.single-post .post-thumbnail {
    margin-bottom: 25px;
}

.single-post .post-thumbnail img {
    width: 100%;
    border-radius: 8px;
}

.single-post .post-content {
    font-size: 1.05rem;
    line-height: 1.9;
}

.single-post .post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

.single-post .post-content p {
    margin-bottom: 20px;
}

.single-post .post-content h2,
.single-post .post-content h3,
.single-post .post-content h4 {
    margin: 30px 0 15px;
    font-weight: bold;
}

.single-post .post-content a {
    color: #007bff;
    text-decoration: underline;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 40px 0;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 15px;
    background: #fff;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.pagination a:hover,
.pagination .current {
    background: #007bff;
    color: #fff;
}

/* 页脚 */
.site-footer {
    background: #2c3e50;
    color: #fff;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: #bbb;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: #fff;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #999;
    font-size: 0.9rem;
}

.footer-beian {
    margin-top: 10px;
}

.footer-beian a {
    color: #999;
    text-decoration: none;
}

/* 焦点样式（可访问性） */
a:focus,
button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* H5移动端广告位 */
.mobile-ad {
    margin: 15px 0;
}

/* 移动端插屏广告 */
.ad-interstitial {
    margin: 20px 0;
    text-align: center;
    min-height: 250px;
    background: #f9f9f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media screen and (max-width: 768px) {
    .ad-interstitial {
        min-height: 200px;
    }
}

/* 移动端悬浮广告 */
.mobile-float-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    text-align: center;
    background: #fff;
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.mobile-float-ad img {
    max-width: 100%;
    max-height: 50px;
}

@media (min-width: 769px) {
    .mobile-ad,
    .mobile-float-ad,
    .ad-interstitial {
        display: none;
    }
}

/* 模态框 */
.ddz-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s;
}

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

.ddz-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.ddz-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 40px 30px;
    transition: transform 0.3s;
}

.ddz-modal.active .ddz-modal-content {
    transform: translate(-50%, -50%) scale(1);
}

.ddz-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    transition: background 0.3s;
}

.ddz-modal-close:hover {
    background: #eee;
}

.ddz-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.ddz-modal-header h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.ddz-modal-header p {
    color: #999;
}

/* 表单样式 */
.ddz-auth-form .ddz-form-group {
    margin-bottom: 20px;
}

.ddz-auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.ddz-auth-form input[type="text"],
.ddz-auth-form input[type="email"],
.ddz-auth-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.ddz-auth-form input:focus {
    outline: none;
    border-color: #007bff;
}

.ddz-remember {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ddz-remember label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
}

.ddz-forgot {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9rem;
}

.ddz-btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s;
}

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

.ddz-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ddz-form-message {
    margin-top: 15px;
    text-align: center;
    font-size: 0.9rem;
}

.ddz-form-message .success {
    color: #28a745;
}

.ddz-form-message .error {
    color: #dc3545;
}

/* 分割线 */
.ddz-auth-divider {
    text-align: center;
    margin: 25px 0;
    position: relative;
}

.ddz-auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #eee;
}

.ddz-auth-divider span {
    background: #fff;
    padding: 0 15px;
    color: #999;
    position: relative;
}

/* 切换登录/注册 */
.ddz-auth-switch {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.ddz-auth-switch a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

/* 社交登录 */
.ddz-social-login {
    margin-top: 25px;
    text-align: center;
}

.ddz-social-login p {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.ddz-social-btns {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.ddz-social-btn {
    padding: 10px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
}

.ddz-social-btn.qq {
    background: #12B7F5;
    color: #fff;
}

.ddz-social-btn.wechat {
    background: #07C160;
    color: #fff;
}

@media (max-width: 480px) {
    .ddz-modal-content {
        padding: 30px 20px;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #ddd;
    }
    .site-header,
    .featured-post,
    .post-item,
    .widget,
    .single-post,
    .video-post-card {
        background: #2d2d2d;
    }
    .post-title a,
    .featured-post .post-title a,
    .video-post-card .post-title a {
        color: #fff;
    }
    .post-excerpt,
    .post-item .post-excerpt {
        color: #aaa;
    }
    .site-footer {
        background: #1a1a1a;
    }
    .footer-section a {
        color: #999;
    }
    .pagination a,
    .pagination span {
        background: #2d2d2d;
        color: #ddd;
    }
    .ad-footer {
        background: #2d2d2d;
    }
}

/* 打印样式 */
@media print {
    .site-header,
    .site-footer,
    .sidebar,
    .ad-space,
    .mobile-menu-toggle {
        display: none !important;
    }
    body {
        background: #fff;
        color: #000;
    }
    .single-post,
    .post-item {
        box-shadow: none;
        border: 1px solid #eee;
    }
}

/* 清除浮动 */
.clearfix::after {
    content: "";
    display: block;
    clear: both;
}