* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0078f5;
    --secondary-color: #f8f9fa;
    --border-color: #e1e5e9;
    --text-color: #333;
    --text-light: #666;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --priority-high: #dc3545;
    --priority-medium: #ffc107;
    --priority-low: #28a745;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --day-header-bg: linear-gradient(135deg, var(--secondary-color), #e9ecef);
    --day-header-hover-bg: linear-gradient(135deg, #e9ecef, #dee2e6);
    --day-header-today-bg: var(--day-header-bg);
}

[data-theme="dark"] {
    --primary-color: #4a9eff;
    --secondary-color: #1a1a1a;
    --border-color: #444;
    --text-color: #e1e5e9;
    --text-light: #aaa;
    --secondary-color-light: #2d2d2d;
    --shadow: 0 2px 4px rgba(255,255,255,0.1);
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --priority-high: #f44336;
    --priority-medium: #ff9800;
    --priority-low: #4caf50;
    --day-header-bg: linear-gradient(135deg, #333, #2a2a2a);
    --day-header-hover-bg: linear-gradient(135deg, #3a3a3a, #333);
    --day-header-today-bg: var(--day-header-bg);
}

/* 深色主题专用样式 */
[data-theme="dark"] .header {
    background: var(--secondary-color-light);
    color: var(--text-color);
}

[data-theme="dark"] .task-cell {
    background: #2a2a2a;
}

[data-theme="dark"] .task-cell:hover {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.15), rgba(74, 158, 255, 0.08));
}

