/* 文章编辑系统样式 */

/* 预览区域样式 */
.preview-content {
    white-space: pre-wrap; /* 保持换行和空格 */
    word-wrap: break-word; /* 长单词换行 */
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 确保HTML代码在预览中正确显示 */
.preview-content code {
    background-color: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* 预览区域的段落间距 */
.preview-content p {
    margin-bottom: 1rem;
}

/* 预览区域的标题样式 */
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* 编辑器容器样式 */
.CodeMirror {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
}

/* 响应式布局优化 */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .preview-content {
        font-size: 14px;
    }
}

/* 导航栏品牌对齐 */
.navbar-brand {
    font-weight: 600;
}

/* 按钮组间距 */
.btn-group .btn {
    margin-right: 2px;
}

/* 文章列表样式 */
.table th {
    border-top: none;
    font-weight: 600;
}

/* 状态徽章样式 */
.badge {
    font-size: 0.75em;
}

/* 代码提示样式 */
.CodeMirror-hints {
    position: absolute;
    z-index: 10;
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 2px;
    border-radius: 3px;
    border: 1px solid #ccc;
    background: white;
    font-size: 90%;
    font-family: monospace;
    max-height: 20em;
    overflow-y: auto;
    box-shadow: 2px 3px 5px rgba(0,0,0,.2);
}

.CodeMirror-hint {
    margin: 0;
    padding: 0 4px;
    border-radius: 2px;
    white-space: pre;
    color: black;
    cursor: pointer;
    line-height: 1.4;
}

.CodeMirror-hint-active {
    background: #08f;
    color: white;
}

.CodeMirror-hint-tag {
    color: #d73a49;
    font-weight: bold;
}

.CodeMirror-hint-attr {
    color: #6f42c1;
}

/* 友好的未保存更改模态框样式 */
#unsavedChangesModal .modal-header {
    border-bottom: 1px solid #ffc107;
}

#unsavedChangesModal .btn-group .btn {
    margin: 0 2px;
}

/* 模态框按钮间距 */
#unsavedChangesModal .d-flex.gap-2 {
    gap: 0.5rem !important;
}

/* 编辑器工具栏样式 */
.editor-toolbar {
    padding: 10px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.editor-toolbar .btn {
    margin: 0;
    border-radius: 4px;
}

.editor-toolbar .btn-group {
    margin: 0;
}

.editor-toolbar input[type="color"] {
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.editor-toolbar input[type="color"]:hover {
    border-color: #86b7fe;
}

/* 下拉菜单样式 */
.dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dropdown-item {
    padding: 8px 16px;
    transition: background-color 0.15s ease-in-out;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

/* 表格样式增强 */
.preview-content table {
    margin: 15px 0;
    border-collapse: collapse;
    width: 100%;
    background-color: #fff;
}

.preview-content table th,
.preview-content table td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
}

.preview-content table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.preview-content table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.preview-content table tr:hover {
    background-color: #e9ecef;
}

/* 分割线样式 */
.preview-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, #dee2e6, transparent);
    margin: 20px 0;
}

/* 文字样式增强 */
.preview-content {
    line-height: 1.6;
    font-size: 14px;
}

.preview-content [style*="text-align: center"] {
    text-align: center !important;
}

.preview-content [style*="text-align: right"] {
    text-align: right !important;
}

.preview-content [style*="text-align: justify"] {
    text-align: justify !important;
}

.preview-content [style*="text-align: left"] {
    text-align: left !important;
}

/* 提示框样式 */
.preview-content .alert {
    padding: 12px 16px;
    margin: 15px 0;
    border: 1px solid transparent;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.preview-content .alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.preview-content .alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffecb5;
}

.preview-content .alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.preview-content .alert i {
    margin-top: 2px;
    flex-shrink: 0;
}

/* 待办事项样式 */
.preview-content .todo-item {
    margin: 8px 0;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-content .todo-item input[type="checkbox"] {
    margin: 0;
    cursor: default;
}

.preview-content .todo-item.completed {
    opacity: 0.7;
    text-decoration: line-through;
}

/* 键盘按键样式 */
.preview-content kbd {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2), inset 0 0 0 2px #fff;
    color: #495057;
    display: inline-block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1;
    padding: 2px 4px;
    white-space: nowrap;
}

/* 高亮文本样式 */
.preview-content mark {
    background-color: #fff3cd;
    color: #664d03;
    padding: 2px 4px;
    border-radius: 2px;
}

/* 删除线样式 */
.preview-content del {
    color: #6c757d;
    text-decoration: line-through;
}

/* 代码块增强样式 */
.preview-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin: 15px 0;
}

.preview-content code {
    background-color: #f8f9fa;
    color: #e83e8c;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.preview-content pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
}

/* 引用块样式 */
.preview-content blockquote {
    border-left: 4px solid #dee2e6;
    margin: 15px 0;
    padding: 10px 20px;
    background-color: #f8f9fa;
    color: #6c757d;
    font-style: italic;
}

/* 图片自适应样式 */
.preview-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.preview-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 图片容器样式 */
.preview-content .image-container {
    text-align: center;
    margin: 20px 0;
}

.preview-content .image-container img {
    margin: 0 auto;
}

/* 图片标题样式 */
.preview-content .image-caption {
    font-size: 0.9em;
    color: #6c757d;
    font-style: italic;
    text-align: center;
    margin-top: 8px;
    margin-bottom: 15px;
}

/* 响应式图片优化 */
@media (max-width: 768px) {
    .preview-content img {
        margin: 10px auto;
        border-radius: 4px;
    }
    
    .preview-content .image-caption {
        font-size: 0.85em;
        margin-top: 6px;
        margin-bottom: 12px;
    }
}

/* Toast 通知样式 */
.toast-container {
    z-index: 9999;
}

.toast {
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    margin-bottom: 10px;
    animation: slideInRight 0.3s ease-out;
}

.toast .toast-body {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
}

.toast .btn-close {
    opacity: 0.8;
    transition: opacity 0.2s;
}

.toast .btn-close:hover {
    opacity: 1;
}

.toast.bg-success {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.toast.bg-danger {
    background: linear-gradient(135deg, #dc3545, #e74c3c) !important;
}

.toast.bg-warning {
    background: linear-gradient(135deg, #ffc107, #f39c12) !important;
    color: #212529 !important;
}

.toast.bg-warning .btn-close {
    filter: invert(1);
}

.toast.bg-info {
    background: linear-gradient(135deg, #17a2b8, #3498db) !important;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hide {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 响应式工具栏 */
@media (max-width: 768px) {
    .editor-toolbar {
        padding: 8px;
        gap: 3px;
    }
    
    .editor-toolbar .btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .editor-toolbar input[type="color"] {
        width: 32px;
        height: 28px;
    }
    
    .preview-content .alert {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .preview-content .todo-item {
        font-size: 14px;
    }
    
    .toast {
        min-width: 280px;
        margin: 0 10px 10px 10px;
    }
    
    .toast-container {
        left: 0;
        right: 0;
        padding: 10px;
    }
}