/* 办公系统专用样式 */
#word-processor, #spreadsheet {
    padding: 0;
}

.toolbar {
    background-color: #FFD700; /* 金黄色背景 */
    border-bottom: 1px solid #FFC000; /* 稍深的金黄色边框 */
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-right: 1px solid #FFC000; /* 稍深的金黄色边框 */
    background-color: #FFEA00; /* 浅金黄色背景 */
    border-radius: 4px;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar button, .toolbar select {
    padding: 8px 12px;
    border: 1px solid #FFC000; /* 稍深的金黄色边框 */
    background-color: #FFF176; /* 柔和的金黄色背景 */
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    color: #000; /* 黑色文字 */
}

.toolbar button:hover {
    background-color: #FFD700; /* 金黄色 */
    border-color: #FFA000; /* 更深的金黄色边框 */
}

.toolbar button.active {
    background-color: #FFC107; /* 金黄色 */
    color: #000; /* 黑色文字以确保可读性 */
    border-color: #FFA000; /* 更深的金黄色边框 */
}

.toolbar select:focus,
.toolbar button:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25); /* 金黄色焦点框 */
}

.dropdown-menu {
    position: absolute;
    background-color: #FFF176; /* 柔和的金黄色背景 */
    border: 1px solid #FFC000; /* 稍深的金黄色边框 */
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
    flex-direction: column;
    min-width: 150px;
}

.dropdown-menu button {
    width: 100%;
    text-align: left;
    border: none;
    border-radius: 0;
    padding: 10px 15px;
    background-color: transparent;
    color: #000; /* 黑色文字 */
}

.dropdown-menu button:hover {
    background-color: #FFD700; /* 金黄色 */
}

/* 金黄色标签样式 */
nav ul {
    display: flex;
    list-style: none;
    background-color: #FFD700; /* 金黄色背景 */
    padding: 0;
    margin: 0;
}

nav ul li {
    flex: 1;
}

nav ul li a {
    display: block;
    padding: 1rem;
    text-align: center;
    text-decoration: none;
    color: #000; /* 黑色文字 */
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

nav ul li a:hover,
nav ul li a.active {
    background-color: #FFC107; /* 金黄色 */
    border-bottom: 3px solid #000; /* 黑色边框 */
}

.document-area {
    height: calc(100vh - 250px);
    overflow: auto;
    padding: 20px;
    border: 1px solid #FFC000; /* 稍深的金黄色边框 */
    margin: 10px;
    background-color: white;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
}

#document-editor {
    min-height: 100%;
    outline: none;
    font-family: "SimSun", serif;
    font-size: 16px;
    line-height: 1.6;
}

#document-editor:focus {
    outline: none;
}

/* 文档编辑器中的元素样式 */
#document-editor p {
    margin: 0 0 1em 0;
}

#document-editor .text-bold {
    font-weight: bold;
}

#document-editor .text-italic {
    font-style: italic;
}

#document-editor .text-underline {
    text-decoration: underline;
}

#document-editor .align-left {
    text-align: left;
}

#document-editor .align-center {
    text-align: center;
}

#document-editor .align-right {
    text-align: right;
}

#document-editor .align-justify {
    text-align: justify;
}

/* 插入的元素样式 */
.inserted-element {
    position: absolute;
    border: 2px dashed #FFD700; /* 金黄色虚线边框 */
    cursor: move;
    resize: both;
    overflow: auto;
    box-sizing: border-box;
}

.inserted-element:hover {
    border-color: #FFC107; /* 悬停时金黄色 */
}

.inserted-element.selected {
    border-color: #FFA000; /* 选中时更深的金黄色 */
    box-shadow: 0 0 0 2px rgba(255, 160, 0, 0.25);
}

.inserted-table {
    border-collapse: collapse;
    width: auto;
    background-color: white;
}

.inserted-table td, .inserted-table th {
    border: 1px solid #FFD700; /* 金黄色边框 */
    padding: 8px;
}

