/**
 * 智能话术助手页面样式
 * Smart Reply Page Styles
 */

/* ==================== 页面全局禁止滚动 ==================== */
html:has(.smart-reply-page),
html:has(.smart-reply-page) body {
    overflow: hidden !important;
    height: 100dvh !important;
}

body:has(.smart-reply-page) .app-container {
    overflow: hidden !important;
}

/* ==================== 页面容器 ==================== */
.smart-reply-page {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

.smart-reply-fixed-top {
    flex-shrink: 0;
}

/* ==================== 顶部标题栏 ==================== */
.smart-reply-header.cs-header,
.cs-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 10;
}

.smart-reply-header .back-btn.cs-header-back,
.cs-header-back {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.smart-reply-header .back-btn.cs-header-back:hover {
    background: rgba(255, 255, 255, 0.1);
}

.cs-header-text {
    flex: 1;
    min-width: 0;
}

.smart-reply-header .header-title.cs-header-title,
.cs-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-header-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 2px;
}

/* ==================== 商品档案选择器 ==================== */
.profile-selector,
.cs-product-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
}

.profile-selector.collapsed {
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.profile-summary {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.profile-summary-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-select.cs-product-select,
.cs-product-select {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 11px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.profile-select.cs-product-select:focus,
.cs-product-select:focus {
    border-color: rgba(74, 205, 163, 0.5);
}

.profile-select.cs-product-select option {
    color: #111;
}

.profile-add-btn.cs-add-product-btn,
.cs-add-product-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4ACDA3, #2EAF7D);
    border: none;
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(74, 205, 163, 0.2);
}

.profile-add-btn.cs-add-product-btn:active,
.cs-add-product-btn:active {
    transform: scale(0.95);
}

.profile-switch-btn {
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.profile-edit-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

/* ==================== 对话/配置 Tab 切换器 ==================== */
.smart-reply-tabs.cs-tab-switcher,
.cs-tab-switcher {
    display: flex;
    margin: 0 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 3px;
    gap: 3px;
}

.smart-reply-tab.cs-tab-btn,
.cs-tab-btn {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.smart-reply-tab.cs-tab-btn.active,
.cs-tab-btn.active {
    background: rgba(74, 205, 163, 0.15);
    color: #4ACDA3;
    font-weight: 600;
}

/* ==================== 场景标签条 ==================== */
.quick-scenarios.cs-scene-bar,
.cs-scene-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.quick-scenarios.cs-scene-bar::-webkit-scrollbar,
.cs-scene-bar::-webkit-scrollbar {
    display: none;
}

.scenarios-list {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.scenarios-list::-webkit-scrollbar {
    display: none;
}

.scenario-btn.cs-scene-tag,
.cs-scene-tag {
    flex-shrink: 0;
    padding: 7px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.scenario-btn.cs-scene-tag:hover,
.cs-scene-tag:hover {
    background: rgba(255, 255, 255, 0.08);
}

.scenario-btn.cs-scene-tag.active,
.cs-scene-tag.active {
    background: rgba(74, 205, 163, 0.12);
    border-color: rgba(74, 205, 163, 0.35);
    color: #4ACDA3;
}

/* ==================== 中间可滚动区域 ==================== */
.smart-reply-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.smart-reply-tab-content {
    display: none;
    min-height: 100%;
}

.smart-reply-tab-content.active {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* ==================== 对话区域（去边框） ==================== */
.chat-messages.cs-chat-area,
.cs-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-empty.cs-empty-state,
.cs-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.chat-empty-icon.cs-empty-icon,
.cs-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(74, 205, 163, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}

.chat-empty-title.cs-empty-title,
.cs-empty-title {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
    margin-bottom: 8px;
}

.chat-empty-desc.cs-empty-desc,
.cs-empty-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.25);
    line-height: 1.6;
}

/* 消息气泡 */
.chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    animation: messageIn 0.25s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-buyer {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.chat-message-ai .message-avatar {
    background: linear-gradient(135deg, #4ACDA3, #2EAF7D);
}

.message-content {
    max-width: 78%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 12px;
}

.chat-message-buyer .message-content {
    background: rgba(74, 205, 163, 0.15);
    border-color: rgba(74, 205, 163, 0.35);
    color: #fff;
}

.message-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 4px;
}

.chat-message-buyer .message-role {
    color: rgba(255, 255, 255, 0.62);
}

.message-text {
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    color: rgba(255, 255, 255, 0.88);
}

.message-actions {
    margin-top: 8px;
}

.copy-reply-btn {
    padding: 3px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    cursor: pointer;
}

.copy-reply-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ==================== 底部输入区域 ==================== */
.smart-reply-fixed-bottom {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
}

.billing-hint-row.cs-cost-bar,
.cs-cost-bar {
    display: flex;
    justify-content: space-between;
    padding: 6px 16px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-input-area.cs-input-wrapper,
.cs-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 8px 14px 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.02);
}

.chat-input.cs-input,
.cs-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 11px 16px;
    font-size: 14.5px;
    color: #fff;
    outline: none;
    min-height: 44px;
    max-height: 100px;
    resize: none;
    line-height: 1.45;
    transition: border-color 0.2s;
}

.chat-input.cs-input:focus,
.cs-input:focus {
    border-color: rgba(74, 205, 163, 0.4);
}

.chat-input.cs-input::placeholder,
.cs-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.chat-send-btn.cs-generate-btn,
.cs-generate-btn {
    padding: 11px 20px;
    border-radius: 14px;
    background: linear-gradient(135deg, #4ACDA3, #2EAF7D);
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(74, 205, 163, 0.2);
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-send-btn.cs-generate-btn:active,
.cs-generate-btn:active {
    transform: scale(0.96);
}

.chat-send-btn.cs-generate-btn:disabled,
.cs-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-icon.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ==================== 配置 Tab ==================== */
.config-container {
    padding-bottom: 24px;
}

.config-empty-hint.cs-config-hint,
.cs-config-hint {
    margin: 12px 16px;
    padding: 14px 16px;
    background: rgba(74, 205, 163, 0.06);
    border: 1px solid rgba(74, 205, 163, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.config-empty-hint .hint-icon.cs-config-hint-icon,
.cs-config-hint-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.config-section.cs-form-section,
.cs-form-section {
    margin: 12px 16px;
    padding: 18px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
}

.config-section .section-header.cs-form-section-title,
.cs-form-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-section .section-title {
    font-size: 15px;
    color: #fff;
    font-weight: 600;
    flex: 1;
}

.config-section .section-icon {
    font-size: 16px;
}

.form-row {
    margin-bottom: 0;
}

.form-row.cols-2,
.cs-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row.cols-3,
.cs-form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.form-group {
    margin-bottom: 14px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-group label,
.cs-field-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
    font-weight: 500;
    display: block;
}

.cs-field-label .required {
    color: #FF6B6B;
    margin-left: 2px;
}

.form-group label .hint {
    color: rgba(255, 255, 255, 0.25);
    font-size: 12px;
}

.form-group input,
.form-group textarea,
.form-group select,
.cs-form-input,
.cs-form-textarea,
.cs-form-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    margin-bottom: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.cs-form-input:focus,
.cs-form-textarea:focus,
.cs-form-select:focus {
    border-color: rgba(74, 205, 163, 0.4);
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.cs-form-input::placeholder,
.cs-form-textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-size: 13px;
}

.form-group textarea,
.cs-form-textarea {
    min-height: 72px;
    resize: vertical;
    line-height: 1.6;
}

.form-group select,
.cs-form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='rgba(255,255,255,0.3)' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* FAQ */
.add-faq-btn {
    padding: 6px 12px;
    border: 1px dashed rgba(74, 205, 163, 0.4);
    border-radius: 10px;
    background: rgba(74, 205, 163, 0.05);
    color: #4ACDA3;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-faq-btn:hover {
    background: rgba(74, 205, 163, 0.1);
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.faq-item {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.faq-question {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.faq-question .faq-q-input,
.faq-answer .faq-a-input {
    margin-bottom: 0;
}

.faq-remove-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 107, 107, 0.14);
    color: #FF6B6B;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.faq-remove-btn:hover {
    background: rgba(255, 107, 107, 0.22);
}

/* 表单操作 */
.form-actions {
    display: flex;
    gap: 12px;
    margin: 12px 16px;
    padding: 4px 0;
}

.form-actions .btn {
    flex: 1;
    padding: 11px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.form-actions .btn-primary {
    background: linear-gradient(135deg, #4ACDA3, #2EAF7D);
    color: #fff;
    border: none;
    box-shadow: 0 2px 10px rgba(74, 205, 163, 0.2);
}

.form-actions .btn-danger {
    background: rgba(255, 107, 107, 0.08);
    color: #FF6B6B;
    border: 1px solid rgba(255, 107, 107, 0.4);
}

.form-actions .btn-danger:hover {
    background: rgba(255, 107, 107, 0.16);
}

/* ==================== 响应式 ==================== */
@media (max-width: 480px) {
    .form-row.cols-2,
    .form-row.cols-3,
    .cs-form-row,
    .cs-form-row-3 {
        grid-template-columns: 1fr;
    }

    .chat-send-btn.cs-generate-btn,
    .cs-generate-btn {
        padding: 11px 16px;
    }
}
