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

:root {
    /* Mira Villa 专业配色方案 */
    --primary-color: #1e3a8a;      /* 深蓝色 - 主色 */
    --secondary-color: #0891b2;    /* 青色 - 次色 */
    --accent-color: #f97316;       /* 橙色 - 强调色 */
    --success-color: #10b981;      /* 绿色 */
    --warning-color: #f59e0b;      /* 黄色 */
    --danger-color: #ef4444;       /* 红色 */
    --bg-color: #f8fafc;           /* 浅灰背景 */
    --card-bg: #ffffff;            /* 白色卡片 */
    --text-primary: #1f2937;       /* 深灰文字 */
    --text-secondary: #6b7280;     /* 中灰文字 */
    --border-color: #e5e7eb;       /* 边框色 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* 页面容器 */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: flex;
}

/* 登录页面 */
#login-page {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #0891b2 100%);
}

.login-container {
    background: white;
    padding: 3rem;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 400px;
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 按钮样式 */
.btn-primary,
.btn-secondary,
.btn-link {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-link {
    background: transparent;
    color: var(--primary-color);
    padding: 0.5rem 1rem;
}

.btn-link:hover {
    background: var(--bg-color);
}

/* 错误提示 */
.error-message {
    color: var(--danger-color);
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

/* 语言切换 */
.language-switch {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.lang-btn,
.lang-btn-small {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.lang-btn:hover,
.lang-btn-small:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.lang-btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* 主页面布局 */
#main-page {
    flex-direction: column;
}

.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 250px;
    background: white;
    padding: 1.5rem 0;
    border-right: 1px solid var(--border-color);
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 0.5rem;
}

.sidebar a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

/* 内容区域 */
.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.view-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.view-header select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

/* 卡片网格 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
}

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

.project-card h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.project-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s;
}

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* 工序时间轴 */
.process-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.process-item {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.process-item.status-completed {
    border-left-color: var(--success-color);
}

.process-item.status-in_progress {
    border-left-color: var(--primary-color);
}

.process-item.status-waiting_material {
    border-left-color: var(--warning-color);
}

.process-item.status-weather_stop {
    border-left-color: var(--secondary-color);
}

.process-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.process-code {
    background: var(--bg-color);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.process-header h4 {
    flex: 1;
    margin: 0;
}

.process-status {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.process-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.process-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.process-progress .progress-bar {
    flex: 1;
}

.process-progress .progress-text {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 50px;
    text-align: right;
}

.process-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* 加载状态 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 提示消息 */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 3000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar ul {
        display: flex;
        overflow-x: auto;
    }

    .sidebar li {
        margin-bottom: 0;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .header {
        padding: 1rem;
    }

    .content {
        padding: 1rem;
    }
}


/* 今日任务样式 */
.daily-date {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 0.5rem;
}

.task-section {
    margin-bottom: 2rem;
}

.task-section h4 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.task-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.task-code {
    background: var(--bg-color);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--primary-color);
}

.task-header h4 {
    margin: 0;
    flex: 1;
}

.task-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.task-progress .progress-bar {
    flex: 1;
}

.progress-text {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 50px;
    text-align: right;
}

.task-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-sm.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-sm.btn-primary:hover {
    background: #1d4ed8;
}

.empty-hint {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* 任务卡片响应式 */
@media (max-width: 768px) {
    .task-card {
        padding: 1rem;
    }
    
    .task-info {
        font-size: 0.85rem;
    }
    
    .task-actions {
        flex-direction: column;
    }
    
    .btn-sm {
        width: 100%;
    }
}

/* ===== 子任务样式 ===== */
.subtasks-container {
    min-height: 400px;
}

.subtasks-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.subtasks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.subtask-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: all 0.3s;
}

.subtask-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.subtask-item.completed {
    opacity: 0.7;
    border-color: var(--success-color);
}

.subtask-item.in-progress {
    border-left: 3px solid var(--primary-color);
}

.subtask-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.subtask-info h5 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.subtask-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.subtask-status {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.875rem;
}

.subtask-progress {
    margin-bottom: 0.75rem;
}

.subtask-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.subtask-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-xs {
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-xs.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-xs.btn-primary:hover {
    background: #1d4ed8;
}

.btn-xs.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-xs.btn-success:hover {
    background: #059669;
}

.btn-sm.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-sm.btn-secondary:hover {
    background: #475569;
}

.empty-hint {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.875rem;
}
