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

/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f7;
    min-height: 100vh;
    padding: 20px;
}

/* 应用容器 */
.app-container {
    max-width: 90%;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
}

/* 编辑器头部 */
.editor-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.editor-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
}

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.export-group {
    display: flex;
    gap: 6px;
}

/* 工具按钮 */
.tool-btn {
    background-color: #f5f5f7;
    color: #333;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

/* 文档按钮样式修正 */
.toolbar a.tool-btn {
    text-decoration: none;
}

/* 移动端响应式调整 */
/* 移动端全屏显示优化 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .app-container {
        max-width: 100%;
        border-radius: 0;
        height: 100vh;
        box-shadow: none;
        margin: 0;
    }
}

@media (max-width: 600px) {
    .editor-header {
        flex-direction: column;
        align-items: center;
        padding: 12px;
    }

    .toolbar {
        width: 100%;
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }

    .tool-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }

    .export-group {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .export-group .tool-btn {
        width: 100%;
    }
}

.tool-btn:hover {
    background-color: #e5e5ea;
}

.tool-btn:active {
    background-color: #d4d4d8;
}

/* 编辑器主体 */
.editor-main {
    flex: 1;
    padding: 16px;
    overflow: auto;
    background-color: #fff;
}

/* 编辑区 */
#editor {
    width: 100%;
    min-height: 100px;
    border: none;
    resize: none;
    overflow: auto;
    font-family: 'SF Mono', Menlo, Monaco, 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.6;
    color: #1d1d1f;
    background-color: transparent;
    padding: 0;
    outline: none;
}

/* 编辑器底部 */
.editor-footer {
    padding: 14px 24px;
    border-top: 1px solid #f0f0f0;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#status {
    font-size: 14px;
    color: #666;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #1d1d1f;
}

.modal-body {
    padding: 20px;
}

#filename-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 12px;
}

#filename-input:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.2);
}

.help-text {
    font-size: 14px;
    color: #666;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

#cancel-rename {
    background-color: #f5f5f7;
    color: #333;
    border: none;
}

#cancel-rename:hover {
    background-color: #e5e5ea;
}

#confirm-rename {
    background-color: #0071e3;
    color: white;
    border: none;
}

#confirm-rename:hover {
    background-color: #0066cc;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .toolbar {
        width: 100%;
        flex-wrap: wrap;
    }

    .export-group {
        flex: 1;
        min-width: 180px;
    }

    .tool-btn {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .app-container {
        max-width: 100%;
        border-radius: 0;
        height: 100vh;
        box-shadow: none;
        margin: 0;
    }

    .editor-header, .editor-main, .editor-footer {
        padding: 12px 16px;
    }

    .toolbar {
        flex-direction: column;
        gap: 8px;
    }

    .export-group {
        width: 100%;
    }
}