/* css/style.css */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --gray-color: #95a5a6;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
    overflow-x: hidden;
}

/* 移动端优化 */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

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

/* 按钮样式 */
.btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255,255,255,0.3);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: var(--transition);
    width: 100%;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--dark-color);
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: var(--transition);
    width: 100%;
}

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

/* 主容器 */
.container {
    padding: 70px 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

/* 区域样式 */
.section {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--box-shadow);
}

.section h2 {
    color: var(--dark-color);
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--gray-color);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

/* 任务容器 */
.tasks-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    background: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    padding: 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.task-item:hover {
    transform: translateX(2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

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

.task-channel {
    font-size: 12px;
    background: var(--secondary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
}

.task-time {
    font-size: 11px;
    color: var(--gray-color);
}

.task-content {
    margin-bottom: 8px;
    line-height: 1.4;
}

.task-employee {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 500;
}

/* 渠道网格 */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.channel-card {
    background: white;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    padding: 15px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.channel-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.channel-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.channel-name {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
}

.channel-next {
    font-size: 12px;
    color: var(--gray-color);
    margin-bottom: 8px;
}

.channel-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--secondary-color);
    position: absolute;
    top: 10px;
    right: 10px;
}

.channel-indicator.pending {
    background: var(--warning-color);
}

/* 员工统计 */
.employees-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.employee-stat {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 12px;
    text-align: center;
}

.employee-name {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
}

.employee-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.employee-label {
    font-size: 11px;
    color: var(--gray-color);
}

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

.modal {
    background: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--gray-color);
}

.modal-body {
    padding: 15px;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

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

/* 搜索框 */
.search-box {
    position: relative;
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
}

/* 筛选器 */
.filter-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 120px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 13px;
    background: white;
}

/* 表格 */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: #f8f9fa;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--dark-color);
    border-bottom: 2px solid #eee;
}

.table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.table tr:hover {
    background: #f8f9fa;
}

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

.empty-state i {
    font-size: 40px;
    margin-bottom: 10px;
    color: #ddd;
}

/* 消息提示 */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    width: 90%;
}

