/* TodoList 待办事项样式文件 */

/* 强制pointer-events设置，确保透明度控制正常工作 */
.todo-overlay {
    pointer-events: auto !important;
}

/* 主面板 */
.todo-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50vw; /* 动态设置为窗口宽度的一半 */
    height: 50vh; /* 动态设置为窗口高度的一半 */
    max-width: 500px; /* 设置最大宽度限制 */
    max-height: 600px; /* 设置最大高度限制 */
    min-width: 300px; /* 设置最小宽度 */
    min-height: 300px; /* 设置最小高度 */
    background: #ffffff !important;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    z-index: 3000;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    overflow: hidden;
    border: 2px solid #e0e6ed !important;
    animation: zoomIn 0.3s ease;
    pointer-events: auto !important;
    display: flex;
    flex-direction: column;
}

.todo-panel * {
    pointer-events: auto !important;
}

/* 头部区域 */
.todo-header {
    flex-shrink: 0; /* 防止被压缩 */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 8px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.todo-header h3 {
    display: none; /* 隐藏标题，只显示关闭按钮 */
}

/* 关闭按钮 */
.close-btn {
    background: none !important;
    border: none;
    color: white !important;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* 添加表单区域 */
.todo-add-form {
    flex-shrink: 0; /* 防止被压缩 */
    padding: 12px 20px;
    border-bottom: 1px solid #e0e6ed;
    background: #ffffff !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.todo-add-form input {
    width: 70%;
    max-width: 300px;
    padding: 8px 12px;
    margin-bottom: 6px;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    background: #ffffff !important;
    color: #333 !important;
    font-weight: 500;
    transition: all 0.3s ease;
}

.todo-add-form input:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff !important;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.3);
    transform: scale(1.02);
}

.todo-add-form input::placeholder {
    color: #888 !important;
    font-weight: normal;
}

/* 错误状态样式 */
.todo-add-form input.error {
    border-color: #ff4757 !important;
    background: #fff5f5 !important;
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.3) !important;
}

.input-error-message {
    width: 70%;
    max-width: 300px;
    color: #ff4757 !important;
    font-size: 11px;
    margin-top: 4px;
    margin-bottom: 4px;
    padding: 4px 8px;
    background: #fff5f5 !important;
    border-radius: 4px;
    border-left: 3px solid #ff4757;
    display: none;
    animation: shake 0.3s ease-in-out;
    box-sizing: border-box;
}

/* 添加按钮 */
.todo-add-form button {
    width: 60%;
    max-width: 200px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: bold;
}

.todo-add-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 待办事项列表容器 */
.todo-list {
    flex: 1; /* 自动占用剩余空间 */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 8px 16px;
    background: #ffffff !important;
    position: relative;
    scroll-behavior: smooth !important;
    -webkit-overflow-scrolling: touch !important;
}

/* 滚动提示渐变效果 */
.todo-list::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), transparent) !important;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.todo-list::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(to top, rgba(255,255,255,0.9), transparent) !important;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.todo-list.scrollable::before,
.todo-list.scrollable::after {
    opacity: 1;
}

/* 自定义滚动条样式 */
.todo-list::-webkit-scrollbar {
    width: 8px !important;
    background: #f1f1f1 !important;
}

.todo-list::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 4px !important;
    margin: 4px 0 !important;
}

.todo-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 4px !important;
    border: 1px solid #e0e6ed !important;
}

.todo-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%) !important;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3) !important;
}

.todo-list::-webkit-scrollbar-corner {
    background: #f1f1f1 !important;
}

/* 待办事项条目 */
.todo-item {
    display: flex;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid #e0e6ed;
    animation: slideIn 0.3s ease;
    background: #ffffff !important;
    margin: 4px 0;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.todo-item:last-child {
    border-bottom: none;
}

/* 复选框 */
.todo-checkbox {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* 内容区域 */
.todo-content {
    flex: 1;
    background: transparent !important;
}

.todo-title {
    font-size: 14px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333 !important;
    background: transparent !important;
}

.todo-title.completed {
    text-decoration: line-through;
    color: #999 !important;
}

.todo-time {
    font-size: 12px;
    color: #666 !important;
    background: transparent !important;
}

.todo-time.urgent {
    color: #ff4757 !important;
    font-weight: bold;
}

/* 删除按钮 */
.todo-delete {
    background: #ff4757 !important;
    color: white !important;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
}

.todo-delete:hover {
    background: #ff3742 !important;
}

/* 统计区域 */
.todo-stats {
    padding: 8px 16px;
    background: #f8f9fa !important;
    font-size: 11px;
    color: #666 !important;
    text-align: center;
    border-top: 1px solid #e0e6ed;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999 !important;
    background: transparent !important;
}

.empty-state p {
    color: #999 !important;
    background: transparent !important;
}

/* 动画定义 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80% { 
        transform: translateX(0); 
    }
    10%, 30%, 50%, 70%, 90% { 
        transform: translateX(-5px); 
    }
}
