/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4A90E2;
    --primary-dark: #357ABD;
    --success-color: #52C41A;
    --warning-color: #FAAD14;
    --danger-color: #F5222D;
    --info-color: #1890FF;
    --bg-color: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

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

.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* ========== 登录页面 ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.login-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.login-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.role-selection {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-hover);
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.role-selection h2 {
    color: var(--text-primary);
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.role-card {
    padding: 25px 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.role-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.role-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #E6F4FF 0%, #BAE0FF 100%);
}

.role-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.role-card h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.role-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.user-name-input {
    margin-bottom: 25px;
    text-align: left;
}

.user-name-input label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.user-name-input input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.user-name-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ========== 按钮样式 ========== */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background: #CCC;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s;
}

.btn-icon:hover {
    background: rgba(0,0,0,0.05);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ========== 顶部导航 ========== */
.top-nav {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.current-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.role-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.role-badge[data-role="planner"] { background: #FFF3E0; color: #E65100; }
.role-badge[data-role="dev"] { background: #E3F2FD; color: #1565C0; }
.role-badge[data-role="operation"] { background: #E8F5E9; color: #2E7D32; }
.role-badge[data-role="customer"] { background: #FCE4EC; color: #C2185B; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ========== 统计栏 ========== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 25px 30px;
    background: white;
    margin: 20px 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.stat-card {
    text-align: center;
    padding: 15px;
}

.stat-num {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 5px;
}

/* ========== 标签页导航 ========== */
.tab-nav {
    display: flex;
    gap: 5px;
    padding: 0 30px;
    background: white;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 15px 25px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

/* ========== 内容区域 ========== */
.content-area {
    padding: 25px 30px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 150px;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ========== 卡片列表 ========== */
.card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border-left: 4px solid var(--primary-color);
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.card-actions {
    display: flex;
    gap: 10px;
}

/* ========== 状态标签 ========== */
.status-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-tag.normal { background: #E6F7E6; color: #52C41A; }
.status-tag.risk { background: #FFF7E6; color: #FAAD14; }
.status-tag.delay { background: #FFF1F0; color: #F5222D; }
.status-tag.pause { background: #F5F5F5; color: #8C8C8C; }

/* 需求状态 */
.status-tag.pending { background: #FFF7E6; color: #FAAD14; }
.status-tag.confirmed { background: #E6F7FF; color: #1890FF; }
.status-tag.developing { background: #E6F7FF; color: #4A90E2; }
.status-tag.testing { background: #F9F0FF; color: #722ED1; }
.status-tag.approved { background: #E6F7E6; color: #52C41A; }
.status-tag.rejected { background: #FFF1F0; color: #F5222D; }
.status-tag.suspended { background: #F5F5F5; color: #8C8C8C; }

/* 任务状态 */
.status-tag.todo { background: #F5F5F5; color: #8C8C8C; }
.status-tag.in-progress { background: #E6F7FF; color: #1890FF; }
.status-tag.pending-review { background: #FFF7E6; color: #FAAD14; }
.status-tag.done { background: #E6F7E6; color: #52C41A; }

/* 优先级 */
.priority-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.priority-tag.p0 { background: #F5222D; color: white; }
.priority-tag.p1 { background: #FA541C; color: white; }
.priority-tag.p2 { background: #FAAD14; color: white; }
.priority-tag.p3 { background: #BFBFBF; color: white; }

/* 严重程度 */
.severity-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.severity-tag.fatal { background: #F5222D; color: white; }
.severity-tag.serious { background: #FA541C; color: white; }
.severity-tag.normal { background: #FAAD14; color: white; }
.severity-tag.light { background: #BFBFBF; color: white; }

/* ========== 模态框 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

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

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

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
}

/* ========== 表单样式 ========== */
.form-group {
    margin-bottom: 20px;
}

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

.form-group label .required {
    color: #F5222D;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

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

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success { background: #52C41A; }
.toast.error { background: #F5222D; }
.toast.warning { background: #FAAD14; }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* ========== 加载状态 ========== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .role-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        padding: 15px;
        gap: 10px;
    }
    
    .stat-num {
        font-size: 2rem;
    }
    
    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        padding: 12px 15px;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .card-list {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* ========== 项目阶段颜色 ========== */
.phase-tag {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.phase-tag.presales { background: #FFF3E0; color: #E65100; }
.phase-tag.requirements { background: #E3F2FD; color: #1565C0; }
.phase-tag.developing { background: #E8F5E9; color: #2E7D32; }
.phase-tag.testing { background: #F9F0FF; color: #722ED1; }
.phase-tag.delivered { background: #F5F5F5; color: #595959; }
.phase-tag.archived { background: #E0E0E0; color: #424242; }
