/*
Theme Name: 今日头条
Theme URI: http://web1.lzhai.asia
Description: 仿今日头条新闻资讯主题，支持WordPress 7.0 区块编辑器
Version: 1.0
Author: admin
Text Domain: toutiao
Domain Path: /languages
License: GNU General Public License v2 or later
*/

/* ========== WordPress 适配样式 ========== */

/* 基础重置 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f4f5f5; color: #222; font-size: 14px; line-height: 1.6; }
a { color: #222; text-decoration: none; }
a:hover { color: #f04142; }

/* 头部 */
.toutiao-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 60px; background: #fff; border-bottom: 1px solid #f0f0f0;
    display: flex; align-items: center; padding: 0 60px;
}
.header-bg { display:none; }
.header-left { display: flex; align-items: center; gap: 30px; flex: 1; }
.logo-text { font-size: 22px; font-weight: 700; color: #f04142; }
.logo img { height: 32px; width: auto; }

/* 导航 */
.feed-default-nav { display: flex; gap: 16px; }
.feed-default-nav-item { font-size: 18px; color: #222 !important; padding: 4px 0; border-bottom: 2px solid transparent; text-decoration: none !important; }
.feed-default-nav-item.active { color: #f04142 !important; border-bottom-color: #f04142; }
.feed-default-nav-item:hover { color: #f04142 !important; }

/* 右侧头部 */
.header-right { display: flex; align-items: center; gap: 16px; }
.search-form { display: flex; align-items: center; background: #f4f5f5; border-radius: 4px; overflow: hidden; }
.search-input { border: none; background: transparent; padding: 6px 12px; font-size: 13px; width: 180px; outline: none; }
.search-submit { border: none; background: transparent; padding: 6px 10px; cursor: pointer; }
.header-right .login-button,
.r-content .login-button {
    display: inline-block;
    background: #f04142; color: #fff !important;
    padding: 6px 18px; border-radius: 6px;
    font-size: 14px; font-weight: 500; line-height: 22px;
    text-align: center; white-space: nowrap;
}
.header-right .login-button:hover,
.r-content .login-button:hover { background: #d93030; color: #fff !important; }
.header-right-actions { display: flex; align-items: center; gap: 12px; }
.reg-link {
    color: #222 !important; font-size: 14px; margin-left: 8px;
    display: inline-block; line-height: 1.8;
}
.reg-link:hover { color: #f04142 !important; }
.ttp-header-publisher { font-size: 18px; color: #666; padding: 4px 8px; }
.user-card {
    display: flex; align-items: center; gap: 6px; font-size: 14px;
    cursor: pointer; position: relative;
    padding: 4px 8px; border-radius: 20px;
    transition: background .2s;
}
.user-card:hover { background: #f5f5f5; }
.avatar-default {
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 36px; height: 36px; border-radius: 50%;
    background: #f04142; color: #fff; font-size: 16px; font-weight: 600;
}
.login-info { color: #333; font-weight: 500; }
.dropdown-arrow { color: #999; font-size: 12px; margin-left: -2px; }

/* 主布局 */
.main-content-wrapper {
    margin-top: 60px;
    max-width: 1120px;
    margin-left: auto; margin-right: auto;
    display: flex; gap: 20px; padding: 16px 0;
}
.l-content { flex: 1; min-width: 0; }
.r-content { width: 300px; flex-shrink: 0; }

/* 信息流卡片 */
.feed-list { display: flex; flex-direction: column; gap: 0; }
.feed-card {
    background: #fff; padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}
.feed-card:hover { background: #fafafa; }
.feed-card-content { display: flex; gap: 16px; }
.feed-card-text { flex: 1; min-width: 0; }
.feed-card-title { font-size: 18px; font-weight: 500; line-height: 1.4; margin-bottom: 8px; }
.feed-card-title a:hover { color: #f04142; }
.feed-card-meta { display: flex; gap: 12px; color: #999; font-size: 13px; }
.feed-card-img { flex-shrink: 0; width: 160px; height: 108px; overflow: hidden; border-radius: 4px; }
.feed-card-img img { width: 100%; height: 100%; object-fit: cover; }
.feed-card-footer-cmp { display: flex; gap: 20px; padding-top: 10px; color: #999; font-size: 13px; }

/* 文章详情 */
.article-detail { background: #fff; padding: 24px; }
.article-title { font-size: 26px; font-weight: 700; margin-bottom: 12px; }
.article-meta { display: flex; gap: 16px; color: #999; font-size: 13px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; }
.article-body { font-size: 16px; line-height: 1.8; }
.article-body p { margin-bottom: 16px; }
.article-body img { max-width: 100%; height: auto; border-radius: 4px; }
.article-tags { margin: 20px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.article-tags .tag { background: #f4f5f5; padding: 4px 12px; border-radius: 4px; font-size: 13px; }
.article-footer-cmp { display: flex; gap: 30px; padding: 16px 0; border-top: 1px solid #f0f0f0; color: #666; }

/* 右侧边栏 */
.r-content { display: flex; flex-direction: column; gap: 16px; }
.r-content-card { background: #fff; padding: 16px; border-radius: 4px; }
.r-content-title { font-size: 16px; font-weight: 500; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; }
.user-login-card .login-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.login-card-desc { color: #999; font-size: 13px; }
.hot-list { list-style: none; }
.hot-list li { padding: 8px 0; border-bottom: 1px solid #f8f8f8; font-size: 14px; }
.hot-list li:last-child { border-bottom: none; }

/* 底部分页 */
.feed-pagination { padding: 20px; text-align: center; background: #fff; }
.feed-pagination .page-numbers { display: inline-block; padding: 6px 14px; margin: 0 4px; border: 1px solid #eee; border-radius: 4px; }
.feed-pagination .page-numbers.current { background: #f04142; color: #fff; border-color: #f04142; }

/* 底部 */
.footer-wrapper { background: #fff; border-top: 1px solid #f0f0f0; padding: 20px 0; margin-top: 20px; text-align: center; }
.footer-links { display: flex; gap: 20px; justify-content: center; margin-bottom: 8px; }
.footer-links a { color: #666; font-size: 13px; }
.footer-copy { color: #999; font-size: 12px; }

/* 分类存档 */
.archive-title { background: #fff; padding: 16px 20px; font-size: 20px; font-weight: 500; }

/* 评论 */
.comments-area { background: #fff; padding: 20px; margin-top: 16px; }
.comment-list { list-style: none; }
.comment-list li { padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.comment-form textarea { width: 100%; padding: 10px; border: 1px solid #eee; border-radius: 4px; resize: vertical; }
.comment-form input[type="submit"] { background: #f04142; color: #fff; border: none; padding: 8px 24px; border-radius: 6px; cursor: pointer; margin-top: 8px; }
.comment-form input[type="submit"]:hover { background: #d93030; }

/* 响应式 - 平板 */
@media (max-width: 1024px) {
    .main-content-wrapper { padding: 12px 16px; }
    .toutiao-header { padding: 0 20px; }
    .r-content { width: 260px; }
}

/* 响应式 - 手机 */
@media (max-width: 768px) {
    /* 头部 */
    .toutiao-header {
        padding: 0 12px; height: 48px;
    }
    .header-left { gap: 12px; flex: 1; overflow: hidden; }
    .logo-text { font-size: 18px; }
    .main-nav-wrapper {
        display: none; /* 手机端隐藏导航，可加汉堡菜单 */
    }
    .header-right { gap: 8px; }
    .search-wrapper { display: none; }
    .login-button { padding: 4px 14px; font-size: 13px; line-height: 18px; }
    .reg-link { font-size: 13px; margin-left: 4px; }

    /* 主布局 */
    .main-content-wrapper {
        flex-direction: column; padding: 8px 0; margin-top: 48px;
    }

    /* 信息流 */
    .feed-card { padding: 12px; }
    .feed-card-content { gap: 10px; }
    .feed-card-title { font-size: 15px; line-height: 1.4; }
    .feed-card-meta { font-size: 12px; }
    .feed-card-img { width: 110px; height: 74px; flex-shrink: 0; }
    .feed-card-footer-cmp { font-size: 12px; gap: 12px; padding-top: 8px; }

    /* 侧边栏 */
    .r-content { width: 100%; padding: 0 8px; }
    .r-content-card { margin-bottom: 8px; }

    /* 文章详情 */
    .article-title { font-size: 18px; }
    .article-body { font-size: 15px; }
    .article-meta { font-size: 12px; gap: 10px; flex-wrap: wrap; }

    /* 注册/登录页 */
    .register-card { width: 100%; max-width: 360px; padding: 24px 20px; }
    .register-title { font-size: 20px; margin-bottom: 20px; }
    .register-form input { padding: 10px; font-size: 14px; }
    .register-submit { padding: 10px; font-size: 15px; }

    /* 底部 */
    .footer-wrapper { padding: 16px 0; }
    .footer-links { gap: 12px; flex-wrap: wrap; }

    /* 评论 */
    .comments-area { padding: 12px; }
    .comment-form textarea { font-size: 14px; }

    /* 用户下拉在手机上靠右对齐 */
    .user-dropdown { right: -8px; }
}

/* 用户下拉菜单 */
.user-dropdown {
    display: none;
    position: absolute; top: 100%; right: 0; margin-top: 0;
    background: #fff; border: 1px solid #e8e8e8; border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 120px; z-index: 999;
}
/* 用透明层桥接 hover 间隙，防止鼠标划过时空隙导致下拉消失 */
.user-dropdown::before {
    content: '';
    position: absolute; top: -6px; left: 0; right: 0; height: 6px;
    background: transparent;
}
.user-card:hover .user-dropdown,
.user-dropdown:hover { display: block; }
.user-dropdown a {
    display: block; padding: 10px 16px; font-size: 14px; color: #333;
    border-bottom: 1px solid #f5f5f5; white-space: nowrap; text-decoration: none;
}
.user-dropdown a:last-child { border-bottom: none; }
.user-dropdown a:hover { background: #f8f8f8; color: #f04142; }

/* 注册页面 */
.register-page {
    display: flex; justify-content: center; padding: 60px 20px;
}
.register-card {
    background: #fff; border-radius: 8px; padding: 40px; width: 400px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.register-title { font-size: 22px; text-align: center; margin-bottom: 30px; }
.register-errors { background: #fff3f3; border: 1px solid #ffcaca; border-radius: 4px; padding: 12px; margin-bottom: 16px; }
.register-errors p { color: #d93030; font-size: 13px; margin: 4px 0; }
.register-form .form-group { margin-bottom: 16px; }
.register-form input[type="text"],
.register-form input[type="password"] {
    width: 100%; padding: 12px; border: 1px solid #e0e0e0; border-radius: 4px;
    font-size: 15px; outline: none; transition: border-color .2s;
}
.register-form input:focus { border-color: #f04142; }
.register-submit {
    width: 100%; padding: 12px; background: #f04142; color: #fff;
    border: none; border-radius: 4px; font-size: 16px; cursor: pointer;
    margin-top: 8px;
}
.register-submit:hover { background: #d93030; }
.register-login-link { text-align: center; margin-top: 20px; font-size: 14px; color: #999; }
.register-login-link a { color: #f04142; }
