/*
Theme Name: 丸子资讯
Theme URI: https://aihack.cn/
Author: 丸子团队
Author URI: https://aihack.cn/
Description: wordpress资讯主题
Version: 1.1.5
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wanzicms
Tags: custom-theme, basic
*/ 

/* 评论图片上传预览样式 */
.comment-images-preview {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.image-preview-item {
    position: relative;
    padding: 0.5rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.image-preview-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.image-preview-item img {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
    border-radius: 0.25rem;
}

.remove-image {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 1.25rem;
    height: 1.25rem;
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.remove-image:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}

/* 评论图片样式 */
.comment-content img.comment-image {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 0.75rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.comment-content img.comment-image:hover {
    transform: scale(1.02);
}

/* 评论表单布局 */
.comment-form {
    position: relative;
}

.comment-form .form-submit {
    position: absolute;
    right: 0;
    top: 0;
    margin-top: 0;
    z-index: 10;
}

/* 评论提交按钮 */
#submit {
    padding: 0.5rem 1.25rem;
    background-color: #165DFF;
    color: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 评论表单提交区域 Flexbox 布局修复 */
.comment-form .form-submit {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem; /* 在按钮和图标之间添加一些间距 */
}

#submit:hover {
    background-color: rgba(22, 93, 255, 0.9);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 响应式调整 */
@media (max-width: 640px) {
    .comment-form .form-submit {
        position: relative;
        margin-top: 1rem;
        display: flex;
        justify-content: flex-end;
    }
}

/* 表情面板样式 */
#emoji-panel {
    position: absolute;
    z-index: 100;
    max-width: 300px;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-height: 300px;
    overflow-y: auto;
}

#emoji-panel .grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.25rem;
}

#emoji-panel button {
    width: 2rem;
    height: 2rem;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: transparent;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

#emoji-panel button:hover {
    background-color: #f3f4f6;
}

/* 评论回复框样式 */
.comment-respond-form {
    position: relative;
    width: 100%;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.comment-respond-form.hidden {
    display: none;
}

/* 确保回复框不会跑位 */
#comments-container .comment-respond-form {
    left: 0 !important;
    right: 0 !important;
    position: relative !important;
    transform: none !important;
}

/* 修复WordPress默认回复链接行为 */
.comment-reply-link {
    cursor: pointer;
} 

.system-message {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.system-message-title {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: bold;
}

.system-message-content {
    font-size: 1em;
} 

.comment-form-comment textarea {
    height: 10em;
    font-size: 1em;
}

body.mobile-menu-open {
    overflow: hidden;
}

#mobile-menu {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
}

/* 移动端菜单样式 - 完全重写 */
/* --- 新移动端菜单样式 --- */
.mobile-nav-menu,
.mobile-nav-menu .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-menu li {
    margin-bottom: 4px;
}

.mobile-nav-menu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: #374151; /* text-gray-700 */
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
}

.mobile-nav-menu a:hover,
.mobile-nav-menu a:focus {
    background-color: #f3f4f6; /* bg-gray-100 */
    color: #165DFF; /* primary color */
}

/* 有子菜单的链接 */
.mobile-nav-menu .menu-item-has-children > a::after {
    content: '\f107'; /* Corrected from double backslash to single backslash */
    font-family: 'FontAwesome';
    font-size: 14px;
    transition: transform 0.3s ease;
}

/* 子菜单展开时的箭头 */
.mobile-nav-menu .menu-item-has-children.is-open > a::after {
    transform: rotate(180deg);
}

/* 子菜单默认隐藏 */
.mobile-nav-menu .sub-menu {
    display: none;
    padding: 8px 0 8px 16px; /* 左侧缩进 */
    margin-top: 4px;
    background-color: #f9fafb; /* bg-gray-50 */
    border-radius: 8px;
}

