/* History Page Styles */

.history-container {
    width: 100%;
    background-color: #f5f7fa;
}

.history-header {
    background: #fff;
    padding: 20px 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 40px;
    height: 40px;
}

.history-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #f9fafb;
    border-color: #155EEF;
    color: #155EEF;
}

.btn-back img {
    width: 16px;
    height: 16px;
}

.history-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.search-bar {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.search-input-container {
    position: relative;
    flex: 1;
}

.search-input-container input {
    width: 100%;
    padding: 12px 160px 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input-container input:focus {
    border-color: #155EEF;
}

.search-icon {
    position: absolute;
    right: 140px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0.5;
    pointer-events: none;
}

.clear-search-button {
    position: absolute;
    right: 90px;
    top: 50%;
    transform: translateY(-50%);
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #6b7280;
    transition: all 0.2s;
}

.clear-search-button:hover {
    background: #e5e7eb;
    color: #374151;
    border-color: #9ca3af;
}

.search-button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: #155EEF;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 72px;
    height: 36px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.search-button:hover {
    background: #1047c4;
    transform: translateY(-50%) translateY(-1px);
    box-shadow: 0 2px 8px rgba(21, 94, 239, 0.3);
}

.search-button:active {
    transform: translateY(-50%) translateY(0);
}

.search-button img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

.filter-container {
    display: flex;
    align-items: center;
}

.filter-select {
    height: 40px;
    padding: 0 32px 0 12px;
    border: 1px solid #d9d9d9; /* antd standard border color */
    border-radius: 6px;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.85); /* antd text color */
    background-color: #fff;
    background-image: url('../image/group-down.svg');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
    box-shadow: none;
}

.filter-select:hover {
    border-color: #40a9ff; /* antd blue-5 */
}

.filter-select:focus {
    border-color: #40a9ff;
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); /* antd focus shadow */
}

.filter-select option {
    padding: 8px 12px;
    color: rgba(0, 0, 0, 0.65);
}

.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 30px;
}

.conversation-item {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.conversation-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
    border-color: #155EEF;
}

/* 好评样式 - 自然绿色 */
.conversation-item.rating-good {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border-color: #22c55e;
    box-shadow: 0 1px 3px rgba(34, 197, 94, 0.1);
}

.conversation-item.rating-good:hover {
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.2);
    border-color: #16a34a;
}

/* 差评样式 - 自然红色 */
.conversation-item.rating-bad {
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
    border-color: #ef4444;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.1);
}

.conversation-item.rating-bad:hover {
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
    border-color: #dc2626;
}

/* 混合评价样式 - 自然黄色 */
.conversation-item.rating-mixed {
    background: linear-gradient(135deg, #fefce8 0%, #ffffff 100%);
    border-color: #eab308;
    box-shadow: 0 1px 3px rgba(234, 179, 8, 0.1);
}

.conversation-item.rating-mixed:hover {
    box-shadow: 0 4px 20px rgba(234, 179, 8, 0.2);
    border-color: #ca8a04;
}

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

.conv-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.conv-icon {
    font-size: 20px;
}

.conv-callee {
    color: #155EEF;
}

/* 评价指示器样式 */
.rating-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    margin-left: 8px;
    animation: fadeIn 0.3s ease;
}

.rating-indicator.good {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.rating-indicator.bad {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.conv-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.conv-time {
    font-size: 12px;
    color: #6b7280;
}

.conv-body {
    margin-bottom: 12px;
    cursor: pointer;
}

.conv-query, .conv-output {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
}

.conv-query strong, .conv-output strong {
    color: #1f2937;
    margin-right: 4px;
}

.conv-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.footer-left {
    flex: 1;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trace-id {
    font-size: 12px;
    color: #9ca3af;
    font-family: 'Courier New', monospace;
}

.btn-view {
    padding: 8px 16px;
    background: #155EEF;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-view:hover {
    background: #1047c4;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(21, 94, 239, 0.3);
}

.empty-state, .error-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.empty-state img {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p, .error-state p {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
}

.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 30px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-btn {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 40px;
}

.page-btn:hover:not(:disabled):not(.active) {
    background: #f9fafb;
    border-color: #155EEF;
    color: #155EEF;
}

.page-btn.active {
    background: #155EEF;
    color: #fff;
    border-color: #155EEF;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-ellipsis {
    padding: 8px 4px;
    color: #9ca3af;
}

.page-info {
    font-size: 14px;
    color: #6b7280;
}

/* Responsive Design */
@media (max-width: 768px) {
    .history-header {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
    }

    .header-left {
        width: 100%;
    }

    .header-right {
        width: 100%;
    }

    .btn-back {
        width: 100%;
        justify-content: center;
    }

    .history-content {
        padding: 20px 16px;
    }

    .conversation-item {
        padding: 20px;
    }

    .conv-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .conv-actions {
        gap: 8px;
    }

    .conv-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .footer-right {
        width: 100%;
        justify-content: flex-end;
    }

    .btn-view {
        padding: 10px 16px;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .rating-indicator {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
}

/* Conversation Group Styles */
.conversation-group {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    margin-bottom: 16px;
}

.conversation-group:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border-color: #155EEF;
}

.conversation-group.rating-good {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border-color: #22c55e;
    box-shadow: 0 1px 3px rgba(34, 197, 94, 0.1);
}

.conversation-group.rating-good:hover {
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.2);
    border-color: #16a34a;
}

.conversation-group.rating-bad {
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
    border-color: #ef4444;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.1);
}

.conversation-group.rating-bad:hover {
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
    border-color: #dc2626;
}

.conversation-group.rating-mixed {
    background: linear-gradient(135deg, #fefce8 0%, #ffffff 100%);
    border-color: #eab308;
    box-shadow: 0 1px 3px rgba(234, 179, 8, 0.1);
}

.conversation-group.rating-mixed:hover {
    box-shadow: 0 4px 20px rgba(234, 179, 8, 0.2);
    border-color: #ca8a04;
}

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

.conversation-count-badge {
    background: #e5e7eb;
    color: #374151;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.btn-toggle-group {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 12px;
}

.btn-toggle-group:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.toggle-icon {
    display: inline-block;
    font-size: 12px;
    transition: transform 0.2s;
}

.group-summary {
    cursor: pointer;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.group-summary:hover {
    background: #f3f4f6;
}

.group-conversations {
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
    margin-top: 12px;
}

.conversation-item-in-group {
    background: #fafbfc;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.conversation-item-in-group:hover {
    background: #f3f4f6;
    border-color: #155EEF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.conversation-item-in-group.rating-good {
    background: #f0fdf4;
    border-color: #86efac;
}

.conversation-item-in-group.rating-bad {
    background: #fef2f2;
    border-color: #fca5a5;
}

.conversation-item-in-group.rating-mixed {
    background: #fefce8;
    border-color: #fde047;
}

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

.conv-title-small {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.conv-number {
    background: #155EEF;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.conv-time-small {
    font-size: 12px;
    color: #6b7280;
}

.conv-body-small {
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.conv-body-small:hover {
    background: rgba(21, 94, 239, 0.05);
}

.conv-query-small {
    margin-bottom: 6px;
    font-size: 13px;
    color: #374151;
    line-height: 1.5;
}

.conv-output-small {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin-top: 4px;
}

.conv-footer-small {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.trace-id-small {
    font-size: 11px;
    color: #9ca3af;
    font-family: monospace;
}

.btn-view-small {
    padding: 6px 12px;
    background: #155EEF;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-view-small:hover {
    background: #1e40af;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(21, 94, 239, 0.3);
}
