/* 文件: assets/css/pc_style.css */
/* 描述: PC端全局样式表 (最终完整版) */

/* --- 全局与重置 --- */
:root {
    --primary-color: #007AFF; /* Apple Blue */
    --primary-hover-color: #0056b3;
    --secondary-color: #F2F2F7;
    --background-color: #FFFFFF;
    --sidebar-bg: #F9F9F9;
    --border-color: #E5E5EA;
    --text-color: #1D1D1F;
    --text-secondary-color: #6E6E73;
    --green-color: #34C759;
    --red-color: #FF3B30;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 8px;
}

body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- 登录/注册页面 --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--secondary-color);
}
.auth-box {
    width: 380px;
    padding: 40px;
    background-color: var(--background-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
}
.auth-box h1 {
    font-size: 28px;
    margin-bottom: 8px;
}
.auth-subtitle, .modal-subtitle {
    color: var(--text-secondary-color);
    margin-bottom: 24px;
    font-size: 14px;
}
.modal-subtitle {
    margin-top: -15px;
    margin-bottom: 20px;
}

/* --- 通用表单元素样式 --- */
.input-group {
    margin-bottom: 16px;
    text-align: left;
}
.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}
/* 统一的输入框、下拉菜单、文本域样式 */
.input-group input[type="text"],
.input-group input[type="password"],
.input-group input[type="number"],
.input-group input[type="date"], /* Added for consistency */
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: var(--font-family);
    box-sizing: border-box;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}
/* 统一的聚焦效果 */
.input-group input[type="text"]:focus,
.input-group input[type="password"]:focus,
.input-group input[type="number"]:focus,
.input-group input[type="date"]:focus, /* Added for consistency */
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2); /* 柔和的蓝色光晕 */
}

/* 对特定表单元素的微调 */
.input-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236c6c72' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 1em;
    padding-right: 40px;
}
.input-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* --- 按钮样式 --- */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover-color);
}
.btn-secondary {
    width: 100%;
    background: var(--secondary-color);
    color: var(--text-color);
    text-align: left;
    margin-bottom: 8px;
    font-weight: 500;
}
.btn-secondary:hover {
    background-color: #E5E5EA;
}
.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary-color);
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.btn-icon:hover {
    background-color: #E5E5EA;
}

/* --- 主应用布局 --- */
#app-container {
    display: flex;
    height: 100vh;
}
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}
.sidebar-header h2 {
    margin: 0 0 30px 0;
    font-size: 24px;
}
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
}
.nav-menu li a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-color);
    border-radius: var(--border-radius);
    font-weight: 500;
}
.nav-menu li.active a, .nav-menu li a:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}
.sidebar-section {
    margin-bottom: 25px;
}
.sidebar-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.sidebar-section-header h3, .sidebar-section > h3 {
    font-size: 14px;
    color: var(--text-secondary-color);
    text-transform: uppercase;
    margin: 0;
}
#category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
#category-list .category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 5px;
    border-radius: 6px;
    transition: background-color 0.2s;
}
#category-list .category-item:hover {
    background-color: #E5E5EA;
}
#category-list .category-item .category-name-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}
#category-list .category-item .category-actions {
    display: none;
    gap: 8px;
}
#category-list .category-item:hover .category-actions {
    display: flex;
}
#category-list .category-item .category-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary-color);
    font-size: 14px;
}
#category-list .category-item .category-actions button:hover {
    color: var(--text-color);
}
.category-edit-input {
    flex-grow: 1;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 15px;
    outline: none;
}
.sidebar-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px; /* Adjusts space between icon and username */
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary-color);
}

.user-info .fa-circle-user {
    font-size: 22px; /* Makes the user icon slightly larger */
}

.logout-link {
    color: var(--text-secondary-color);
    font-size: 18px;
    text-decoration: none;
    padding: 6px;
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
}

.logout-link:hover {
    color: var(--red-color);
    background-color: #FF3B301A; /* A light red background on hover */
}