/* 子菜单项链接 */
.mobile-nav-menu .sub-menu a {
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 桌面端导航二级菜单样式 */
@media (min-width: 768px) {
    .menu-item-has-children {
        position: relative;
    }
    
    .menu-item-has-children > a {
        cursor: pointer;
    }
    
    .menu-item-has-children .sub-menu {
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 100;
        min-width: 200px;
        background-color: white;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        border-radius: 6px;
        transition: opacity 0.3s ease, transform 0.3s ease;
        transform: translateY(10px);
        opacity: 0;
        pointer-events: none;
        padding: 8px 0;
        margin-top: 5px;
    }
    
    .menu-item-has-children.is-open > a .submenu-toggle {
        transform: rotate(180deg);
    }
    
    .menu-item-has-children .submenu-toggle {
        transition: transform 0.3s;
    }
    
    .sub-menu .menu-item {
        display: block;
        width: 100%;
    }
    
    .sub-menu .menu-item a {
        display: block;
        padding: 8px 16px;
        white-space: nowrap;
        color: #374151; /* text-gray-700 */
        font-size: 0.95rem;
        font-weight: normal;
    }
    
    .sub-menu .menu-item a:hover {
        background-color: #f3f4f6; /* bg-gray-100 */
        color: #165DFF;
    }
} 

/* 文章头部移动端优化 */
@media (max-width: 640px) {
  .prose-custom h1,
  .single-post .prose-custom h1 {
    font-size: 1.25rem;
    line-height: 1.4;
    word-break: break-all;
  }
}

/* 侧边栏移动端优化 */
@media (max-width: 1023px) {
  .w-full.lg\:w-1\/4 {
    width: 100% !important;
    margin-top: 2rem !important;
    order: 2 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box;
  }
}
@media (min-width: 1024px) {
  .w-full.lg\:w-1\/4 {
    width: 25% !important;
    margin-top: 0 !important;
    order: unset !important;
  }
}

/* 文章编辑功能样式 */
.post-edit-actions {
    position: relative;
}

.post-edit-actions .edit-button {
    transition: all 0.2s ease;
}

.post-edit-actions .edit-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.post-edit-actions .delete-button:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.post-actions-menu {
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.post-actions-menu a,
.post-actions-menu button {
    transition: background-color 0.15s ease;
}

.post-actions-menu a:hover,
.post-actions-menu button:hover {
    background-color: #f3f4f6;
}

/* 通知样式 */
#post-notification {
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

#post-notification .fa-times {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

#post-notification .fa-times:hover {
    opacity: 1;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .title-edit-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .title-edit-container h1 {
        margin-bottom: 0.5rem;
    }

    .title-edit-container .edit-actions {
        justify-content: flex-start;
        margin-top: 0;
        flex-wrap: wrap;
    }

    .post-edit-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .post-edit-actions .edit-button,
    .post-edit-actions .delete-button {
        flex: 1;
        min-width: auto;
        justify-content: center;
    }

    .post-actions-menu {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 300px;
        z-index: 1000;
    }
}

@media (max-width: 480px) {
    .title-edit-container .edit-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .post-edit-actions .edit-button,
    .post-edit-actions .delete-button {
        width: 100%;
        justify-content: center;
    }

    .title-edit-container h1 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        line-height: 1.3;
    }
}

/* 文章标题区域布局优化 */
.article-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.article-title {
    flex: 1;
    min-width: 0; /* 允许标题收缩 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.article-actions {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.25rem; /* 轻微向下偏移，与标题基线对齐 */
}

/* 标题和编辑按钮的容器 */
.title-edit-container {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.title-edit-container h1 {
    flex: 1;
    min-width: 0;
    margin: 0;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.title-edit-container .edit-actions {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.125rem;
}

/* 加载状态样式 */
.loading-button {
    opacity: 0.7;
    cursor: not-allowed;
}

.loading-button .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 编辑按钮组样式 */
.edit-button-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.edit-button-group .btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: 1px solid;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.edit-button-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.edit-button-group .btn-primary {
    background-color: #dbeafe;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.edit-button-group .btn-primary:hover {
    background-color: #bfdbfe;
    color: #1e40af;
}

.edit-button-group .btn-danger {
    background-color: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

.edit-button-group .btn-danger:hover {
    background-color: #fecaca;
    color: #b91c1c;
}

.edit-button-group .btn-secondary {
    background-color: #f3f4f6;
    border-color: #d1d5db;
    color: #4b5563;
}

.edit-button-group .btn-secondary:hover {
    background-color: #e5e7eb;
    color: #374151;
}

/* 确保编辑按钮不会影响标题布局 */
.post-edit-actions {
    align-self: flex-start;
}

.post-edit-actions > * {
    flex-shrink: 0;
}

/* 防止长标题影响按钮位置 */
.title-edit-container h1 {
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* 确保按钮在所有情况下都保持合适的大小 */
.post-edit-actions a,
.post-edit-actions button {
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}