.inserted-table th {
    background-color: #FFF176; /* 柔和的金黄色背景 */
    font-weight: bold;
}

.inserted-image {
    max-width: 100%;
    height: auto;
    display: block;
}

.inserted-textbox {
    min-width: 100px;
    min-height: 50px;
    padding: 10px;
    background-color: white;
    border: 1px solid #FFD700; /* 金黄色边框 */
    box-sizing: border-box;
}

.inserted-textbox:focus {
    outline: 2px solid #FFC107; /* 金黄色焦点框 */
    border-color: #FFC107;
}

.inserted-shape {
    background-color: #FFF176; /* 柔和的金黄色背景 */
    user-select: none;
}

.inserted-cover {
    text-align: center;
    padding: 20px;
    border: 1px solid #FFD700; /* 金黄色边框 */
    margin: 20px 0;
    background-color: #FFF176; /* 柔和的金黄色背景 */
    user-select: none;
}

.inserted-cover h1 {
    font-size: 2em;
    margin: 0.5em 0;
    color: #000; /* 黑色文字 */
}

.inserted-cover p {
    margin: 0.5em 0;
    color: #000; /* 黑色文字 */
}

.inserted-wordart {
    font-family: "Arial Black", sans-serif;
    font-size: 24px;
    text-align: center;
    padding: 10px;
    color: #000; /* 黑色文字 */
    user-select: none;
    background-color: #FFF176; /* 柔和的金黄色背景 */
    border: 1px solid #FFD700; /* 金黄色边框 */
}

/* 电子表格样式 */
.spreadsheet-area {
    height: calc(100vh - 250px);
    overflow: auto;
    padding: 20px;
    margin: 10px;
    background-color: white;
    border: 1px solid #FFD700; /* 金黄色边框 */
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
}

#spreadsheet-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

#spreadsheet-table th, #spreadsheet-table td {
    border: 1px solid #FFD700; /* 金黄色边框 */
    padding: 8px;
    text-align: left;
}

#spreadsheet-table th {
    background-color: #FFF176; /* 柔和的金黄色背景 */
    position: sticky;
    top: 0;
    font-weight: bold;
    color: #000; /* 黑色文字 */
}

#spreadsheet-table td:focus {
    outline: 2px solid #FFC107; /* 金黄色焦点框 */
    background-color: #FFF9C4; /* 浅金黄色背景 */
}

#spreadsheet-table th:first-child {
    width: 40px;
    text-align: center;
}

#spreadsheet-table td[contenteditable]:focus {
    outline: 2px solid #FFC107; /* 金黄色焦点框 */
    background-color: #FFF9C4; /* 浅金黄色背景 */
}

/* 文档处理和电子表格标签样式 */
#word-processor h2, #spreadsheet h2 {
    color: #000; /* 黑色文字 */
    background-color: #FFD700; /* 金黄色背景 */
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid #FFC000; /* 稍深的金黄色边框 */
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-group {
        flex-wrap: wrap;
        justify-content: center;
        border-right: none;
        border-bottom: 1px solid #FFC000; /* 稍深的金黄色边框 */
        padding: 10px;
    }
    
    .toolbar-group:last-child {
        border-bottom: none;
    }
    
    .document-area {
        height: calc(100vh - 350px);
        margin: 5px;
        padding: 10px;
    }
    
    .spreadsheet-area {
        height: calc(100vh - 350px);
        margin: 5px;
        padding: 10px;
    }
    
    .toolbar button, .toolbar select {
        padding: 6px 8px;
        font-size: 13px;
    }
    
    #document-editor {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .toolbar-group {
        width: 100%;
    }
    
    .document-area {
        height: calc(100vh - 400px);
    }
    
    .spreadsheet-area {
        height: calc(100vh - 400px);
    }
    
    #document-editor {
        font-size: 12px;
    }
    
    .inserted-cover h1 {
        font-size: 1.5em;
    }
    
    nav ul li a {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}