/**
 * D7 线索流失预警 — 样式表
 *
 * CSS 前缀: acw- (Acquisition Churn Warning)
 * 参考: acquisition-followup.css 整体风格
 */

/* ═══════════════════════════════════════════════════
   布局容器
   ═══════════════════════════════════════════════════ */

.acw-page {
    padding: 24px;
    max-width: 1440px;
    margin: 0 auto;
}

.acw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.acw-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.acw-subtitle {
    font-size: 13px;
    color: #8c8c8c;
    margin-top: 4px;
    font-weight: normal;
}

.acw-update-time {
    font-size: 12px;
    color: #bfbfbf;
}

/* ═══════════════════════════════════════════════════
   统计卡片行
   ═══════════════════════════════════════════════════ */

.acw-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.acw-stats-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-left: 4px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.acw-stats-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.acw-stats-card--high {
    border-left-color: #ff4d4f;
    background: #fff2f0;
}

.acw-stats-card--high:hover {
    border-color: #ff4d4f;
}

.acw-stats-card--medium {
    border-left-color: #faad14;
    background: #fffbe6;
}

.acw-stats-card--medium:hover {
    border-color: #faad14;
}

.acw-stats-card--low {
    border-left-color: #52c41a;
    background: #f6ffed;
}

.acw-stats-card--low:hover {
    border-color: #52c41a;
}

.acw-stats-card--rate {
    border-left-color: #1890ff;
    background: #e6f7ff;
}

.acw-stats-card--rate:hover {
    border-color: #1890ff;
}

.acw-stats-card--active {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    border-color: #1890ff;
}

.acw-stats-label {
    font-size: 12px;
    color: #8c8c8c;
    margin-bottom: 6px;
}

.acw-stats-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.1;
}

.acw-stats-value--high {
    color: #ff4d4f;
}

.acw-stats-value--medium {
    color: #faad14;
}

.acw-stats-value--low {
    color: #52c41a;
}

.acw-stats-value--rate {
    color: #1890ff;
}

.acw-stats-desc {
    font-size: 11px;
    color: #bfbfbf;
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════
   筛选栏
   ═══════════════════════════════════════════════════ */

.acw-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
}

.acw-filter-label {
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.acw-filter-select {
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
    min-width: 120px;
}

.acw-filter-select:focus {
    border-color: #1890ff;
    outline: none;
}

.acw-filter-search {
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    color: #333;
    min-width: 200px;
    margin-left: auto;
}

.acw-filter-search:focus {
    border-color: #1890ff;
    outline: none;
}

/* ═══════════════════════════════════════════════════
   线索列表
   ═══════════════════════════════════════════════════ */

.acw-clue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.acw-clue-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-left: 4px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px 20px;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.acw-clue-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #d0d0d0;
}

.acw-clue-card--expanded {
    border-color: #1890ff;
    border-left-width: 4px;
    box-shadow: 0 2px 12px rgba(24, 144, 255, 0.12);
}

/* 风险等级颜色变体 */
.acw-clue-card__risk-high {
    border-left-color: #ff4d4f;
}

.acw-clue-card__risk-high:hover {
    border-color: #ff4d4f;
}

.acw-clue-card__risk-medium {
    border-left-color: #faad14;
}

.acw-clue-card__risk-medium:hover {
    border-color: #faad14;
}

.acw-clue-card__risk-low {
    border-left-color: #52c41a;
}

.acw-clue-card__risk-low:hover {
    border-color: #52c41a;
}

.acw-clue-card-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.acw-clue-info {
    flex: 1;
    min-width: 0;
}

