body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background-color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

h1 {
    margin: 0;
    font-size: 24px;
    color: #333;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

footer {
    background-color: transparent;
    padding: 10px 0;
    text-align: center;
    box-shadow: none;
    border: none;
    position: relative;
    width: 80%;
    margin: 0 auto;
    color: #666;
    font-size: 14px;
    transition: padding-left 0.3s, width 0.3s;
}

body:has(.container:has(main.with-sidebar)) footer {
    transform: translateX(270px);
}

.container:has(main.with-sidebar) ~ footer {
    transform: translateX(270px);
}

footer p {
    margin: 0;
    text-align: center;
}

footer .footnote {
    margin-top: 10px;
    font-size: 12px;
    color: #999;
    text-align: center;
}

footer .footnote a {
    color: #333;
    text-decoration: none;
}

footer .footnote a:hover {
    text-decoration: underline;
}

.container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0 20px;
    position: relative;
}

aside {
    width: 300px;
    background-color: #f5f5f5;
    border-right: 1px solid #eee;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    position: fixed;
    left: 20px;
    top: 57px;
    bottom: 20px;
    z-index: 10;
    border-radius: 4px;
    transition: transform 0.3s;
    padding: 0 20px;
}

aside.hidden {
    display: none;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow-y: auto;
    padding: 0;
    background-color: transparent;
    position: relative;
    z-index: 1;
    transition: all 0.3s;
}

main.with-sidebar {
    padding-left: 340px;
    width: calc(100% - 340px);
}

.textarea-wrapper {
    position: relative;
    width: 80%;
    height: calc(100vh - 250px);
    min-height: 300px;
    margin: 20px auto;
    background-color: transparent;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    box-sizing: border-box;
}

textarea {
    width: 100%;
    height: 100%;
    padding: 20px;
    font-size: 18px;
    border: 1px solid #ccc; /* Add a light border */
    border-radius: 4px; /* Add rounded corners */
    resize: none;
    outline: none;
    box-shadow: none; /* Remove the inset shadow */
    box-sizing: border-box; /* Ensure padding is included in the height */
}

#copy-button, #share-x-button, #clear-button {
    position: absolute;
    bottom: 10px;
    padding: 5px 5px;
    font-size: 14px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    color: #007bff;
    transition: color 0.3s;
    text-align: center;
    white-space: nowrap; /* Prevent text wrapping */
}

#copy-button {
    right: 190px; /* Adjusted position */
    width: 40px; /* Smaller width for icon-only button */
}

#share-x-button {
    right: 75px; /* Adjusted position */
    width: 110px; /* Increased width to fit "Share on X" */
    font-size: 13px; /* Slightly smaller font size to fit better */
}

#clear-button {
    right: 10px; /* Adjusted position */
    width: 60px; /* Width for "Reset" */
}

#copy-button:hover, #share-x-button:hover, #clear-button:hover {
    color: #0056b3;
}

@media (max-width: 768px) {
    #copy-button, #share-x-button, #clear-button {
        bottom: 5px;
        font-size: 12px;
        padding: 3px 3px;
    }
    #copy-button {
        right: 160px; /* Adjusted for mobile */
        width: 30px; /* Smaller width for icon-only button on mobile */
    }
    #share-x-button {
        right: 58px; /* Adjusted for mobile */
        width: 100px; /* Slightly wider for mobile */
        font-size: 11px; /* Even smaller font size for mobile */
    }
    #clear-button {
        right: 6px; /* Adjusted for mobile */
        width: 50px; /* Slightly smaller width on mobile */
    }
}

/* Remove these styles as they're no longer needed */
/* #save-button {
    bottom: 40px;
    right: -80px;
    width: auto;
    border-radius: 4px;
} */

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    aside {
        width: 100%;
        max-height: 300px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-buttons {
        margin-top: 10px;
    }

    textarea {
        width: 90%;
        height: 70vh;
    }

    .textarea-container {
        width: 90%;
        height: 70vh;
    }

    .textarea-wrapper {
        width: 90%;
        height: calc(100vh - 220px); /* Adjust for mobile */
        margin-bottom: 10px; /* Reduce bottom margin for mobile */
    }

    #copy-button {
        right: 10px;
        bottom: 10px;
    }

    .container {
        margin-bottom: 60px; /* Increase bottom margin for mobile */
    }
}

button {
    padding: 8px 16px;
    cursor: pointer;
    background-color: transparent;
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

button:hover {
    background-color: #f5f5f5;
}

#toggle-history, #new-draft {
    font-size: 14px;
}

#delete-all {
    color: #dc3545;
}

#delete-all:hover {
    background-color: #fff1f1;
}

