/* ========== 客户列表页面专属样式 ========== */

/* 排序箭头样式 - 紧贴表头文字右边 */
.customer-sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.customer-sortable-th .sort-arrow::after {
    content: '↓';
    display: inline-block;
    margin-left: 4px;
    font-size: 12px;
    color: #9ca3af;
    transition: transform 0.2s;
}

.customer-sortable-th[data-sort-direction='desc'] .sort-arrow::after {
    content: '↓';
    color: #4f46e5;
}

.customer-sortable-th[data-sort-direction='asc'] .sort-arrow::after {
    content: '↑';
    color: #4f46e5;
}

/* 页面标题区 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--main-text-primary);
}

.page-actions {
    display: flex;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.btn-icon {
    font-size: 16px;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-default {
    background: var(--main-card-bg);
    color: var(--main-text-primary);
    border: 1px solid var(--main-border-color);
}

.btn-default:hover {
    background: var(--main-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* 标签页 */
.tabs {
    background: var(--main-card-bg);
    border-radius: 12px;
    padding: 0 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.tab-list {
    display: flex;
    gap: 8px;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    color: var(--main-text-secondary);
    font-weight: 500;
}

.tab-item:hover {
    color: var(--primary-color);
}

.tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-count {
    background: var(--main-bg);
    color: var(--main-text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.tab-green {
    background: #e6f8f2;
    color: #10b981;
}

.tab-orange {
    background: #fffbeb;
    color: #f59e0b;
}

.tab-gray {
    background: #f3f4f6;
    color: #6b7280;
}

.tab-red {
    background: #fee2e2;
    color: #ef4444;
}

/* 状态标签样式 */
.status-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-serving {
    background: #f0fdf4;
    color: #16a34a;
}

.status-expired {
    background: #fffbeb;
    color: #f59e0b;
}

.status-refunded {
    background: #f3f4f6;
    color: #6b7280;
}

.status-unassigned {
    background: #fee2e2;
    color: #ef4444;
}

/* 筛选区 */
.filter-section {
    background: var(--main-card-bg);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--main-border-color);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
    flex: 0 0 auto;
}

.filter-item.filter-actions {
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
    margin-left: auto;
    flex: 0 0 auto;
}

.filter-label {
    font-size: 13px;
    color: var(--main-text-secondary);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.filter-input,
.filter-select {
    padding: 10px 14px;
    border: 1.5px solid var(--main-border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--main-text-primary);
    background: var(--main-card-bg);
    transition: all 0.3s;
    min-width: 160px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-bg), 0 2px 6px rgba(74, 144, 226, 0.2);
    transform: translateY(-1px);
}

.filter-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.filter-select:hover,
.filter-input:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 按钮样式优化 */
.filter-item.filter-actions .btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-item.filter-actions .btn-primary {
    background: var(--primary-color);
    border: none;
}

.filter-item.filter-actions .btn-primary:hover {
    transform: translateY(-2px);
    background: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.filter-item.filter-actions .btn-default {
    background: var(--main-card-bg);
    border: 1.5px solid var(--main-border-color);
    color: var(--main-text-secondary);
}

.filter-item.filter-actions .btn-default:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.filter-label {
    font-size: 13px;
    color: var(--main-text-secondary);
    font-weight: 500;
}

.filter-input,
.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--main-border-color);
    border-radius: 6px;
    font-size: 14px;
    color: var(--main-text-primary);
    background: var(--main-card-bg);
    transition: all 0.3s;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.filter-select {
    cursor: pointer;
}

/* 表格区域 */
.table-section {
    background: var(--main-card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    overflow: visible;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--main-border-color);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--main-text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.divider {
    width: 1px;
    height: 20px;
    background: var(--main-border-color);
}

.toolbar-text {
    font-size: 14px;
    color: var(--main-text-secondary);
}

.toolbar-text strong {
    color: var(--primary-color);
}

/* 确保表格基础样式对齐 */
.customer-table th,
.customer-table td {
    text-align: left;
    padding: 12px 16px;
    vertical-align: middle;
}

.customer-table .checkbox-col {
    width: 50px;
    text-align: center;
}

.customer-table .name-col {
    min-width: 320px;
}

.rating-placeholder {
    width: 48px;
    display: flex;
    justify-content: flex-start;
    flex-shrink: 0;
}

.customer-name {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    min-height: 32px;
}

.action-buttons-customer .btn {
    width: auto;
    min-width: 72px;
    padding: 6px 10px;
}

.row-more-actions {
    position: relative;
    z-index: 20;
}

.more-actions-toggle {
    min-width: 36px !important;
    width: 36px !important;
    padding: 6px 0 !important;
    font-size: 18px;
    line-height: 1;
}

.more-actions-menu {
    position: absolute;
    top: calc(100% + 6px);
    bottom: auto;
    right: 0;
    min-width: 120px;
    background: #fff;
    border: 1px solid var(--main-border-color);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    padding: 6px;
    display: none;
    z-index: 9999;
}

.row-more-actions.open .more-actions-menu {
    display: block;
}

.customer-table td:last-child {
    position: relative;
    overflow: visible;
}

.row-more-actions.open {
    z-index: 1000;
}

.table-container {
    overflow: visible !important;
    position: relative;
    z-index: 1;
}

.more-action-item {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--main-text-primary);
    cursor: pointer;
}

.more-action-item:hover {
    background: #f3f4f6;
}

.customer-icons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 74px;
    min-width: 74px;
    justify-content: flex-start;
    flex-shrink: 0;
}

.refund-mark {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    line-height: 1;
}

.tail-mark {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #f59e0b;
    line-height: 1;
}

/* 评级徽章 */
.rating-badge {
    display: inline-block !important;
    padding: 4px 12px !important;
    border-radius: 16px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #fff !important;
    flex-shrink: 0 !important;
    min-width: 32px !important;
    text-align: center !important;
    margin-right: 8px !important;
}

/* S 级 - 橙色 */
.rating-s {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
}

/* A 级 - 绿色 */
.rating-a {
    background: linear-gradient(135deg, #10b981, #059669) !important;
}

/* B 级 - 蓝色 */
.rating-b {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
}

/* C 级 - 灰色 */
.rating-c {
    background: linear-gradient(135deg, #6b7280, #4b5563) !important;
}

.customer-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.customer-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.name-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.name-blue {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.name-green {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.name-orange {
    background: linear-gradient(135deg, #fb923c, #f97316);
}

.name-purple {
    background: linear-gradient(135deg, #c084fc, #a855f7);
}

.name-cyan {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
}

.name-pink {
    background: linear-gradient(135deg, #f472b6, #ec4899);
}

.type-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.type-personal {
    background: var(--primary-bg);
    color: var(--primary-color);
}

.type-company {
    background: #f3e8ff;
    color: #a855f7;
}

.lawyer-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lawyer-avatar {
    font-size: 18px;
}

.status-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-serving {
    background: #f0fdf4;
    color: #16a34a;
}

.status-expired {
    background: #fffbeb;
    color: #f59e0b;
}

.status-refunded {
    background: #f3f4f6;
    color: #6b7280;
}

/* 首访状态标签样式 */
.status-countdown {
    background: #fffbeb;
    color: #f59e0b;
}

.status-normal {
    background: #f0fdf4;
    color: #16a34a;
}

.status-delayed {
    background: #fee2e2;
    color: #ef4444;
}

.source-tag {
    color: var(--main-text-secondary);
    font-size: 13px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.action-buttons .btn {
    width: 100px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-align: center;
}

/* 确保操作列有足够的宽度 */
.customer-table th:last-child,
.customer-table td:last-child {
    width: 240px;
    text-align: center;
}

/* 分页 */
.pagination-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--main-border-color);
}

.pagination-left {
    font-size: 14px;
    color: var(--main-text-secondary);
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-size-selector label {
    font-size: 14px;
    color: var(--main-text-secondary);
}

.page-size-selector select {
    padding: 6px 12px;
    border: 1px solid var(--main-border-color);
    border-radius: 6px;
    font-size: 14px;
    color: var(--main-text-primary);
    background: var(--main-card-bg);
    cursor: pointer;
    transition: all 0.3s;
}

.page-size-selector select:hover {
    border-color: var(--primary-color);
}

.page-size-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.pagination-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--main-border-color);
    background: var(--main-card-bg);
    color: var(--main-text-primary);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-more {
    color: var(--main-text-secondary);
}

/* ========== 模态框样式 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    position: relative;
    background: var(--main-card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-lg {
    max-width: 700px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--main-border-color);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--main-text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--main-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--main-bg);
    color: var(--main-text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--main-border-color);
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--main-text-primary);
}

.required {
    color: #ef4444;
}

.form-select,
.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--main-border-color);
    border-radius: 6px;
    font-size: 14px;
    color: var(--main-text-primary);
    background: var(--main-card-bg);
    transition: all 0.3s;
    font-family: inherit;
}

.form-select:focus,
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 13px;
    color: var(--main-text-secondary);
    margin-top: 8px;
    margin-bottom: 0;
}

.import-steps {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
}

.import-steps li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--main-text-primary);
    border-bottom: 1px solid var(--main-border-color);
}

.import-steps li:last-child {
    border-bottom: none;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* 选中的客户标签 */
.selected-customers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: var(--main-bg);
    border-radius: 6px;
    min-height: 48px;
}

.customer-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--main-card-bg);
    border: 1px solid var(--main-border-color);
    border-radius: 20px;
    font-size: 13px;
    color: var(--main-text-primary);
}

.tag-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--main-text-secondary);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.tag-close:hover {
    background: var(--main-bg);
    color: #ef4444;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .filter-row {
        flex-direction: column;
    }
    
    .filter-item.filter-actions {
        margin-left: 0;
        width: 100%;
    }
    
    .filter-item {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .page-actions {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .tab-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-item {
        white-space: nowrap;
    }
    
    .table-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .pagination-section {
        flex-direction: column;
        gap: 16px;
        align-items: center;
    }
}


