/* Glassmorphism and general styles */
.glassmorphism {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

/* 使用统计模块样式 */
#usageCount, #todayUsage, #popularFormat, #averageProcessingTime {
    font-size: 1.25rem;
    font-weight: bold;
}

#usageCount {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#todayUsage {
    color: #10b981;
}

#popularFormat {
    color: #8b5cf6;
}

#averageProcessingTime {
    color: #f59e0b;
}

#averageRating {
    color: #ef4444;
}

/* 新增工具栏样式 */
#markdown-toolbar {
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem 0.5rem 0 0;
    background-color: #f9fafb;
    border-bottom: none;
    transition: all 0.3s ease;
}

#markdown-toolbar:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), 0 1px 10px rgba(99, 102, 241, 0.1);
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #4b5563;
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 0.25rem;
}

.toolbar-btn:hover {
    background-color: #e5e7eb;
    color: #1f2937;
}

.toolbar-btn:focus {
    outline: 2px solid #6366f1;
    outline-offset: 1px;
}

.toolbar button {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.toolbar button:hover {
    background: rgba(255, 255, 255, 0.7);
}

#uploadBtn {
    background: linear-gradient(45deg, #5a5cf5, #a488e7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 响应式设计 - 在小屏幕上调整工具栏按钮大小 */
@media (max-width: 640px) {
    .toolbar-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* 星星评分样式 */
.star {
    transition: color 0.2s ease;
}

.star:hover {
    transform: scale(1.2);
}

.dropzone {
    border: 2px dashed #d1d5db;
    transition: all 0.3s ease;
}

.dropzone.active {
    border-color: #6366f1;
    background-color: #eef2ff;
}

/* 在PC端增加输入区域和预览区域的高度 */
@media (min-width: 1024px) {
    .dropzone {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    #markdownInput {
        flex: 1;
        min-height: 500px;
        resize: none;
    }
    
    .preview-content {
        flex: 1;
        min-height: 500px;
        overflow-y: auto;
    }
}

.preview-content {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: white;
    padding: 1rem;
    overflow-y: auto;
    max-height: 60vh;
}

/* 添加光标同步时的高亮样式 */
.highlight-section {
    background-color: #ffff99;
    transition: background-color 0.3s ease;
    animation: highlight-fade 2s ease-out;
}

@keyframes highlight-fade {
    0% { background-color: #ffff00; }
    100% { background-color: transparent; }
}

.btn-primary {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    color: white;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.highlight-text {
    position: relative;
    display: inline-block;
    padding-left: 10px;
}

.highlight-text {
    background: linear-gradient(45deg, #6366f1, #f65cdc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 添加图片加载状态样式 */
.markdown-image.loading {
    opacity: 0.5;
}

/* 添加图片错误处理样式 */
.markdown-image.error {
    display: none;
}

/* 确保图片容器有适当的样式 */
.preview-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0.5rem 0;
    border-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Markdown 样式 */
.markdown-header {
    font-weight: bold;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #1f2937;
}

.markdown-header:first-child {
    margin-top: 0;
}

h1.markdown-header {
    font-size: 2.25rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    margin-top: 0;
}

h2.markdown-header {
    font-size: 1.875rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

h3.markdown-header {
    font-size: 1.5rem;
    color: #2d3748;
}

h4.markdown-header {
    font-size: 1.25rem;
    color: #4a5568;
}

h5.markdown-header {
    font-size: 1.125rem;
    color: #4a5568;
}

h6.markdown-header {
    font-size: 1rem;
    color: #718096;
}

.markdown-paragraph {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #374151;
}

.markdown-list {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

ul.markdown-list {
    list-style-type: disc;
}

ul.markdown-list ul {
    list-style-type: circle;
}

ul.markdown-list ul ul {
    list-style-type: square;
}

ol.markdown-list {
    list-style-type: decimal;
}

ol.markdown-list ol {
    list-style-type: lower-alpha;
}

ol.markdown-list ol ol {
    list-style-type: lower-roman;
}

.markdown-code {
    background-color: #f7fafc;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875rem;
    color: #e53e3e;
}

.markdown-pre {
    background-color: #f9fafb;
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-pre .markdown-code {
    background-color: transparent;
    padding: 0;
    color: inherit;
    font-size: 0.875rem;
}

.markdown-blockquote {
    border-left: 4px solid #d1d5db;
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1rem;
    color: #4b5563;
}

.markdown-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0; /* 添加表格边框 */
}

.markdown-table th,
.markdown-table td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    text-align: left;
}

.markdown-table th {
    background-color: #f9fafb;
    font-weight: 600;
}

.markdown-table tr:nth-child(even) {
    background-color: #fdfdfd;
}

.markdown-table-header {
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    text-align: left;
    background-color: #f9fafb;
    font-weight: 600;
}

.markdown-table-cell {
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    text-align: left;
}

/* 增强表格边框样式 */
.markdown-table th,
.markdown-table td,
.markdown-table-header,
.markdown-table-cell {
    border-width: 1px;
    border-style: solid;
    border-color: #e2e8f0;
}

.markdown-table {
    border-width: 2px;
    border-style: solid;
    border-color: #e2e8f0;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 为HTML原生表格添加样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

table th,
table td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    text-align: left;
}

table th {
    background-color: #f9fafb;
    font-weight: 600;
}

table tr:nth-child(even) {
    background-color: #fdfdfd;
}

.markdown-link {
    color: #6366f1;
    text-decoration: underline;
}

.markdown-link:hover {
    color: #4f46e5;
}

/* 添加自动换行样式 */
body {
    word-wrap: break-word;
    word-break: break-word;
}

* {
    box-sizing: border-box;
}

/* 为预览区域和所有Markdown元素添加换行样式 */
.preview-content {
    word-wrap: break-word;
    word-break: break-word;
}

.markdown-header {
    word-wrap: break-word;
    word-break: break-word;
}

.markdown-paragraph {
    word-wrap: break-word;
    word-break: break-word;
}

.markdown-list {
    word-wrap: break-word;
    word-break: break-word;
}

.markdown-code {
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
}

.markdown-pre {
    word-wrap: break-word;
    word-break: break-word;
    overflow-x: auto;
}

.markdown-table {
    table-layout: fixed;
    word-wrap: break-word;
}

.markdown-table th,
.markdown-table td {
    word-wrap: break-word;
    word-break: break-word;
}

img {
    max-width: 100%;
    height: auto;
}

.markdown-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0.5rem 0;
    border-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 优化markdownInput的样式，使其更加大气 */
#markdownInput {
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-top: none;
}

#markdownInput:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.15), 0 1px 10px rgba(147, 197, 253, 0.1);
    background-color: #ffffff;
}

/* Log area styles with scroll */
#logArea {
    line-height: 1.5; /* 设置行高 */
}

#logContent {
    max-height: calc(1.5em * 2); /* 精确控制为2行高度 */
    overflow-y: auto;
    line-height: 1.5; /* 保持一致的行高 */
}

/* 系统菜单按钮样式 */
.system-menu-btn {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.system-menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.12);
}

.system-menu-btn:active {
    transform: scale(0.95);
}

/* 系统菜单样式 */
.system-menu {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: auto;
    min-width: 100px; /* 设置最小宽度 */
    border-radius: 10px;
    background-color: white;
    overflow: hidden;
}

.system-menu.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.system-menu button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 15px;
    text-align: left;
    font-size: 14px;
    border-radius: 5px;
    margin: 5px;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
}

.system-menu button:hover {
    background-color: #f5f5f5;
}

.system-menu button i {
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 模态框样式 */
#reviewModal {
    transition: opacity 0.3s ease;
}

#reviewModal:not(.hidden) {
    display: block;
}

.modal-overlay {
    transition: opacity 0.3s ease;
}

/* 评价模态框样式优化 */
.modal-container {
    width: 90%;
    max-width: 600px; /* 增加最大宽度，使模态框更加大气 */
    margin: 0 auto;
    border-radius: 16px; /* 增加圆角 */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* 增强阴影效果 */
}

.modal-content {
    padding: 1.75rem; /* 增加内边距 */
}

.modal-content .text-2xl {
    font-size: 1.875rem; /* 增大标题字体 */
    line-height: 2.25rem;
    color: #1f2937; /* 使用更深的标题颜色 */
}

#modalReviewComment {
    font-size: 1rem;
    padding: 1rem; /* 增加输入框内边距 */
    border-radius: 10px; /* 增加输入框圆角 */
    min-height: 140px; /* 增加输入框最小高度 */
    transition: all 0.2s ease; /* 添加过渡效果 */
    border-width: 2px; /* 增加边框宽度 */
}