li {
    margin-bottom: 10px;
    padding: 10px;
    background-color: #fff;
    border-radius: 6px;
    border: 1px solid #eee;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

li:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.draft-preview {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draft-timestamp {
    font-size: 12px;
    color: #777;
    margin-bottom: 10px;
}

.draft-item-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.draft-item-buttons button {
    flex: 1;
    margin: 0 5px;
    padding: 5px 10px;
    font-size: 14px;
}

ul {
    list-style-type: none;
    padding: 0;
}

li {
    margin-bottom: 10px;
    padding: 10px;
    background-color: #fff;
    border-radius: 6px;
    border: 1px solid #eee;
    transition: all 0.2s;
}

li:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    aside {
        width: 100%;
        max-height: 300px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-buttons {
        margin-top: 10px;
    }

    textarea {
        width: 90%;
        height: 70vh;
    }

    .textarea-container {
        width: 90%;
        height: 70vh;
    }

    .textarea-wrapper {
        width: 90%;
        height: calc(100vh - 220px); /* Adjust for mobile */
        margin-bottom: 10px; /* Reduce bottom margin for mobile */
    }

    #copy-button {
        right: 10px;
        bottom: 10px;
    }

    .container {
        margin-bottom: 60px; /* Increase bottom margin for mobile */
    }
}

#settings-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #000;
    padding: 5px;
    margin-left: 10px;
    transition: color 0.3s, transform 0.3s;
}

#settings-button:hover {
    color: #333;
    transform: rotate(15deg);
}

#settings-button:active {
    transform: rotate(30deg);
}

#settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    width: 400px;
    max-width: 90%;
    padding: 25px;
}

#settings-panel.hidden {
    display: none;
}

#settings-panel h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

#close-settings {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #777;
}

.setting-group {
    margin-bottom: 25px;
    padding: 0 10px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

.setting-group input[type="range"],
.setting-group input[type="color"],
.setting-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-top: 5px;
}

.setting-group input[type="color"] {
    height: 40px;
    padding: 2px;
}

#restore-defaults {
    width: 100%;
    padding: 10px;
    background-color: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#restore-defaults:hover {
    background-color: #e0e0e0;
}

#sample-text-container {
    margin-top: 25px;
    padding: 15px;
    border-top: 1px solid #eee;
}

#sample-text-container p {
    margin-bottom: 5px;
    color: #555;
}

#sample-text {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-height: 60px;
    margin-top: 10px;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 300px;
    width: 100%;
}

.modal.hidden {
    display: none;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.button-group button {
    padding: 8px 20px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.button-group button:hover {
    background-color: #0056b3;
}

#confirm-no {
    background-color: #6c757d;
}

#confirm-no:hover {
    background-color: #545b62;
}

.tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(51, 51, 51, 0.9);
    border-radius: 6px;
    font-size: 14px;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    z-index: 1000;
    text-align: center;
    min-width: 200px;
}

.tooltip.show {
    opacity: 1;
}

.tooltip.hidden {
    display: none;
}

.title-icon {
    width: 32px; /* Adjust size as needed */
    height: 32px;
    margin-right: 10px; /* Space between icon and text */
}

#draft-area {
    width: 100%;
    height: 100%;
    min-height: 300px; /* 确保最小高度 */
    padding: 20px;
    font-size: 24px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow-y: auto;
    outline: none;
    box-sizing: border-box;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 1;
    display: block; /* 确保显示为块级元素 */
}

/* Add this new rule for the placeholder */
#draft-area[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: #888;
    font-style: italic;
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: none;
    z-index: 0;
}

/* Add this new rule for the bottom button container */
.button-container {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
    z-index: 2;
}

/* Add this new rule for the button styles */
#copy-button,
#share-x-button,
#clear-button {
    position: absolute;
    bottom: 10px;
    padding: 5px 10px;
    font-size: 14px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    color: #333;
    font-size: 13px;
    transition: all 0.2s;
    z-index: 2;
}

#copy-button:hover,
#share-x-button:hover,
#clear-button:hover {
    background-color: #f5f5f5;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* Add this new rule for the empty state */
#draft-area.empty {
    background-color: #fff;
}

/* Add this new rule to ensure the editor is visible when there's content */
#draft-area:not(:empty) {
    background-color: #fff;
}

/* Add this new rule for the mobile device adaptation */
@media (max-width: 768px) {
    .textarea-wrapper {
        width: 90%;
        height: calc(100vh - 220px);
    }

    #draft-area {
        font-size: 18px;
        padding: 15px;
    }

    #copy-button,
    #share-x-button,
    #clear-button {
        font-size: 12px;
        padding: 3px 8px;
    }

    #copy-button {
        right: 160px;
    }

    #share-x-button {
        right: 60px;
    }

    #clear-button {
        right: 5px;
    }
}

#tabs-container {
    width: 80%;
    margin: 10px auto;
    overflow-y: auto;
    max-height: 100px;
    position: relative;
    z-index: 11;
    transition: all 0.3s;
}

#tabs-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0;
}