/* --- 主内容区 --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 40px;
}
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.calendar-nav {
    display: flex;
    align-items: center;
}
.calendar-nav h1 {
    font-size: 28px;
    margin: 0 20px;
    min-width: 200px;
    text-align: center;
}
.calendar-nav button {
    background: none;
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
}
#today-btn {
    border-radius: var(--border-radius);
    font-size: 15px;
    width: auto;
    padding: 0 15px;
    margin-left: 15px;
    font-weight: bold; 
}

/* --- 日历网格 --- */
#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex-grow: 1;
    gap: 1px;
    background-color: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}
.calendar-header {
    text-align: center;
    padding: 10px 0;
    font-weight: 600;
    background-color: var(--sidebar-bg);
}
.calendar-day {
    background-color: white;
    padding: 8px;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}


.calendar-day.other-month {
    /* [修改] 将背景色从灰色系改为白色 */
    background-color: white; 
    color: #B0B0B0;
}

.calendar-day.today {
    background-color: #E8F0FE;/*高亮底色是蓝色，如要用黄色使用#FFFBEA*/
}
.day-number {
    font-weight: 500;
    margin-bottom: 5px;
}
.today .day-number {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* --- 任务项 --- */
.task-item {
    font-size: 13px;
    padding: 4px 6px 4px 12px; /* Adjusted left padding to make space for the new strip */
    margin-bottom: 4px;
    border-radius: 4px; /* We can now use a simple border-radius again */
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    color: var(--text-color);
    position: relative; /* Required for positioning the ::before pseudo-element */
    overflow: hidden; /* Ensures the strip stays within the rounded corners */
}

/* [NEW] This pseudo-element creates the color strip */
.task-item::before {
    content: ''; /* Required for pseudo-elements */
    position: absolute;
    left: 0;
    top: 0;
    width: 4px; /* The width of the color strip */
    height: 100%;
    /* Uses the --task-color variable set by the JS, with a fallback color */
    background-color: var(--task-color, var(--primary-color));
}
.task-item-checkbox {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--text-secondary-color);
    border-radius: 50%;
    margin-right: 6px;
    cursor: pointer;
    flex-shrink: 0;
}
.task-item.completed .task-item-checkbox {
    background-color: var(--green-color);
    border-color: var(--green-color);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}
.task-item.completed .task-item-title {
    text-decoration: line-through;
    color: var(--text-secondary-color);
}

/* --- [NEW] 提醒事项的特殊样式 --- */
/*
  This new rule styles the reminder items differently from regular tasks.
  Reminders are not directly interactive, so they have a more subtle appearance.
*/
.task-item.reminder {
    background-color: var(--sidebar-bg); /* Use a more subtle background */
    cursor: default; /* Change cursor to indicate it's not clickable */
    opacity: 0.9;
}

/* --- 弹窗 --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
}
.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 450px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}
.close-btn {
    position: absolute;
    top: 15px; right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

/* --- 分类弹窗颜色选择 --- */
#color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s;
}
.color-swatch.selected {
    border-color: var(--primary-color);
}

/* --- 自定义单选按钮样式 --- */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}
.radio-item {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.radio-item label {
    margin-left: 8px;
    font-weight: 500;
    color: var(--text-color);
}
.radio-item input[type="radio"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}
.radio-item label::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background-color: var(--background-color);
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
}
.radio-item:hover label::before {
    border-color: var(--primary-color);
}
.radio-item input[type="radio"]:checked + label::before {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: inset 0 0 0 3px var(--background-color);
}

/* --- [新增] 每日事件视图弹窗样式 --- */
.day-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.day-view-header h3 {
    margin: 0;
    font-size: 20px;
}

/* 统一小按钮样式，确保“新增任务”按钮风格一致 */
.btn.btn-sm {
    padding: 8px 15px; /* 调整内边距 */
    font-size: 14px;
    border-radius: var(--border-radius); /* 使用全局圆角变量 */
    background-color: var(--primary-color); /* 使用主题色 */
    color: white;
    transition: background-color 0.2s;
}