#modalReviewComment:focus {
    border-color: #6366f1; /* 更改焦点边框颜色 */
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2); /* 添加焦点阴影 */
}

/* 星级评分样式 */
#modalRatingStars .star {
    transition: all 0.2s ease;
    margin-right: 0.25rem;
}

#modalRatingStars .star:last-child {
    margin-right: 0;
}

#modalRatingStars .star:hover {
    transform: scale(1.15);
}

#modalRatingText {
    font-size: 1.125rem;
    font-weight: 600;
}

/* 优化按钮样式 */
#submitReviewModalBtn, #cancelReviewModalBtn {
    padding: 0.625rem 1.5rem; /* 增加按钮内边距 */
    font-size: 1rem; /* 增大按钮字体 */
    font-weight: 500;
    border-radius: 10px; /* 增加按钮圆角 */
    transition: all 0.3s ease; /* 添加过渡效果 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* 添加按钮阴影 */
}

#submitReviewModalBtn {
    background-color: #10b981; /* 使用更现代的绿色 */
    color: white;
}

#submitReviewModalBtn:hover:not(:disabled) {
    background-color: #059669; /* 悬停时加深颜色 */
    transform: translateY(-2px); /* 添加上移效果 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* 增强阴影 */
}

#submitReviewModalBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

#cancelReviewModalBtn {
    background-color: #f3f4f6; /* 使用更现代的灰色 */
    color: #374151;
}

#cancelReviewModalBtn:hover {
    background-color: #e5e7eb; /* 悬停时加深颜色 */
    transform: translateY(-2px); /* 添加上移效果 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* 增强阴影 */
}

/* 在较大屏幕上进一步增加宽度 */
@media (min-width: 768px) {
    .modal-container {
        width: 80%;
        max-width: 700px;
    }
}

@media (min-width: 1024px) {
    .modal-container {
        width: 70%;
        max-width: 800px;
    }
    
    .modal-content {
        padding: 2.5rem; /* 在大屏幕上增加更多内边距 */
    }
    
    .modal-content .text-2xl {
        font-size: 2.25rem;
        line-height: 2.5rem;
    }
}