/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 头部样式 */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header h1 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    flex-wrap: wrap;
}

nav ul li {
    margin: 0 1rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav ul li a:hover {
    background-color: #34495e;
}

/* 主要内容样式 */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

section {
    background-color: white;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

/* 统计卡片样式 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.stat-card {
    background-color: #ecf0f1;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stat-card h3 {
    color: #7f8c8d;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.stat-card p {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: bold;
}

/* 工作安排样式 */
.schedule-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

#add-task-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

#add-task-btn:hover {
    background-color: #2980b9;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-selector input[type="date"] {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 表格样式 */
.tasks-container {
    overflow-x: auto;
}

#tasks-table {
    width: 100%;
    border-collapse: collapse;
}

#tasks-table th, #tasks-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

#tasks-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

#tasks-table tr:hover {
    background-color: #f8f9fa;
}

/* 优先级和状态样式 */
.priority-high {
    background-color: #ffdddd;
    color: #c0392b;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.priority-medium {
    background-color: #fff3cd;
    color: #856404;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.priority-low {
    background-color: #d4edda;
    color: #155724;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.status-pending {
    background-color: #e9ecef;
    color: #495057;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.status-in_progress {
    background-color: #d1ecf1;
    color: #0c5460;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.status-delayed {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* 任务操作按钮 */
.task-actions {
    display: flex;
    gap: 5px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.task-row:hover .task-actions {
    opacity: 1;
}

.task-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    transform: translateY(0);
}

.task-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.edit-btn {
    background-color: #2196F3;
    color: white;
}

.edit-btn:hover {
    background-color: #1976D2;
}

.delete-btn {
    background-color: #f44336;
    color: white;
}

.delete-btn:hover {
    background-color: #d32f2f;
}

.complete-btn {
    background-color: #4CAF50;
    color: white;
}

.complete-btn:hover {
    background-color: #45a049;
}

/* 动画和过渡效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* 应用动画 */
.card {
    animation: fadeIn 0.4s ease-out;
}

.modal-content {
    animation: slideIn 0.3s ease-out;
}

/* 加载状态 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 表单增强 */
.form-group {
    position: relative;
    margin-bottom: 16px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
    outline: none;
}

/* 表单验证反馈 */
.form-group input:invalid,
.form-group select:invalid,
.form-group textarea:invalid {
    border-color: #f44336;
}

.form-group .error-message {
    color: #f44336;
    font-size: 12px;
    margin-top: 4px;
    min-height: 16px;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.in-progress {
    background-color: #cce5ff;
    color: #004085;
}

.status-badge.completed {
    background-color: #d4edda;
    color: #155724;
}

/* 优先级标签 */
.priority-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.priority-badge.high {
    background-color: #f8d7da;
    color: #721c24;
}

.priority-badge.medium {
    background-color: #fff3cd;
    color: #856404;
}

.priority-badge.low {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* 高亮效果 */
.highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.3s;
}

.close-btn:hover {
    color: #2c3e50;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

#save-task-btn,
#login-form button {
    width: 100%;
    padding: 0.8rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

#save-task-btn:hover,
#login-form button:hover {
    background-color: #2980b9;
}

/* 页面切换样式 */
#dashboard-section,
#daily-schedule-section,
#statistics-section {
    display: none;
}

#dashboard-section.active,
#daily-schedule-section.active,
#statistics-section.active {
    display: block;
}

/* 统计分析部分样式 */
#statistics-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-controls select,
.filter-controls input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#custom-date-range {
    display: none;
    align-items: center;
    gap: 8px;
}

#custom-date-range input {
    min-width: 140px;
}

.btn-refresh {
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-refresh:hover {
    background-color: #45a049;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stats-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.stats-card.full-width {
    grid-column: 1 / -1;
}

.stats-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.stats-card-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.stats-date {
    font-size: 12px;
    color: #666;
    background-color: #f5f5f5;
    padding: 4px 8px;
    border-radius: 12px;
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 图表容器 */
.chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

/* 统计信息样式 */
.stats-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.stats-number {
    font-size: 32px;
    font-weight: bold;
    color: #2196F3;
    margin-bottom: 5px;
}

.stats-detail {
    font-size: 14px;
    color: #666;
}

/* 优先级分布样式 */
.priority-distribution {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.priority-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.priority-label {
    width: 80px;
    font-size: 14px;
    color: #333;
}

.priority-bar {
    flex: 1;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.priority-bar.high {
    background-color: #f44336;
    width: 0%; /* 动态设置 */
}

.priority-bar.medium {
    background-color: #ff9800;
    width: 0%; /* 动态设置 */
}

.priority-bar.low {
    background-color: #4caf50;
    width: 0%; /* 动态设置 */
}

/* 状态统计样式 */
.status-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-label {
    width: 80px;
    font-size: 14px;
    color: #333;
}

.status-bar {
    flex: 1;
    height: 24px;
    border-radius: 4px;
    background-color: #e0e0e0;
}

.status-bar.pending {
    background-color: #ffc107;
}

.status-bar.in-progress {
    background-color: #2196f3;
}

.status-bar.completed {
    background-color: #4caf50;
}

.status-count {
    width: 30px;
    text-align: right;
    font-weight: bold;
    color: #333;
}

/* 负责人统计样式 */
.assignee-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.assignee-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.assignee-name {
    font-weight: bold;
    color: #333;
}

.assignee-tasks {
    color: #666;
    font-size: 14px;
}

/* 页脚样式 */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* 响应式设计 - 平板设备 */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    header {
        padding: 15px;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .nav-menu {
        font-size: 14px;
    }
    
    .nav-menu li {
        margin-left: 15px;
    }
    
    .card {
        padding: 15px;
    }
    
    .task-form input,
    .task-form select,
    .task-form textarea {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* 响应式设计 - 移动设备 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .nav-menu {
        justify-content: center;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .nav-menu li {
        margin: 5px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .login-form {
        width: 100%;
        max-width: 400px;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        width: 100%;
        min-width: 600px;
    }
    
    .task-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .task-actions button {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls select,
    .filter-controls input,
    .btn-refresh {
        width: 100%;
    }
    
    #custom-date-range {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* 响应式设计 - 小屏移动设备 */
@media (max-width: 480px) {
    .logo {
        font-size: 1.2rem;
    }
    
    .nav-menu {
        font-size: 12px;
    }
    
    .card {
        padding: 10px;
    }
    
    .task-form label {
        font-size: 14px;
    }
    
    .stats-card {
        padding: 15px;
    }
    
    .stats-number {
        font-size: 24px;
    }
    
    .chart-container {
        height: 150px;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .schedule-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    #tasks-table {
        font-size: 0.9rem;
    }
    
    #tasks-table th, #tasks-table td {
        padding: 0.5rem;
    }
    
    .action-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    nav ul li {
        margin: 0 0.5rem;
    }
    
    nav ul li a {
        padding: 0.3rem 0.6rem;
        font-size: 0.9rem;
    }
    
    section {
        padding: 1rem;
    }
    
    .modal-content {
        margin: 20% auto;
        padding: 1.5rem;
    }
}