/**
 * 额外的样式修复
 * 修复首页和文章页的显示问题
 * 
 * @package MOE_WP
 * @since 2.0.1
 */

/* 修复文章溢出问题 */
.entry,
.post-content,
.comment-content {
    max-width: 100%;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* 修复代码块溢出 */
.entry pre,
.entry code {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.entry pre {
    white-space: pre;
}

/* 修复表格溢出 */
.entry table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* 修复图片居中和适配 */
.post-thumbnail,
.entry .wp-block-image,
.entry figure {
    text-align: center;
    margin: 20px 0;
}

.post-thumbnail img,
.entry .wp-block-image img,
.entry figure img {
    max-width: 100%;
    height: auto;
    display: inline-block;
}

/* 修复视频嵌入 */
.entry iframe,
.entry video,
.entry embed,
.entry object {
    max-width: 100%;
    height: auto;
}

.entry .wp-block-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.entry .wp-block-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 修复长链接溢出 */
.entry a {
    word-break: break-all;
}

/* 修复列表样式 */
.entry ul,
.entry ol {
    padding-left: 30px;
    margin: 15px 0;
}

.entry ul li,
.entry ol li {
    margin: 8px 0;
    line-height: 1.8;
}

.entry ul {
    list-style-type: disc;
}

.entry ol {
    list-style-type: decimal;
}

/* 修复引用块 */
.entry blockquote {
    position: relative;
    padding-left: 20px;
    margin: 20px 0;
    border-left: 4px solid #24a5db;
    background: #f9f9f9;
    padding: 15px 20px;
}

.entry blockquote p:last-child {
    margin-bottom: 0;
}

/* 修复按钮和表单元素 */
.entry button,
.entry input[type="submit"],
.entry input[type="button"] {
    display: inline-block;
    padding: 10px 20px;
    background: #24a5db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.entry button:hover,
.entry input[type="submit"]:hover,
.entry input[type="button"]:hover {
    background: #1a8fbd;
}

/* 修复首页文章列表间距 */
#page .post:first-child {
    margin-top: 0;
}

/* 修复头部对齐 */
#head {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 修复导航菜单下拉 */
.nav > li > ul {
    min-width: 180px;
}

/* 修复侧边栏小工具间距 */
.widget {
    margin-bottom: 30px;
}

.widget:last-child {
    margin-bottom: 0;
}

/* 修复评论表单字段 */
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* 修复搜索框 */
#header-search {
    display: flex;
    align-items: center;
}

#nav_search_s {
    box-sizing: border-box;
}

/* 清除浮动 */
.clearfix::after,
.group::after {
    content: "";
    display: table;
    clear: both;
}

/* 修复粘性导航 */
#topbar.affix {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* 修复返回顶部按钮位置 */
#top {
    position: fixed;
    right: 30px;
    bottom: 30px;
    z-index: 999;
}

/* 响应式修复 */
@media screen and (max-width: 1024px) {
    .container {
        max-width: 100%;
    }
}

@media screen and (max-width: 768px) {
    /* 移动端导航修复 */
    .nav-wrap {
        width: 100%;
    }
    
    .nav > li > ul {
        position: static;
        box-shadow: none;
        background: #f5f5f5;
        padding-left: 15px;
    }
    
    /* 移动端搜索框修复 */
    #header-search {
        width: 100%;
        position: static;
        transform: none;
        padding: 10px 0;
    }
    
    #nav_search_s {
        width: 100%;
    }
    
    /* 移动端文章修复 */
    .post-meta {
        font-size: 13px;
    }
    
    .post-title {
        font-size: 22px;
    }
    
    /* 移动端评论修复 */
    .comment-children {
        margin-left: 10px;
    }
    
    /* 返回顶部按钮 */
    #top {
        right: 15px;
        bottom: 15px;
        width: 45px;
        height: 45px;
        line-height: 45px;
    }
}

@media screen and (max-width: 480px) {
    /* 超小屏幕修复 */
    .post {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .post-title {
        font-size: 18px;
    }
    
    .entry {
        font-size: 14px;
    }
    
    .post-meta li {
        font-size: 12px;
    }
    
    /* 移动端按钮 */
    .more-link,
    .loli {
        font-size: 14px;
        padding: 8px 20px;
    }
    
    /* 移动端头部 */
    #head {
        padding: 30px 0;
    }
    
    .wocao a {
        width: 35px;
        height: 35px;
        line-height: 35px;
        font-size: 16px;
    }
}

/* 打印样式修复 */
@media print {
    #topbar,
    #header-search,
    .nav-toggle,
    #top,
    .comment-reply,
    .share-buttons {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    .post {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* 修复 WordPress 默认类 */
.alignnone {
    margin: 15px 0;
}

.aligncenter {
    display: block;
    margin: 15px auto;
}

.alignleft {
    float: left;
    margin: 10px 20px 10px 0;
}

.alignright {
    float: right;
    margin: 10px 0 10px 20px;
}

/* 修复图片说明 */
.wp-caption {
    max-width: 100%;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
    margin: 15px 0;
}

.wp-caption img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.wp-caption-text {
    font-size: 13px;
    color: #666;
    text-align: center;
    margin-top: 10px;
}

/* 修复画廊 */
.gallery {
    margin: 20px 0;
}

.gallery-item {
    display: inline-block;
    vertical-align: top;
    margin: 5px;
    max-width: 100%;
}

.gallery-icon img {
    max-width: 100%;
    height: auto;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 焦点可见性 */
a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid #24a5db;
    outline-offset: 2px;
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 错误提示 */
.error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c00;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

/* 成功提示 */
.success-message {
    background: #efe;
    border: 1px solid #cfc;
    color: #060;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

