/* =============================================
   一匠任务系统 - 用户端样式 (移动端优先)
   主色调: #5B5FC7 (紫蓝) + 渐变
   ============================================= */

:root {
    --primary: #5B5FC7;
    --primary-light: #7B7FE0;
    --primary-dark: #484DB8;
    --bg: #F5F6FA;
    --card-bg: #FFFFFF;
    --text: #1A1A2E;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --danger: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
    --info: #3B82F6;
    --radius: 14px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --max-width: 480px;
    --nav-height: 64px;
    --header-height: 56px;
}

* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    max-width: var(--max-width); margin: 0 auto;
    min-height: 100vh; position: relative;
    padding-bottom: calc(var(--nav-height) + 20px);
}

/* ==== Login Page ==== */
.login-page {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; padding: 40px 24px;
    background: linear-gradient(135deg, #5B5FC7 0%, #8B5CF6 50%, #6366F1 100%);
}
.login-logo { text-align: center; margin-bottom: 40px; }
.login-logo .icon { font-size: 56px; margin-bottom: 12px; }
.login-logo h1 { color: #fff; font-size: 28px; font-weight: 700; letter-spacing: 2px; }
.login-logo p { color: rgba(255,255,255,0.8); font-size: 14px; margin-top: 6px; }
.login-form {
    width: 100%; background: #fff; border-radius: 20px; padding: 32px 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
.login-form h2 { font-size: 22px; margin-bottom: 24px; text-align: center; color: var(--text); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.form-input {
    width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 12px;
    font-size: 15px; transition: all 0.2s; outline: none; background: #F9FAFB;
}
.form-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(91,95,199,0.1); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 24px; border-radius: 12px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; border: none; outline: none;
}
.btn-primary { width: 100%; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(91,95,199,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-secondary); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }

/* ==== Header ==== */
.app-header {
    position: sticky; top: 0; z-index: 100; background: var(--card-bg);
    padding: 0 16px; height: var(--header-height); display: flex; align-items: center;
    justify-content: space-between; border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}
.app-header .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--primary); }
.app-header .brand .logo-icon { font-size: 24px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-actions .avatar {
    width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px; font-weight: 600;
}
.notification-badge {
    position: relative; font-size: 20px; cursor: pointer;
}
.notification-badge .badge {
    position: absolute; top: -4px; right: -4px; width: 16px; height: 16px;
    background: var(--danger); border-radius: 50%; font-size: 10px;
    color: #fff; display: flex; align-items: center; justify-content: center;
}

/* ==== Task Filter Button ==== */
.task-filter-btn {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 4px 10px; border-radius: 14px;
    font-size: 12px; font-weight: 600; color: #fff;
    background: #5B5FC7;
    cursor: pointer; user-select: none;
    white-space: nowrap; line-height: 1.4;
}
.task-filter-btn .filter-arrow { font-size: 9px; opacity: 0.7; margin-left: 1px; }

.task-filter-menu {
    position: fixed; top: 62px; right: 16px; z-index: 999;
    background: var(--card-bg); border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 120px; overflow: hidden;
}
.task-filter-menu .filter-option {
    padding: 10px 16px; font-size: 13px; cursor: pointer;
    color: var(--text); border-bottom: 1px solid var(--border);
}
.task-filter-menu .filter-option:last-child { border-bottom: none; }
.task-filter-menu .filter-option:hover { background: var(--bg); }
.task-filter-menu .filter-option.active {
    color: var(--primary); font-weight: 600;
    background: var(--primary-light, #5B5FC710);
}

/* ==== Greeting Banner ==== */
.greeting-banner {
    padding: 20px 16px; background: linear-gradient(135deg, var(--primary) 0%, #8B5CF6 100%);
    color: #fff; border-radius: 0 0 24px 24px;
}
.greeting-banner h2 { font-size: 22px; font-weight: 700; }
.greeting-banner p { font-size: 13px; opacity: 0.85; margin-top: 4px; }

/* ==== Stats Row ==== */
.stats-row {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 16px;
}
.stat-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
}
.stat-card .stat-icon { font-size: 28px; }
.stat-card .stat-info .stat-value { font-size: 22px; font-weight: 700; }
.stat-card .stat-info .stat-label { font-size: 12px; color: var(--text-secondary); }

/* ==== Section ==== */
.section { padding: 0 16px 12px; }
.section-title {
    font-size: 16px; font-weight: 700; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center;
}
.section-title a { font-size: 13px; color: var(--primary); text-decoration: none; }

/* ==== Filter Tabs ==== */
.filter-tabs {
    display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
    padding: 7px 16px; border-radius: 20px; font-size: 13px; white-space: nowrap;
    background: var(--card-bg); color: var(--text-secondary); border: 1px solid var(--border);
    cursor: pointer; transition: all 0.2s; font-weight: 500;
}
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ==== Task Card ==== */
.task-list { padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.task-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 14px 16px;
    box-shadow: var(--shadow); cursor: pointer; transition: all 0.2s;
    border-left: 4px solid transparent; margin-bottom: 8px;
}
.task-card:active { transform: scale(0.985); }
.task-card.pinned { border-left-color: var(--warning); }
.task-card .task-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.task-card .task-title { font-size: 15px; font-weight: 600; flex: 1; margin-right: 8px; }
.task-card .task-star { font-size: 18px; cursor: pointer; color: #ccc; }
.task-card .task-star.active { color: #FFD700; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--text-secondary); }
.task-meta .tag {
    padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
    color: #fff; white-space: nowrap;
}
.status-badge {
    padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600;
}
.overdue-badge {
    display: inline-block; padding: 3px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 700; color: #fff; background: #FF3B30;
    animation: overdue-pulse 1.5s ease-in-out infinite;
}
@keyframes overdue-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.task-card .deadline { display: flex; align-items: center; gap: 4px; }
.task-card .deadline.overdue { color: var(--danger); }
.task-card .assignee { display: flex; align-items: center; gap: 4px; margin-top: 8px; }

.user-pick-list { max-height: 50vh; overflow-y: auto; }
.user-pick-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border-radius: 10px; cursor: pointer; transition: background 0.15s;
}
.user-pick-item:hover { background: var(--bg); }
.user-pick-item.already-assigned { opacity: 0.6; }
.task-card .assignee .mini-avatar {
    width: 22px; height: 22px; border-radius: 50%; background: #E8E8F0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--text-secondary);
}

/* ==== Progress Bar ==== */
.progress-bar {
    height: 4px; background: #E5E7EB; border-radius: 2px; margin-top: 8px; overflow: hidden;
}
.progress-bar .fill {
    height: 100%; background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 2px; transition: width 0.3s;
}

/* ==== Kanban View ==== */
.kanban-container { display: flex; gap: 12px; padding: 16px; overflow-x: auto; scrollbar-width: none; }
.kanban-container::-webkit-scrollbar { display: none; }
.kanban-column {
    min-width: 260px; max-width: 300px; background: #F0F1F5; border-radius: var(--radius);
    padding: 12px; flex-shrink: 0;
}
.kanban-column .col-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.kanban-column .col-title { font-size: 14px; font-weight: 700; }
.kanban-column .col-count {
    background: #fff; padding: 2px 8px; border-radius: 10px; font-size: 12px;
}
.kanban-column .task-card { margin-bottom: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }

/* ==== Calendar View ==== */
.calendar-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.calendar-header .month-label { font-size: 18px; font-weight: 700; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; padding: 0 16px; }
.calendar-grid .day-header { text-align: center; font-size: 12px; color: var(--text-secondary); padding: 8px 0; font-weight: 600; }
.calendar-grid .day {
    aspect-ratio: 1; display: flex; flex-direction: column; align-items: center;
    padding: 4px; background: var(--card-bg); border-radius: 8px; cursor: pointer;
    font-size: 13px; position: relative;
}
.calendar-grid .day.today { background: var(--primary); color: #fff; font-weight: 700; }
.calendar-grid .day.has-tasks::after {
    content: ''; width: 6px; height: 6px; background: var(--primary);
    border-radius: 50%; position: absolute; bottom: 4px;
}
.calendar-grid .day.other-month { color: #ccc; }

/* ==== Modal ==== */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 200; align-items: flex-end; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-content {
    background: var(--card-bg); border-radius: 20px 20px 0 0; width: 100%;
    max-width: var(--max-width); max-height: 85vh; overflow-y: auto;
    padding: 24px 20px; animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 18px; }
.modal-close { font-size: 24px; cursor: pointer; color: var(--text-secondary); }

/* ==== Bottom Navigation ==== */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--max-width); height: var(--nav-height);
    background: var(--card-bg); border-top: 1px solid var(--border);
    display: flex; justify-content: space-around; align-items: center;
    z-index: 150; padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    text-decoration: none; color: var(--text-secondary); font-size: 11px;
    padding: 6px 12px; transition: all 0.2s;
}
.bottom-nav .nav-item .nav-icon { font-size: 22px; }
.bottom-nav .nav-item.active { color: var(--primary); font-weight: 600; }

/* ==== Notifications ==== */
.notif-list { padding: 0; }
.notif-item {
    padding: 16px; border-bottom: 1px solid var(--border); cursor: pointer;
    display: flex; gap: 12px; align-items: flex-start;
    transition: background 0.2s;
}
.notif-item:active { background: #F9FAFB; }
.notif-item.unread { background: #F0F1FF; }
.notif-item .notif-icon { font-size: 24px; }
.notif-item .notif-content { flex: 1; }
.notif-item .notif-title { font-size: 14px; font-weight: 600; }
.notif-item .notif-text { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.notif-item .notif-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.notif-item .notif-time { font-size: 11px; color: #999; }
.notif-item .notif-creator { font-size: 11px; color: var(--primary, #5B5FC7); }

/* ==== Toast ==== */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: #1A1A2E; color: #fff; padding: 12px 24px; border-radius: 12px;
    font-size: 14px; z-index: 999; opacity: 0; transition: opacity 0.3s;
    pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ==== Utilities ==== */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.p-16 { padding: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* ==== Page Tabs ==== */
.page-tabs {
    display: flex; border-bottom: 2px solid var(--border); background: var(--card-bg);
}
.page-tab {
    flex: 1; text-align: center; padding: 12px; font-size: 14px; font-weight: 600;
    color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all 0.2s;
}
.page-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ==== Empty State ==== */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-secondary); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ==== FAB (Floating Action Button) ==== */
.fab {
    position: fixed; bottom: calc(var(--nav-height) + 20px); right: max(20px, calc((100% - var(--max-width)) / 2 + 20px));
    width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(91,95,199,0.4); cursor: pointer; z-index: 140;
    transition: all 0.2s; border: none;
}
.fab:active { transform: scale(0.9); }

/* ==== Pagination ==== */
.pagination { display: flex; justify-content: center; gap: 8px; padding: 16px; }
.pagination button {
    padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--card-bg); cursor: pointer; font-size: 13px;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ==== Comment Section ==== */
.comment-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-item .comment-user { font-weight: 600; font-size: 13px; }
.comment-item .comment-text { font-size: 14px; margin-top: 4px; }
.comment-item .comment-time { font-size: 11px; color: #999; margin-top: 4px; }
