* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    padding: 10px;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    margin: 0 auto;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 固定两列布局 */
    gap: 15px;
    min-height: calc(100vh - 40px);
    width: 100%;
    align-items: start;
}

.module {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
    min-height: 400px;
    overflow: auto;
    position: relative;
    transition: all 0.3s ease; /* 添加过渡效果 */
}

/* 大模块鼠标悬停效果 - 排除标题栏 */
.module:not(.module-full-width):hover {
    background-color: #e2e5e9; /* 浅灰色背景 */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); /* 加深阴影 */
    transform: translateY(-2px); /* 轻微上浮效果 */
}

.module-full-width {
    grid-column: 1 / -1;
    min-height: auto;
    resize: none;
}

.title-module {
    text-align: center;
    padding: 10px;
    min-height: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    /* 移除所有过渡效果 */
    transition: none;
}

/* 标题栏悬停时保持原样 */
.title-module:hover {
    background-color: white; /* 保持白色背景 */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 保持原有阴影 */
    transform: none; /* 不移位 */
}

.title-text {
    font-size: 1.8em;
    margin: 0;
    color: #333;
    flex: 1;
    text-align: center;
    font-weight: 600;
}

.title-actions {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.editable {
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.editable:hover {
    background-color: #f0f0f0;
}

/* 统一按钮大小和彩色样式 */
.add-module-btn,
.add-item-btn,
.delete-module-btn,
#add-todo-item,
#save-edit,
#cancel-edit {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

/* 小模块操作按钮 - 改为浅灰色 */
.item-action {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    background-color: #f9f9f9 !important; /* 浅灰色背景 */
    color: #e2e7eb !important; /* 灰色文字 */
}

.item-action:hover {
    #background-color: #dee2e6 !important; /* 悬停时稍深一点的灰色 */
    color: #495057 !important;
}

/* 彩色按钮样式 */
.add-module-btn {
    #background-color: #28a745;
    color: white;
}

.add-module-btn:hover {
    background-color: #218838;
}

.add-item-btn {
    #background-color: #17a2b8;
	background-color: transparent !important; /* 透明背景 */
    color: #e2e7eb;
}

.add-item-btn:hover {
    background-color: #138496;
	color: #000;
}

.delete-module-btn {
    #background-color: #dc3545;
	background-color: transparent !important; /* 透明背景 */
    color: #e2e7eb;
}

.delete-module-btn:hover {
    #background-color: #c82333;
	color: #000;
}

/* 模态框按钮 */
#add-todo-item,
#save-edit,
#cancel-edit {
    width: auto;
    height: auto;
    padding: 8px 16px;
}

#add-todo-item {
    background-color: #17a2b8;
    color: white;
}

#add-todo-item:hover {
    background-color: #138496;
}

#save-edit {
    background-color: #28a745;
    color: white;
}

#save-edit:hover {
    background-color: #218838;
}

#cancel-edit {
    background-color: #6c757d;
    color: white;
}

#cancel-edit:hover {
    background-color: #5a6268;
}

.items-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(calc(50% - 5px), 1fr));
    gap: 10px;
    align-content: start;
}

/* 当模块宽度较小时，小模块变为单列 */
.module:not(.module-full-width) {
    container-type: inline-size;
}

@container (max-width: 600px) {
    .items-container {
        grid-template-columns: 1fr;
    }
}

.item {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    transition: all 0.2s;
    position: relative;
    break-inside: avoid;
}

.item:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.item-title {
    font-weight: bold;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-actions {
    display: flex;
    gap: 5px;
}

.item-content {
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
}

/* 文本内容区域 */
.text-content {
    margin-bottom: 15px;
    line-height: 1.5;
}

/* 待办事项区域 - 修改为水平布局 */
.todo-section {
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 10px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.todo-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #fec217;
    font-weight: 600;
    white-space: nowrap;
    min-width: 80px;
    margin-top: 2px;
}

.todo-section-header::before {
    #content: "✓";
    font-size: 12px;
    color: #ffc107;
}

.todo-list {
    flex: 1;
    margin-top: 0;
}

.todo-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    gap: 8px;
    padding: 4px 0;
}

.todo-item input[type="checkbox"] {
    margin: 0;
    transform: scale(0.9);
    cursor: default;
}

.todo-item.completed {
    text-decoration: line-through;
    color: #999;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.todo-items {
    margin-top: 15px;
}

.todo-item-input {
    display: flex;
    margin-top: 10px;
    margin-bottom: 15px;
    align-items: center;
    gap: 10px;
}

.todo-item-input input[type="text"] {
    flex: 1;
    height: 35px;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.todo-item-input input[type="checkbox"] {
    transform: scale(1.2);
    margin: 0;
}

.delete-todo {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
    height: auto;
}

/* 响应式设计 - 小屏幕时变为单列 */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    .title-text {
        font-size: 1.5em;
    }
}

/* 模块操作区域 */
.module-actions {
    display: flex;
    gap: 5px;
}

/* 重要事项徽章 */
.important-badge {
    background-color: #dc3545;
    color: white;
    padding: 0px 6px;
    border-radius: 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.important-badge::before {
    #content: "❗";
    font-size: 8px;
}

/* 编辑模态框中的两列布局 */
.form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.form-column {
    flex: 1;
}

.form-column:last-child {
    flex: 0 0 auto;
    margin-bottom: 15px;
}

.important-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.important-checkbox input[type="checkbox"] {
    transform: scale(1.2);
    margin: 0;
}

.important-checkbox label {
    margin: 0;
    font-weight: normal;
    white-space: nowrap;
}
/* 折叠按钮样式 */
.collapse-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background-color: transparent !important;
    color: #e2e7eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    margin-right: 5px;
}

.collapse-btn:hover {
    color: #000;
    background-color: #f0f0f0 !important;
}

/* 折叠状态下的模块样式 */
.module.collapsed {
    min-height: auto;
    height: auto;
}

.module.collapsed .items-container {
    display: none;
}

/* 密码输入模态框样式 */
#password-modal {
    z-index: 2000;
}

.password-form {
    padding: 20px;
}

.password-input-group {
    margin-bottom: 15px;
}

.password-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.password-input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.password-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

#submit-password, #cancel-password {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

#submit-password {
    background-color: #28a745;
    color: white;
}

#submit-password:hover {
    background-color: #218838;
}

#cancel-password {
    background-color: #6c757d;
    color: white;
}

#cancel-password:hover {
    background-color: #5a6268;
}