.btn.btn-sm:hover {
    background-color: var(--primary-hover-color); /* 悬停颜色 */
}

#day-view-task-list,
#recurring-rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 60vh; /* Make the list scrollable if too long */
    overflow-y: auto;
}

.day-view-task-item {
    display: flex;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid var(--secondary-color);
    font-size: 15px;
}

.day-view-task-item:last-child {
    border-bottom: none;
}

.day-view-task-item .task-title {
    flex-grow: 1;
    margin-left: 12px;
}

/*
############################################################################
#                                                                          #
#                             START OF FIX                                 #
#                                                                          #
############################################################################
*/

/* --- [MAJOR FIX] 添加弹窗内“已完成”任务的样式 --- */

/* This rule will add the green checkmark to the modal's checkbox */
.day-view-task-item.completed .task-item-checkbox {
    background-color: var(--green-color);
    border-color: var(--green-color);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

/* This rule will add the strikethrough to the modal's task title */
.day-view-task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--text-secondary-color);
}

/*
############################################################################
#                                                                          #
#                               END OF FIX                                 #
#                                                                          #
############################################################################
*/

.day-view-task-item .task-actions {
    display: flex;
    gap: 8px;
}

/* 调整日视图任务项内的操作按钮样式 */
.day-view-task-item .task-actions button {
    background: none;
    border: none;
    color: var(--text-secondary-color);
    cursor: pointer;
    font-size: 16px; /* 保持图标大小 */
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, color 0.2s; /* 添加颜色过渡 */
}

.day-view-task-item .task-actions button:hover {
    background-color: var(--secondary-color); /* 悬停背景色 */
    color: var(--primary-color); /* 悬停时图标颜色变蓝，与其他交互元素一致 */
}

/* 确保编辑输入框样式与全局输入框一致 */
.day-view-task-item .task-edit-input {
    flex-grow: 1;
    border: 1px solid var(--border-color); /* 使用全局边框色 */
    border-radius: var(--border-radius); /* 使用全局圆角 */
    padding: 6px 10px; /* 调整内边距 */
    font-size: 15px;
    outline: none;
    box-sizing: border-box; /* 确保内边距和边框包含在宽度内 */
    transition: border-color 0.2s, box-shadow 0.2s;
}

.day-view-task-item .task-edit-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* 延期模态框的副标题，用于显示任务信息 */
#postpone-modal-subtitle {
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary-color);
}

/* --- [新增] 日历单元格摘要样式 --- */
.day-summary {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    color: var(--text-secondary-color);
    background-color: #EFEFF3;
    padding: 3px 6px;
    border-radius: 4px;
    z-index: 5; /* Ensure it's above the progress bar */
    display: inline-block;
    pointer-events: none; /* Make it non-interactive */
}

.day-summary-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: var(--green-color);
    opacity: 0.3;
    border-radius: 4px;
    z-index: -1;
    transition: width 0.3s ease-in-out;
}

/* --- [新增] 过期任务项样式 --- */
.task-item.overdue {
    background-color: #FFF0F0; /* A light red background to stand out */
}

.task-item.overdue .task-item-title {
    color: var(--red-color); /* Makes the title text red */
}

.task-overdue-icon {
    color: var(--red-color);
    margin-left: auto;      /* Pushes the icon to the far right */
    padding-left: 5px;     /* Adds some space between the title and the icon */
    font-size: 14px;
    cursor: help;          /* Indicates the icon is informative */
}

/* --- [新增] 分类筛选样式 --- */
#category-list .category-item {
    cursor: pointer; /* Indicate that items are clickable */
}

#category-list .category-item .category-name-wrapper .fa-layer-group {
    width: 12px; /* Align icon with color dots */
    text-align: center;
    margin-right: 12px;
    color: var(--text-secondary-color);
}

