/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    height: 100vh;
    overflow: hidden;
}

/* 容器 */
.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部标题 */
header {
    background-color: #fff;
    border-bottom: 1px solid #e1e4e8;
    padding: 1rem 2rem;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* 控制面板 */
.control-panel {
    background-color: #fff;
    border-bottom: 1px solid #e1e4e8;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-panel-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.note-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.note-selector label {
    font-weight: 500;
    color: #333;
}

.note-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5da;
    background-color: #fff;
    font-size: 0.875rem;
    min-width: 200px;
    cursor: pointer;
}

.note-selector select:focus {
    outline: none;
    border-color: #333;
}

/* 笔记信息显示 */
.note-info {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

.note-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.date-label {
    font-weight: 500;
    color: #333;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-buttons button {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5da;
    background-color: #fff;
    color: #333;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.action-buttons button:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.action-buttons button:active {
    background-color: #e5e5e5;
}

/* 主要内容区域 */
.content-area {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* 编辑区域 */
.editor-section {
    flex: 1;
    padding: 1rem;
    border-right: 1px solid #e1e4e8;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.editor-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e1e4e8;
}

#markdownEditor {
    flex: 1;
    width: 100%;
    padding: 1rem;
    border: 1px solid #d1d5da;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    background-color: #fafbfc;
    overflow-y: auto;
    min-height: 0;
}

#markdownEditor:focus {
    border-color: #333;
}

#markdownEditor::placeholder {
    color: #999;
}

/* 预览区域 */
.preview-section {
    flex: 1;
    padding: 1rem;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.preview-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e1e4e8;
}

.preview-content {
    flex: 1;
    padding: 1rem;
    border: 1px solid #d1d5da;
    background-color: #fafbfc;
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.6;
    min-height: 0;
}

/* Markdown 内容样式 */
.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;
    line-height: 1.25;
    color: #333;
}

.preview-content h1 {
    font-size: 2rem;
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 0.3rem;
}

.preview-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 0.3rem;
}

.preview-content h3 {
    font-size: 1.25rem;
}

.preview-content p {
    margin-bottom: 1rem;
}

.preview-content ul,
.preview-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.preview-content li {
    margin-bottom: 0.25rem;
}

.preview-content blockquote {
    margin: 1rem 0;
    padding: 0 1rem;
    color: #666;
    border-left: 0.25rem solid #ccc;
}

.preview-content code {
    padding: 0.2rem 0.4rem;
    margin: 0;
    font-size: 85%;
    background-color: #f0f0f0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.preview-content pre {
    padding: 1rem;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f0f0f0;
    margin-bottom: 1rem;
}

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

.preview-content table {
    border-collapse: collapse;
    margin-bottom: 1rem;
    width: 100%;
}

.preview-content th,
.preview-content td {
    padding: 0.5rem;
    border: 1px solid #d1d5da;
    text-align: left;
}

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

.preview-content a {
    color: #333;
    text-decoration: underline;
}

.preview-content a:hover {
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .control-panel {
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .control-panel-top {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .note-selector {
        justify-content: center;
    }
    
    .note-selector select {
        min-width: auto;
    }
    
    .note-info {
        text-align: center;
        justify-content: center;
        gap: 1rem;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .content-area {
        flex-direction: column;
        min-height: 0;
    }
    
    .editor-section {
        border-right: none;
        border-bottom: 1px solid #e1e4e8;
        flex: 1;
        min-height: 0;
    }
    
    .preview-section {
        flex: 1;
        min-height: 0;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
    }
    
    /* 移动端提示框调整 */
    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast-content {
        min-width: auto;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        width: 100%;
    }
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    border: 1px solid #d1d5da;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #d1d5da;
    background-color: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.modal-body input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5da;
    font-size: 1rem;
    box-sizing: border-box;
}

.modal-body input:focus {
    outline: none;
    border-color: #333;
}

.modal-body input::placeholder {
    color: #999;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #d1d5da;
    background-color: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-footer button {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5da;
    background-color: #fff;
    color: #333;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 80px;
}

.modal-footer button:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.modal-footer button:active {
    background-color: #e5e5e5;
}

#confirmNewNote {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

#confirmNewNote:hover {
    background-color: #555;
    border-color: #555;
}

/* 删除确认对话框样式 */
#deleteNoteModal .modal-body p {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
}

#currentNoteTitle {
    font-weight: 600;
    color: #333;
}

.warning-text {
    color: #dc3545 !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    margin-bottom: 0 !important;
}

#confirmDeleteNote {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

#confirmDeleteNote:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* 操作提示框样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.toast-content {
    background-color: #fff;
    color: #333;
    padding: 1rem 1.5rem;
    border: 1px solid #d1d5da;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 200px;
}

.toast-icon {
    font-size: 1.25rem;
    font-weight: bold;
    flex-shrink: 0;
    color: #333;
}

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
    flex: 1;
    color: #333;
}

/* 错误提示框样式 */
.error-toast .toast-content {
    background-color: #fff;
    color: #333;
    border: 1px solid #d1d5da;
}

.error-toast .toast-icon {
    color: #333;
}

/* 背景模糊效果 */
body.modal-open {
    overflow: hidden;
}

body.modal-open .container {
    filter: blur(3px);
    pointer-events: none;
}