[data-theme="dark"] .task-card {
    background: linear-gradient(135deg, #333, #2a2a2a);
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .task-card:hover {
    background: linear-gradient(135deg, #3a3a3a, #333);
}

[data-theme="dark"] .modal-content {
    background: var(--secondary-color-light);
    color: var(--text-color);
}

[data-theme="dark"] .form-control {
    background: #333;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--primary-color);
}

[data-theme="dark"] .properties-panel {
    background: var(--secondary-color-light);
    color: var(--text-color);
}



[data-theme="dark"] .time-label {
    background: linear-gradient(135deg, #333, #2a2a2a);
    color: var(--text-color);
}

[data-theme="dark"] .time-label:hover {
    background: linear-gradient(135deg, #3a3a3a, #333);
}

[data-theme="dark"] .drop-zone {
    border-color: var(--border-color);
    color: var(--text-light);
}

[data-theme="dark"] .drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(74, 158, 255, 0.1);
}

[data-theme="dark"] .weekday-btn {
    background: #333;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .weekday-btn.active {
    background: var(--primary-color);
    color: white;
}

[data-theme="green"] {
    --primary-color: #28a745;
    --secondary-color: #f0f8f0;
    --border-color: #c3e6c3;
    --text-color: #2d5a2d;
    --text-light: #5a7a5a;
    --day-header-bg: linear-gradient(135deg, #d4edda, #c3e6cb);
    --day-header-hover-bg: linear-gradient(135deg, #c3e6cb, #b8dacc);
    --day-header-today-bg: var(--day-header-bg);
}

[data-theme="green"] .weekday-btn {
    background: white;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="green"] .weekday-btn.active {
    background: var(--primary-color);
    color: white;
}

/* 暗色主题标题样式 */
[data-theme="dark"] .table-title {
    color: var(--primary-color);
}

[data-theme="dark"] .table-title:hover {
    background: rgba(74, 158, 255, 0.1);
}

[data-theme="dark"] .table-title-input {
    background: #333;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="dark"] .table-title-container {
    background: var(--secondary-color-light);
    border-bottom-color: var(--border-color);
}

/* 绿色主题标题样式 */
[data-theme="green"] .table-title {
    color: var(--primary-color);
}

[data-theme="green"] .table-title:hover {
    background: rgba(40, 167, 69, 0.1);
}

[data-theme="green"] .table-title-input {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="green"] .table-title-container {
    background: var(--secondary-color);
    border-bottom-color: var(--border-color);
}

/* 隐藏周末列的简化样式 - 只控制显示隐藏 */
.day-header[data-day="6"].hidden,
.task-cell[data-day="6"].hidden {
    display: none;
}

.day-header[data-day="7"].hidden,
.task-cell[data-day="7"].hidden {
    display: none;
}

/* 移动端适配 - 针对月度网格布局优化 */
@media (max-width: 768px) {
    /* 容器适配 */
    .container {
        padding: 5px;
        gap: 5px;
    }
    
    /* 头部适配 */
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .header-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .date-display {
        font-size: 1em;
    }
    
    .week-info {
        font-size: 0.9em;
    }
    
    /* 控制按钮适配 */
    .controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 12px;
        min-width: auto;
    }
    
    /* 表格标题适配 */
    .table-title {
        font-size: 1.4em;
        padding: 6px 12px;
    }
    
    .table-title-input {
        font-size: 1.4em;
        padding: 6px 12px;
    }
    
    /* 月度网格适配 */
    .monthly-grid {
        grid-template-columns: 70px repeat(3, 1fr);
        font-size: 12px;
        border: 1px solid var(--border-color);
        min-height: 500px;
    }
    
    .time-slot-header {
        padding: 8px 4px;
        font-size: 11px;
    }
    
    .time-slot-name {
        font-size: 11px;
        margin-bottom: 2px;
    }
    
    .time-slot-range {
        font-size: 9px !important;
    }
    
    .day-label {
        padding: 4px 2px;
        font-size: 11px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .task-cell {
        min-height: 45px;
        padding: 4px;
        font-size: 11px;
    }
    
    .task-card {
        padding: 4px 6px;
        margin-bottom: 2px;
        font-size: 10px;
    }
    
    .task-title {
        font-size: 10px;
        margin-bottom: 1px;
    }
    
    .task-time,
    .task-note {
        font-size: 9px;
    }
    
    .delete-btn {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }
    
    .add-task-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕进一步优化 */
    .container {
        padding: 2px;
        gap: 2px;
    }
    
    .header {
        padding: 8px;
    }
    
    .controls {
        gap: 5px;
    }
    
    .btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    /* 隐藏晚上时段以节省空间 */
    .time-slot-header:nth-child(4),
    .task-cell[data-slot="EVENING"] {
        display: none;
    }
    
    .monthly-grid {
        grid-template-columns: 50px repeat(2, 1fr);
        font-size: 10px;
    }
    
    .time-slot-header {
        padding: 6px 2px;
        font-size: 9px;
    }
    
    .time-slot-header span {
        font-size: 8px !important;
    }
    
    .day-label {
        padding: 0 4px;
        font-size: 9px;
    }
    
    .task-cell {
        min-height: 40px;
        padding: 2px;
        font-size: 9px;
    }
    
    .task-card {
        padding: 2px 4px;
        margin-bottom: 1px;
        font-size: 8px;
    }
    
    .task-title {
        font-size: 8px;
        margin-bottom: 0;
    }
    
    .task-time,
    .task-note {
        font-size: 7px;
    }
    
    .delete-btn {
        width: 12px;
        height: 12px;
        font-size: 6px;
    }
    
    .add-task-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    /* 表格标题进一步缩小 */
    .table-title {
        font-size: 1.2em;
        padding: 4px 8px;
    }
    
    .table-title-input {
        font-size: 1.2em;
        padding: 4px 8px;
    }
}

@media (max-width: 360px) {
    /* 极小屏幕优化 */
    .monthly-grid {
        grid-template-columns: 50px repeat(3, 1fr);
        font-size: 10px;
        min-height: 400px;
    }
    
    .close-btn {
        top: -10px;
        right: -10px;
        font-size: 22px;
        width: 30px;
        height: 30px;
    }
    
    .time-slot-header {
        padding: 4px 1px;
        font-size: 8px;
    }
    
    .time-slot-name {
        font-size: 8px;
        margin-bottom: 1px;
    }
    
    .time-slot-range {
        font-size: 7px !important;
    }
    
    .day-label {
        padding: 2px 1px;
        font-size: 8px;
        min-height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .task-cell {
        min-height: 35px;
        padding: 1px;
        font-size: 8px;
    }
    
    .task-card {
        padding: 1px 2px;
        font-size: 7px;
    }
    
    .task-title {
        font-size: 7px;
    }
    
    .task-time,
    .task-note {
        font-size: 6px;
    }
    
    .delete-btn {
        width: 14px;
        height: 14px;
        font-size: 7px;
    }
    
    .add-task-btn {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .btn {
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .table-title {
        font-size: 1em;
        padding: 3px 6px;
    }
    
    .table-title-input {
        font-size: 1em;
        padding: 3px 6px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    /* 移动端触摸优化 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* 移动端滚动优化 */
    -webkit-overflow-scrolling: touch;
}

/* 允许文本选择的元素 */
.task-title,
.task-note,
.form-control,
input,
textarea {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 移动端触摸反馈 */
@media (max-width: 768px) {
    .btn,
    .task-card,
    .task-cell,
    .day-label,
    .time-slot-header {
        -webkit-tap-highlight-color: rgba(0, 120, 245, 0.2);
        tap-highlight-color: rgba(0, 120, 245, 0.2);
    }
    
    /* 增加触摸目标大小 */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .delete-btn {
        min-height: 16px;
        min-width: 16px;
    }
    
    .add-task-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 优化滚动性能 */
    .monthly-grid,
    .task-cell,
    .modal-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 100vh;
}

.header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 5px;
}

.title-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weekly-title {
    font-size: 2em;
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px 10px;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    background: transparent;
    font-family: inherit;
    text-align: left;
}

.weekly-title:hover {
    background: rgba(0, 120, 245, 0.05);
    border-color: var(--primary-color);
}

.weekly-title:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(0, 120, 245, 0.1);
}

.weekly-title.editing {
    border-color: var(--primary-color);
    background: rgba(0, 120, 245, 0.1);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date-display {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
}

.week-info {
    color: var(--text-light);
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 表格标题样式 */
.table-title-container {
    padding: 10px 20px 5px;
    text-align: center;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    display: inline-block;
    min-width: 200px;
}

.table-title:hover {
    background: rgba(0, 120, 245, 0.1);
    transform: translateY(-1px);
}

.table-title-input {
    font-size: 1.8em;
    font-weight: 600;
    color: var(--primary-color);
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 8px 16px;
    text-align: center;
    min-width: 200px;
    outline: none;
}

.main-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* 按月布局样式 */
.monthly-grid {
    display: grid;
    grid-template-columns: 100px repeat(3, 1fr);
    grid-template-rows: 60px repeat(31, 1fr);
    min-height: 600px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: visible;
    box-shadow: var(--shadow);
    gap: 0;
}

/* 晚上时段隐藏时的布局调整 */
.monthly-grid.evening-hidden {
    grid-template-columns: 100px repeat(2, 1fr);
}

.monthly-grid.evening-hidden .time-slot-header:nth-child(4),
.monthly-grid.evening-hidden .task-cell[data-slot="EVENING"] {
    display: none;
}

/* 晚上时段显示时的布局 */
.monthly-grid.evening-visible {
    grid-template-columns: 100px repeat(3, 1fr);
}

.monthly-grid.evening-visible .time-slot-header:nth-child(4),
.monthly-grid.evening-visible .task-cell[data-slot="EVENING"] {
    display: flex;
}

.time-slot-header {
    background: var(--day-header-bg);
    color: var(--text-color);
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
    font-size: 15px;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    grid-row: 1;
}

.time-slot-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.time-slot-range {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.day-header {
    background: var(--day-header-bg);
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
    font-size: 15px;
    color: var(--text-color);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-row: 1;
}

/* 日期标签样式（按月布局） */
.day-label {
    background: var(--day-header-bg);
    padding: 0 15px;
    text-align: center;
    font-weight: 600;
    border-right: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    font-size: 15px;
    color: var(--text-color);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: sticky;
    left: 0;
    z-index: 5;
}

.day-label.today {
    background: var(--day-header-today-bg);
    color: var(--text-color);
    font-weight: 700;
}

/* 移除固定定位，使用自然流布局 */

.day-header:hover {
    background: var(--day-header-hover-bg);
    transform: translateY(-1px);
}

.day-header.today {
    background: var(--day-header-today-bg);
    color: var(--text-color);
    font-weight: 700;
}

.time-label {
    background: linear-gradient(135deg, #f1f3f4, #e8eaed);
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    border-right: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--text-color);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    grid-row: 1;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 按月布局的时间标签 */
.time-slot-header {
    background: var(--day-header-bg);
    color: var(--text-color);
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
    font-size: 15px;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-row: 1;
    position: sticky;
    top: 0;
    z-index: 10;
}

.time-label:hover {
    background: linear-gradient(135deg, #e8eaed, #dadce0);
}

.task-cell {
    border-right: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    padding: 8px;
    min-height: 60px;
    height: 100%;
    position: relative;
    overflow-y: auto;
    background: #fafbfc;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* 隐藏超出当月天数的行 */
.task-cell.hidden {
    display: none;
}

/* 移除所有固定定位，使用自然流布局和JavaScript动态调整 */

.task-cell:hover {
    background: linear-gradient(135deg, rgba(0, 120, 245, 0.08), rgba(0, 120, 245, 0.04));
    box-shadow: inset 0 0 10px rgba(0, 120, 245, 0.1);
}

/* 自定义滚动条样式 */
.task-cell::-webkit-scrollbar {
    width: 6px;
}

.task-cell::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.task-cell::-webkit-scrollbar-thumb {
    background: rgba(0, 120, 245, 0.3);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.task-cell::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 120, 245, 0.5);
}

.task-card {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 4px;
    cursor: move;
    transition: all 0.3s ease;
    position: relative;
    font-size: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* PC端任务卡片优化 - 减小尺寸以便更好地并列显示 */
@media (min-width: 769px) {
    .task-card {
        padding: 4px 6px;
        margin-bottom: 2px;
        font-size: 11px;
        border-radius: 4px;
        min-height: 32px;
    }
    
    .task-title {
        font-size: 11px;
        line-height: 1.2;
        margin-bottom: 2px;
    }
    
    .task-time {
        font-size: 9px;
        line-height: 1.1;
    }
    
    .task-note {
        font-size: 9px;
        line-height: 1.1;
        margin-top: 1px;
    }
    
    .delete-btn {
        width: 16px;
        height: 16px;
        font-size: 10px;
        top: 2px;
        right: 2px;
    }
}

/* PC端任务布局优化 */
@media (min-width: 769px) {
    .task-cell {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px;
        padding: 2px;
        align-content: flex-start;
        position: relative;
        overflow: visible;
    }
    
    /* 确保悬停效果不会影响表格布局 */
    .task-cell:hover {
        z-index: 5;
    }
    
    .task-card:hover {
        box-shadow: 0 12px 30px rgba(0,0,0,0.2);
        transform: translateY(-3px) scale(1.03);
    }
    
    /* 单个任务时占满整行 */
    .task-cell.single-task .task-card {
        width: 100%;
        margin-bottom: 0;
    }
    
    /* 2个任务时并列一行 */
    .task-cell.dual-task .task-card {
        width: calc(50% - 1px);
        margin-bottom: 0;
    }
    
    /* 多个任务时按2个一行的规律排列 */
    .task-cell.multi-task .task-card {
        width: calc(50% - 1px);
        margin-bottom: 0;
        box-sizing: border-box;
    }
    
    /* 奇数个任务的最后一个占满整行 */
    .task-cell.multi-task .task-card:last-child:nth-child(odd) {
        width: 100%;
    }
}

.task-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, #ffffff, #f8faff);
    transform: translateY(-2px) scale(1.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left-width: 4px;
    z-index: 10;
    position: relative;
}

/* PC端专属悬停效果 */
@media (min-width: 769px) {
    .task-card {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
    }
    
    .task-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
        transition: left 0.5s ease;
        z-index: 1;
    }
    
    .task-card:hover::before {
        left: 100%;
    }
    
    .task-card:hover .task-title {
        color: var(--primary-color);
        transition: color 0.3s ease;
    }
    
    .task-card:hover .task-time,
    .task-card:hover .task-note {
        color: var(--text-color);
        transition: color 0.3s ease;
    }
}

.task-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.task-cell.drag-over {
    background-color: rgba(0, 123, 255, 0.1) !important;
    border: 2px dashed var(--primary-color) !important;
    transition: all 0.2s ease;
}

.task-card.done {
    opacity: 0.6;
    text-decoration: line-through;
}

.task-card.high-priority {
    border-left: 3px solid var(--priority-high);
}

.task-card.medium-priority {
    border-left: 3px solid var(--priority-medium);
}

.task-card.low-priority {
    border-left: 3px solid var(--priority-low);
}

.task-checkbox {
    margin-right: 5px;
    cursor: pointer;
}

.task-title {
    font-weight: bold;
    margin-bottom: 2px;
    word-break: break-word;
}

.task-time {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.task-note {
    font-size: 11px;
    color: var(--text-light);
    word-break: break-word;
}

.task-actions {
    position: absolute;
    top: 2px;
    right: 2px;
    opacity: 0;
    transition: opacity 0.3s;
}

.task-card:hover .task-actions {
    opacity: 1;
}

.delete-btn {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
}

.delete-btn:hover {
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.add-task-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 120, 245, 0.3);
}

.task-cell:hover .add-task-btn {
    opacity: 1;
    box-shadow: 0 4px 12px rgba(0, 120, 245, 0.4);
}

.properties-panel {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

/* 移动端属性面板适配 */
@media (max-width: 768px) {
    .properties-panel {
        position: static;
        margin-top: 10px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .properties-panel {
        padding: 10px;
        margin-top: 5px;
    }
    
    .properties-panel h3 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
}

.properties-panel h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
}

/* 统一时间输入框和备注文本框的字体样式 */
input[type="time"].form-control,
textarea.form-control {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
}

/* 确保备注文本框的字体一致性 */
#taskNote {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.priority-selector {
    display: flex;
    gap: 5px;
}

.priority-btn {
    flex: 1;
    padding: 5px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--border-radius);
}

.priority-btn.active {
    background: var(--primary-color);
    color: white;
}

.repeat-selector {
    display: flex;
    gap: 5px;
}

.repeat-btn {
    flex: 1;
    padding: 5px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--border-radius);
}

.repeat-btn.active {
    background: var(--primary-color);
    color: white;
}

.weekday-selector {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.weekday-btn {
    flex: 1;
    min-width: 50px;
    padding: 5px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--border-radius);
}

.weekday-btn.active {
    background: var(--primary-color);
    color: white;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* 移动端模态框适配 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: none;
        padding: 15px;
        max-height: 85vh;
        position: relative;
    }
    
    .modal-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: relative;
        padding-right: 30px;
    }
    
    .modal-title {
        font-size: 1.2em;
    }
    
    .close-btn {
        position: absolute;
        top: -5px;
        right: -5px;
        font-size: 28px;
        z-index: 10;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .form-control {
        padding: 6px;
        font-size: 13px;
    }
    
    .priority-selector,
    .repeat-selector,
    .weekday-selector {
        gap: 3px;
    }
    
    .priority-btn,
    .repeat-btn,
    .weekday-btn {
        padding: 4px;
        font-size: 11px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        padding: 10px;
        max-height: 90vh;
    }
    
    .modal-title {
        font-size: 1.1em;
    }
    
    .close-btn {
        top: -8px;
        right: -8px;
        font-size: 24px;
        width: 32px;
        height: 32px;
    }
    
    .form-group label {
        font-size: 12px;
    }
    
    .form-control {
        padding: 5px;
        font-size: 12px;
    }
    
    .priority-btn,
    .repeat-btn,
    .weekday-btn {
        padding: 3px;
        font-size: 10px;
        min-width: 35px;
    }
    
    .weekday-selector {
        flex-wrap: wrap;
    }
    
    .weekday-btn {
        flex: 0 0 calc(14.28% - 3px);
        min-width: 30px;
    }
}

/* CSV导入弹窗特殊样式 */
#importModal {
    z-index: 10001; /* 确保导入模态框在最上层 */
}

#importModal .modal-content {
    max-width: 600px;
    max-height: 85vh;
    overflow: visible; /* 修复：允许内容正常显示 */
}

#importModal .modal-body {
    max-height: calc(85vh - 160px);
    overflow-y: auto; /* 修复：允许垂直滚动 */
    padding: 20px 30px;
}

#importModal #importPreview {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    background: #f8f9fa;
}

#importModal .modal-footer {
    position: relative;
    z-index: 1;
    background: white;
    border-top: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.theme-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.theme-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
}

.theme-btn.active {
    border-color: var(--primary-color);
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    margin-bottom: 15px;
}

.drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(0, 120, 245, 0.1);
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .monthly-grid {
        grid-template-columns: 30px repeat(3, 1fr) !important;
        grid-template-rows: 50px repeat(31, 1fr);
        font-size: 12px;
        min-height: 800px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* 手机端隐藏晚上时段时的布局调整 */
    .monthly-grid.evening-hidden {
        grid-template-columns: 30px repeat(2, 1fr) !important;
    }
    
    .monthly-grid.evening-hidden .time-slot-header:nth-child(4),
    .monthly-grid.evening-hidden .task-cell[data-slot="EVENING"] {
        display: none !important;
    }
    
    /* 移动端网格布局将由JavaScript动态调整 */

    .time-label {
        padding: 15px 8px;
        font-size: 14px;
        min-height: 120px;
    }

    .task-cell {
        padding: 8px;
        min-height: 120px;
        height: 100%;
    }

    .day-header, .time-slot-header {
        padding: 12px 6px;
        font-size: 12px;
    }

    .task-card {
        padding: 8px;
        font-size: 12px;
        margin-bottom: 6px;
    }

    .add-task-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
        bottom: 6px;
        right: 6px;
    }

    .header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .controls {
        justify-content: center;
        flex-wrap: wrap;
    }
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        gap: 10px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        text-align: center;
    }

    .weekly-title {
        font-size: 1.5em;
        text-align: center;
    }

    .controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .monthly-grid {
        grid-template-columns: 30px repeat(3, 1fr) !important;
        grid-template-rows: 50px repeat(31, 1fr);
        height: calc(100vh - 250px);
        min-height: 500px;
        font-size: 12px;
    }
    
    /* 小屏幕网格布局将由JavaScript动态调整 */

    .time-slot-header,
    .day-header {
        padding: 8px 4px;
        font-size: 11px;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .time-label {
        padding: 15px 4px;
        font-size: 11px;
        min-height: 120px;
    }

    .task-cell {
        padding: 4px;
        min-height: 50px;
        height: 100%;
    }

    .task-card {
        padding: 3px 4px;
        font-size: 10px;
        margin-bottom: 2px;
        border-radius: 4px;
    }

    .task-title {
        font-size: 11px;
    }

    .task-time {
        font-size: 9px;
    }

    .add-task-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
        bottom: 4px;
        right: 4px;
    }
}

@media (max-width: 480px) {
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    .container {
        padding: 5px;
        gap: 5px;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .header {
        padding: 8px;
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
    }

    .header-info {
        justify-content: center;
        gap: 10px;
        margin-bottom: 8px;
    }

    .controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .weekly-title {
        font-size: 1.2em;
        text-align: center;
    }

    /* 手机端专用网格布局：横向为时间段，纵向为星期 */
    .weekly-grid {
        display: grid !important;
        /* 网格模板由JavaScript动态设置 */
        height: auto !important;
        min-height: 400px !important;
        max-height: none !important;
        font-size: 10px !important;
        gap: 1px !important;
        border: 1px solid var(--border-color) !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        grid-auto-rows: minmax(auto, max-content) !important;
    }

    /* 移动端时间段标题优化 */
    .time-slot-header {
        padding: 8px 4px !important;
        font-size: 11px !important;
        height: auto !important;
    }
    
    .time-slot-header span {
        font-size: 9px !important;
    }

    /* 隐藏多余的星期标题 */
    .day-header[data-day="4"],
    .day-header[data-day="5"],
    .day-header[data-day="6"],
    .day-header[data-day="7"] {
        display: none;
    }

    /* 移动端时间标签隐藏（月视图不需要） */
    .time-label {
        display: none !important;
    }
    
    /* 确保月视图布局正确 */
    .day-label {
        grid-column: 1 !important;
    }
    
    .task-cell[data-slot="AM"] {
        grid-column: 2 !important;
    }
    
    .task-cell[data-slot="PM"] {
        grid-column: 3 !important;
    }
    
    .task-cell[data-slot="EVENING"] {
        grid-column: 4 !important;
    }

    /* 手机端任务单元格重新定位 */
    .task-cell {
        padding: 2px !important;
        min-height: auto !important;
        overflow: visible !important;
        height: auto !important;
    }
    
    /* 手机端隐藏滚动条 */
    .task-cell::-webkit-scrollbar {
        display: none !important;
    }
    
    /* 强制日期列宽度设置 */
    .day-label {
        max-width: 30px !important;
        width: 30px !important;
        height: auto !important;
        max-height: none !important;
        font-size: 9px !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        flex-grow: 1 !important;
        align-content: flex-start !important;
    }

    /* 手机端任务单元格布局由JavaScript动态设置 */
    .task-cell {
        /* 移除固定的grid-row设置，让JavaScript动态控制 */
    }

    .task-card {
        padding: 4px;
        font-size: 10px;
        margin-bottom: 2px;
        height: auto !important;
        min-height: auto !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        line-height: 1.3;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .task-title {
        font-size: 10px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        line-height: 1.2;
    }

    .task-time {
        font-size: 9px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .task-note {
        font-size: 9px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        line-height: 1.2;
    }

    .btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .modal-content {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
        width: calc(100% - 40px) !important;
        max-width: 90vw !important;
        max-height: calc(100vh - 40px) !important;
        overflow-y: auto;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-control {
        padding: 8px;
        font-size: 14px;
    }
}

/* 桌面端和移动端文本控制 */
.mobile-text {
    display: none;
}

.desktop-text {
    display: inline;
}

.mobile-only {
    display: none;
}

@media (max-width: 480px) {
    .mobile-text {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .desktop-text {
        display: none;
    }
    
    .mobile-only {
        display: flex;
    }
    
    /* 手机端时间范围样式 */
    .mobile-time-range {
        font-size: 8px;
        color: #666;
        margin-top: 2px;
        line-height: 1;
        font-weight: normal;
    }
    
    /* 移动端时间标签优化 - 移除强制定位，使用自然流布局 */
}

/* 导出下拉菜单样式 */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle::after {
    content: '▼';
    margin-left: 8px;
    font-size: 10px;
    transition: transform 0.3s ease;
}

.dropdown-toggle.active::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

/* 移动端下拉菜单适配 */
@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 160px;
        right: 0;
        left: auto;
    }
    
    .dropdown-item {
        padding: 10px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .dropdown-menu {
        min-width: 140px;
        position: fixed;
        top: 70px;
        right: 10px;
        left: auto;
        bottom: auto;
        transform: none;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
    
    .dropdown-menu.show {
        transform: none;
    }
    
    .dropdown-item {
        padding: 12px 15px;
        font-size: 14px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .dropdown-item:last-child {
        border-bottom: none;
    }
    
    .export-dropdown {
        position: static;
    }
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--secondary-color);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* 导出日期选择按钮样式 */
.export-day-btn {
    flex: 1;
    min-width: 50px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 14px;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    color: var(--text-color);
}

.export-day-btn:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.export-day-btn.selected {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

/* 深色主题下的导出按钮样式 */
[data-theme="dark"] .export-day-btn {
    background: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .export-day-btn:hover {
    background: #374151;
    border-color: var(--primary-color);
}

[data-theme="dark"] .export-day-btn.selected {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

/* 深色主题适配 */
[data-theme="dark"] .dropdown-menu {
    background: var(--secondary-color-light);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-color);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #3a3a3a;
}

[data-theme="dark"] .dropdown-divider {
    background-color: var(--border-color);
}