.acw-clue-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.acw-clue-name-risk {
    display: inline-block;
    font-size: 11px;
    color: #ff4d4f;
    background: #fff2f0;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

.acw-clue-meta {
    font-size: 12px;
    color: #8c8c8c;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.acw-clue-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 风险等级标签 */
.acw-risk-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.acw-risk-tag--high {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

.acw-risk-tag--medium {
    background: #fffbe6;
    color: #d48806;
    border: 1px solid #ffe58f;
}

.acw-risk-tag--low {
    background: #f6ffed;
    color: #389e0d;
    border: 1px solid #b7eb8f;
}

.acw-risk-tag--none {
    background: #f0f0f0;
    color: #8c8c8c;
    border: 1px solid #d9d9d9;
}

/* 沉默天数 */
.acw-silent-days {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    min-width: 100px;
    text-align: center;
}

.acw-silent-days--high {
    color: #ff4d4f;
}

.acw-silent-days--medium {
    color: #faad14;
}

.acw-silent-days--low {
    color: #52c41a;
}

/* 展开按钮 */
.acw-clue-expand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.acw-expand-icon {
    font-size: 14px;
    color: #bfbfbf;
    transition: transform 0.2s;
}

.acw-clue-card--expanded .acw-expand-icon {
    transform: rotate(180deg);
}

/* ═══════════════════════════════════════════════════
   详情展开面板
   ═══════════════════════════════════════════════════ */

.acw-detail-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.acw-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.acw-detail-section {
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    padding: 14px 16px;
}

.acw-detail-section--full {
    grid-column: 1 / -1;
}

.acw-detail-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.acw-detail-field {
    display: flex;
    margin-bottom: 6px;
    font-size: 13px;
}

.acw-detail-field-label {
    color: #8c8c8c;
    min-width: 80px;
    flex-shrink: 0;
}

.acw-detail-field-value {
    color: #333;
    font-weight: 500;
}

.acw-detail-field-value--danger {
    color: #ff4d4f;
}

.acw-detail-field-value--warning {
    color: #faad14;
}

/* 流失原因列表 */
.acw-reason-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.acw-reason-item {
    padding: 6px 0;
    font-size: 13px;
    color: #555;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.acw-reason-item:last-child {
    border-bottom: none;
}

.acw-reason-marker {
    color: #ff4d4f;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 1px;
}

.acw-reason-primary {
    font-weight: 600;
    color: #ff4d4f;
}

/* 跟进历史时间线 */
.acw-timeline {
    position: relative;
    padding-left: 20px;
}

.acw-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #f0f0f0;
}

.acw-timeline-item {
    position: relative;
    padding: 6px 0 12px 16px;
    font-size: 13px;
    color: #555;
}

.acw-timeline-item:last-child {
    padding-bottom: 0;
}

.acw-timeline-dot {
    position: absolute;
    left: -18px;
    top: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d9d9d9;
}

.acw-timeline-dot--active {
    background: #1890ff;
}

.acw-timeline-dot--silent {
    background: #ff4d4f;
}

.acw-timeline-dot--replied {
    background: #52c41a;
}

.acw-timeline-time {
    font-size: 11px;
    color: #bfbfbf;
}

.acw-timeline-content {
    color: #333;
}

/* ═══════════════════════════════════════════════════
   AI 分析区域
   ═══════════════════════════════════════════════════ */

.acw-ai-section {
    background: #fafbff;
    border: 1px solid #e6f0ff;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.acw-ai-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.acw-ai-badge {
    font-size: 10px;
    background: #1890ff;
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 400;
}

.acw-ai-rule-badge {
    font-size: 10px;
    background: #f0f0f0;
    color: #8c8c8c;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 400;
}

.acw-ai-analysis-text {
    font-size: 13px;
    color: #555;
    line-height: 1.8;
    margin-bottom: 12px;
}

.acw-ai-suggestions {
    list-style: none;
    padding: 0;
    margin: 0;
}

.acw-ai-suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    font-size: 13px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.acw-ai-suggestion-item:last-child {
    border-bottom: none;
}

.acw-ai-suggestion-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1890ff;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.acw-ai-meta {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 12px;
    color: #8c8c8c;
}

.acw-ai-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* AI 分析按钮 */
.acw-analyze-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 13px;
    border-radius: 4px;
    background: #1890ff;
    border: 1px solid #1890ff;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.acw-analyze-btn:hover {
    background: #40a9ff;
    border-color: #40a9ff;
}

.acw-analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.acw-analyze-btn--loading {
    background: #91d5ff;
    border-color: #91d5ff;
    cursor: wait;
}

/* ═══════════════════════════════════════════════════
   分页
   ═══════════════════════════════════════════════════ */

.acw-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding: 12px 0;
}

.acw-pagination-info {
    font-size: 13px;
    color: #8c8c8c;
}

/* ═══════════════════════════════════════════════════
   操作按钮
   ═══════════════════════════════════════════════════ */

.acw-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    font-size: 13px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.acw-btn:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.acw-btn--primary {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}

.acw-btn--primary:hover {
    background: #40a9ff;
    border-color: #40a9ff;
    color: #fff;
}

.acw-btn--text {
    border: none;
    padding: 4px 8px;
    background: none;
    color: #8c8c8c;
}

.acw-btn--text:hover {
    color: #1890ff;
}

.acw-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════
   加载/空/错误状态
   ═══════════════════════════════════════════════════ */

.acw-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #8c8c8c;
    font-size: 14px;
}

.acw-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #1890ff;
    border-radius: 50%;
    animation: acw-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes acw-spin {
    to { transform: rotate(360deg); }
}

.acw-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #bfbfbf;
}

.acw-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.acw-empty-text {
    font-size: 14px;
    margin-bottom: 4px;
}

.acw-empty-desc {
    font-size: 12px;
    color: #d9d9d9;
}

.acw-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #8c8c8c;
    font-size: 14px;
}

.acw-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 骨架屏 */
.acw-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: acw-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes acw-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.acw-skeleton--title {
    width: 200px;
    height: 20px;
    margin-bottom: 12px;
}

.acw-skeleton--text {
    width: 100%;
    height: 14px;
    margin-bottom: 8px;
}

.acw-skeleton--text-short {
    width: 60%;
    height: 14px;
    margin-bottom: 8px;
}

.acw-skeleton--card {
    width: 100%;
    height: 80px;
    margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════
   响应式
   ═══════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .acw-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .acw-detail-grid {
        grid-template-columns: 1fr;
    }

    .acw-clue-card-main {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .acw-page {
        padding: 16px;
    }

    .acw-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .acw-stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .acw-filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .acw-filter-search {
        margin-left: 0;
        width: 100%;
    }

    .acw-clue-meta {
        flex-direction: column;
        gap: 4px;
    }

    .acw-stats-value {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .acw-page {
        padding: 12px;
    }

    .acw-stats-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .acw-clue-card-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .acw-clue-expand {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .acw-silent-days {
        min-width: auto;
        text-align: left;
    }

    .acw-detail-grid {
        grid-template-columns: 1fr;
    }

    .acw-ai-meta {
        flex-direction: column;
        gap: 4px;
    }
}