.draft-tab {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #eee;
    border-radius: 6px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(20% - 5px);
    min-width: 100px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.draft-tab.active {
    background: #e0e0e0;
    color: #333;
    border: 1px solid #ddd;
    border-bottom: 1px solid #ddd; /* 移除下划线样式 */
}

.draft-tab:hover {
    background: #e8e8e8;
}

.draft-tab.active:hover {
    background: #d8d8d8;
}

/* 移除之前的下划线相关样式 */
.draft-tab.active::after {
    display: none;
}

.draft-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.draft-tab-close {
    color: inherit;
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    font-size: 14px;
}

.draft-tab-close:hover {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
}

/* 当历史区域隐藏时，标签容器恢复宽 */
aside.hidden + main #tabs-container {
    width: 80%;
    margin: 10px auto;
}

/* 当史区域显示时的标签容器样式 */
main.with-sidebar #tabs-container {
    width: 80%;
    margin-left: 10%;
    margin-right: 10%;
    overflow-y: auto;
    max-height: 100px;
    position: relative;
    z-index: 11;
}

/* 当历史区域显时的编辑区域包装样式 */
main.with-sidebar .textarea-wrapper {
    width: 80%;
    height: calc(100vh - 250px);
    margin: 20px auto;
    background-color: transparent;
    display: flex;
    flex-direction: column;
}

/* 标包装器样式 */
#tabs-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0;
}

/* 当历史区域隐藏时的标签容器样式 */
aside.hidden + main #tabs-container {
    width: 80%;
    margin: 10px auto;
}

/* 修改主内容区域样式 */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow-y: auto;
    padding: 0;
    background-color: transparent;
    position: relative;
    z-index: 1;
    transition: all 0.3s;
}

/* 修改标签容器样式 */
#tabs-container {
    width: 80%;
    margin: 10px auto;
    overflow-y: auto;
    max-height: 100px;
    position: relative;
    z-index: 11;
    transition: all 0.3s;
}

/* 编辑区域装器样式 */
.textarea-wrapper {
    position: relative;
    width: 80%;
    height: calc(100vh - 250px);
    margin: 20px auto;
    background-color: transparent;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    box-sizing: border-box;
}

/* 当历史区域显示时的主内容区域样式 */
main.with-sidebar {
    padding-left: 270px;
    width: calc(100% - 270px);
}

/* 当历史域显示时的签容器和编辑区域样式 */
main.with-sidebar #tabs-container,
main.with-sidebar .textarea-wrapper {
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}

/* 标签包装器样式 */
#tabs-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0;
}

/* 添加关闭所有标签页按钮样式 */
#close-all-tabs {
    color: #000;
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s ease;
}

#close-all-tabs:hover {
    color: #333;
}

#close-all-tabs.hidden {
    display: none;
}

.rename-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: inherit;
    outline: none;
    box-sizing: border-box;
}

.rename-input:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.draft-item-buttons button {
    flex: 1;
    margin: 0 5px;
    padding: 5px 10px;
    font-size: 14px;
}

/* 修改标签标题样式 */
.draft-tab.active .draft-tab-title {
    cursor: text; /* 当前标签的标题显示文本输入光标 */
}

.draft-tab:not(.active) .draft-tab-title {
    cursor: pointer; /* 非当前标签的标题显示指针光 */
}

/* 标签中的重命名输入框样式 */
.draft-tab .rename-input {
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    width: 100%;
    padding: 0;
    margin: 0;
    font-size: inherit;
}

.draft-tab.active .rename-input {
    border-bottom: 1px solid currentColor;
}

/* 修改 footer 样式 */
footer {
    width: 80%;
    margin: 0 auto;
    padding: 10px 0;
    text-align: center;
    color: #666;
    font-size: 14px;
    transition: all 0.3s;
    position: relative;
}

/* 当历史区域显示时的 footer 样式 */
main.with-sidebar + footer {
    padding-left: 340px;
    width: calc(100% - 340px);
}

/* 当历史区域显示时的 footer 内容容器 */
main.with-sidebar + footer > p,
main.with-sidebar + footer > .footnote {
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    left: -170px;
}

footer a {
    color: #333;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 更新历史文档中的删除按钮样式 */
.draft-item-buttons button:last-child {
    color: #dc3545;
}

.draft-item-buttons button:last-child:hover {
    background-color: #fff1f1;
}

/* 添加草稿列表标题栏样式 */
.drafts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 15px;
}

.drafts-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600; /* 改为更粗的字重 */
    color: #333;
}

/* 调整删除按钮样式以配合标题 */
#delete-all {
    padding: 4px 8px;
    font-size: 13px;
}

/* 修改确认对话框的内容样式 */
#custom-confirm .modal-content {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px; /* 增加最大宽度 */
    width: 90%;
    padding: 30px 40px; /* 增加内边距，左右边距更大 */
}

#custom-confirm #confirm-message {
    margin: 0 0 25px 0;
    line-height: 1.5;
    font-size: 16px;
    color: #333;
}

#custom-confirm .button-group {
    display: flex;
    justify-content: center;
    gap: 15px; /* 增加按钮之间的间距 */
    margin-top: 25px; /* 增加与消息文本的距离 */
}

#custom-confirm .button-group button {
    padding: 10px 25px; /* 增加按钮内边距 */
    min-width: 100px; /* 设置按钮最小宽度 */
    font-size: 15px;
}