.toast {
    background: var(--dark-color);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toastSlideIn 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.toast.success {
    background: var(--secondary-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

.toast-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

/* 标签 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-primary {
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background: rgba(46, 204, 113, 0.1);
    color: var(--secondary-color);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning-color);
}

/* 优先级指示器 */
.priority-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.priority-1 { background: #95a5a6; }
.priority-2 { background: #3498db; }
.priority-3 { background: #2ecc71; }
.priority-4 { background: #f39c12; }
.priority-5 { background: #e74c3c; }

/* 响应式调整 */
@media (max-width: 480px) {
    .container {
        padding: 70px 10px 15px;
    }
    
    .section {
        padding: 12px;
    }
    
    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    
    .employees-stats {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
}

/* 排序列表项样式 */
.sortable-item {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.sortable-handle {
    cursor: move;
    color: var(--gray-color);
    margin-right: 10px;
}

.sortable-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sortable-item.dragging {
    opacity: 0.5;
    background: #e9ecef;
}

/* 标签页样式 */
.tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-color);
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover:not(.active) {
    color: var(--dark-color);
}

/* 帮助文本 */
.help-text {
    font-size: 12px;
    color: var(--gray-color);
    margin-top: 5px;
}

/* 静态表单控件 */
.form-control-static {
    padding: 10px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    min-height: 40px;
    display: flex;
    align-items: center;
}

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

.tooltip .tooltip-text {
    visibility: hidden;
    background: var(--dark-color);
    color: white;
    text-align: center;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

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

/* 响应式表格改进 */
@media (max-width: 768px) {
    .table th, 
    .table td {
        padding: 8px 6px;
        font-size: 12px;
    }
    
    .modal {
        max-width: 95%;
    }
}
/* 渠道卡片增强样式 */
.channel-card {
    background: white;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    transition: var(--transition);
    position: relative;
}

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

.channel-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--dark-color);
}

.channel-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.channel-info {
    flex: 1;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--gray-color);
    margin-bottom: 3px;
}

.info-item i {
    width: 14px;
    text-align: center;
}

.info-item strong {
    color: var(--dark-color);
}

.next-employee-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    margin-left: 10px;
}

.channel-actions {
    display: flex;
    gap: 5px;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
}

.btn-icon.small {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

/* 位置徽章 */
.position-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: bold;
}

/* 分配规则指示器 */
.rule-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning-color);
    margin-left: 5px;
    vertical-align: middle;
}

/* 员工状态 */
.employee-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.employee-status.active {
    background: var(--secondary-color);
}

.employee-status.inactive {
    background: var(--gray-color);
}

/* 分配历史时间线 */
.timeline {
    position: relative;
    padding-left: 20px;
    margin: 15px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #eee;
}

.timeline-item {
    position: relative;
    margin-bottom: 10px;
    padding-left: 15px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
}

.timeline-time {
    font-size: 11px;
    color: var(--gray-color);
    margin-bottom: 2px;
}

.timeline-content {
    font-size: 13px;
    color: var(--dark-color);
}

/* 统计卡片 */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
}

/* 进度条 */
.progress-bar-container {
    width: 100px;
    height: 20px;
    background: #eee;
    border-radius: 10px;
    position: relative;
    display: inline-block;
}

.progress-bar {
    height: 100%;
    background: var(--secondary-color);
    border-radius: 10px;
    transition: width 0.3s;
}

.progress-bar-container span {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    line-height: 20px;
    color: var(--dark-color);
}

/* 员工分配历史 */
.assignment-history {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: var(--transition);
}

.history-item:hover {
    background: #f8f9fa;
}

.history-time {
    font-size: 12px;
    color: var(--gray-color);
    min-width: 80px;
}

.history-employee {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.employee-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.history-content {
    flex: 1;
    font-size: 13px;
    color: var(--dark-color);
    word-break: break-word;
}

/* 优先级显示优化 */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.priority-badge-1 {
    background: rgba(149, 165, 166, 0.1);
    color: #95a5a6;
    border: 1px solid rgba(149, 165, 166, 0.3);
}

.priority-badge-2 {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.priority-badge-3 {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.priority-badge-4 {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.priority-badge-5 {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* 在任务列表中突出显示高优先级 */
.task-item.high-priority {
    border-left-color: #e74c3c;
    background: linear-gradient(90deg, rgba(231, 76, 60, 0.05), transparent);
}

.task-item.medium-priority {
    border-left-color: #f39c12;
}

.task-item.low-priority {
    border-left-color: #95a5a6;
}

/* 修复模态框关闭按钮 */
.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6c757d;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #dc3545;
}

/* 修复按钮图标对齐 */
.btn-icon i {
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

/* 确保所有模态框内容可见 */
.modal {
    max-height: 85vh;
    overflow-y: auto;
}

.modal-body {
    max-height: calc(85vh - 120px);
    overflow-y: auto;
}

/* 修复响应式问题 */
@media (max-width: 576px) {
    .modal {
        width: 95%;
        margin: 10px auto;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* 修复管理页面图标颜色 - 简单直接 */
#manageContent i,
.channel-order-modal i,
.modal-body i {
    color: #333 !important;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    #manageContent i,
    .channel-order-modal i,
    .modal-body i {
        color: #e0e0e0 !important;
    }
}

/* 渠道分配顺序页面优化 */
.channel-order-table td {
    padding: 8px 6px !important;
    vertical-align: middle !important;
}

/* 员工列优化 */
.employee-cell {
    display: flex;
    align-items: center;
    white-space: nowrap;
    min-width: 120px;
}

.employee-color {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.employee-name {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

/* 输入框优化 */
.weight-input,
.limit-input {
    width: 60px !important;
    padding: 4px 6px !important;
    height: 28px !important;
    font-size: 12px !important;
}

/* 状态标签 */
.status-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    white-space: nowrap;
}

/* 操作按钮 */
.table-action-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 2px;
}

.table-action-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
}

/* 添加员工区域优化 */
.add-employee-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 15px;
}

.employee-select {
    flex: 1;
    min-width: 150px;
    height: 32px;
    padding: 0 10px;
}

.add-btn {
    height: 32px;
    padding: 0 15px;
    white-space: nowrap;
}

/* 取消按钮修复 */
#cancelBtn {
    margin-right: auto;
}