#category-list .category-item.active {
    background-color: var(--primary-color);
    color: white;
}

#category-list .category-item.active:hover {
    background-color: var(--primary-hover-color);
}

#category-list .category-item.active .category-name,
#category-list .category-item.active .fa-layer-group {
    color: white;
    font-weight: 600;
}

#category-list .category-item.active .category-actions button {
    color: rgba(255, 255, 255, 0.7);
}
#category-list .category-item.active .category-actions button:hover {
    color: white;
}

#category-list .category-item.active .category-color-dot {
    box-shadow: 0 0 0 2px white; /* Add a white border to active color dot */
}

/* --- [新增] 用于并排排列表单项的样式 --- */
.input-group-row {
    display: flex;
    gap: 15px; /* Adds a nice space between the two input fields */
    align-items: flex-start;
}

.input-group-row .input-group {
    flex: 1; /* Allows each input group to take up an equal amount of space */
    margin-bottom: 16px; /* Keeps the standard spacing below the row */
}

/* --- [新增] 通用分类颜色圆点样式 --- */
.category-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%; /* This makes the element a circle */
    flex-shrink: 0;     /* This prevents the dot from shrinking in a flex container */
    display: inline-block;
}

/* --- [NEW] Fix for Calendar Day Task Overflow --- */

/* This makes the task list container grow to fill the available space in the day cell */
.calendar-day .tasks-list {
    flex-grow: 1;
    min-height: 0; /* A necessary flexbox property to make scrolling work correctly */
    overflow-y: auto; /* Adds a vertical scrollbar ONLY when the content is too tall */
    padding-right: 4px; /* Adds a little space for the scrollbar */
}

/* Optional: Adds a subtle, less obtrusive scrollbar style for a cleaner look */
.calendar-day .tasks-list::-webkit-scrollbar {
    width: 6px;
}

.calendar-day .tasks-list::-webkit-scrollbar-track {
    background: transparent;
}

.calendar-day .tasks-list::-webkit-scrollbar-thumb {
    background-color: #d6d6d6;
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.calendar-day .tasks-list::-webkit-scrollbar-thumb:hover {
    background-color: #a8a8a8;
}





/* 1. 卡片主体容器 */
.task-item.overdue, 
.day-view-task-item.overdue {
    /* 背景：改为极淡的奶油米黄色，不刺眼 */
    background-color: #FFFDE7 !important; 
    /* 文字：保持中灰色，降低视觉压力 */
    color: #9E9E9E !important;           
    /* 左侧边框：改为柔和的金黄色，起到提示作用但不过分抢眼 */
    border-left: 3px solid #FDD835;      
    /* 增加一点轻微的内阴影让它看起来像是“沉”下去的过期状态 */
    box-shadow: inset 0 0 0 1px rgba(253, 216, 53, 0.1); 
}

/* 2. 确保内部标题文字颜色一致 */
.task-item.overdue .task-item-title,
.day-view-task-item.overdue .task-title {
    color: #9E9E9E !important;
    font-weight: normal; /* 过期任务去掉粗体，降低强调感 */
}

/* 3. 复选框和图标：调整为更淡的灰色，融入背景 */
.task-item.overdue .task-item-checkbox,
.day-view-task-item.overdue .task-item-checkbox {
    border-color: #E0E0E0 !important; /* 极淡灰色边框 */
    background-color: rgba(255,255,255,0.5); /* 半透明白色填充 */
}

.task-item.overdue i,
.day-view-task-item.overdue .task-title i {
     color: #D0D0D0 !important; /* 图标变得更淡 */
}

/* 4. 优先级保证：如果任务已完成，必须覆盖掉过期的黄色 */
.task-item.completed,
.day-view-task-item.completed {
    background-color: #F2F2F7 !important; /* 恢复完成态的灰色底 */
    color: #AEAEB2 !important;           /* 文字灰色 */
    border-left-color: transparent;      /* 去掉黄色边框 */
    box-shadow: none;
}



