/**
 * Shop Assist AI - Simple Chat Styles
 * Optimized for WordPress integration
 */

/* Shop Assist AI - Simple CSS */
/* WordPress Plugin Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Chat Window Container */
#unishine-shop-assist-container {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Chat Button */
#unishine-shop-assist-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s;
}

#unishine-shop-assist-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* Chat Window */
.unishine-shop-assist-window {
    position: fixed;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#unishine-shop-assist-window.active {
    display: flex;
}

/* Header */
.unishine-shop-assist-header {
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.unishine-shop-assist-header h3 {
    margin: 0;
    font-size: 16px;
}

.unishine-shop-assist-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
}



/* Tab 标签页样式 */
.unishine-shop-assist-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.wp-ai-tab-button {
    flex: 1;
    padding: 12px 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.wp-ai-tab-button:hover {
    background: rgba(77, 166, 255, 0.05);
    color: #333;
}

.wp-ai-tab-button.active {
    color: #4DA6FF;
    border-bottom-color: #4DA6FF;
    font-weight: 500;
}

.wp-ai-tab-icon {
    font-size: 16px;
}

/* Tab Content Area */
.wp-ai-tab-content {
    display: none;
    flex-direction: column;
    height: calc(100% - 48px);
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.wp-ai-tab-content.active {
    display: flex;
}

/* Chat Main Area */
.unishine-shop-assist-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.unishine-shop-assist-messages {
    flex: 1;
    overflow-y: scroll;
    padding: 16px 0 16px 16px;
    font-size: 14px;
    background: #f8f9fa;
}

.unishine-shop-assist-input-area {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.unishine-shop-assist-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.unishine-shop-assist-send {
    padding: 10px 20px;
    background: linear-gradient(135deg, #4DA6FF, #1a8cff);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* History Styles */
.wp-ai-history-header {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
}

.wp-ai-export-btn,
.wp-ai-clear-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.wp-ai-export-btn:hover {
    background: #4DA6FF;
    color: white;
    border-color: #4DA6FF;
}

.wp-ai-clear-btn:hover {
    background: #ff4d4f;
    color: white;
    border-color: #ff4d4f;
}

.wp-ai-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.wp-ai-history-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wp-ai-history-item:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.wp-ai-history-question {
    font-size: 13px;
    color: #333;
    margin-bottom: 4px;
    font-weight: 500;
}

.wp-ai-history-time {
    font-size: 11px;
    color: #999;
}

/* Settings Styles */
.wp-ai-settings-content {
    flex: 1;
    padding: 16px;
}

.wp-ai-setting-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.wp-ai-setting-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.wp-ai-setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wp-ai-setting-item select.wp-ai-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    margin-top: 6px;
}

.wp-ai-setting-item select.wp-ai-select:focus {
    border-color: #4DA6FF;
    outline: none;
    box-shadow: 0 0 0 2px rgba(77, 166, 255, 0.1);
}

.wp-ai-clear-history {
    width: 100%;
    padding: 10px;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 12px;
    transition: all 0.2s ease;
}

.wp-ai-clear-history:hover {
    background: #ff7875;
}

/* Loading Animation */
.wp-ai-loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin: 8px 0;
}

.wp-ai-loading-dots {
    display: flex;
    gap: 4px;
}

.wp-ai-loading-dots span {
    width: 8px;
    height: 8px;
    background: #4DA6FF;
    border-radius: 50%;
    animation: wp-ai-bounce 1.4s infinite ease-in-out both;
}

.wp-ai-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.wp-ai-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes wp-ai-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.wp-ai-loading-text {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Typing Animation */
#wp-ai-typing-message::after {
    content: '|';
    animation: wp-ai-blink 1s infinite;
}

@keyframes wp-ai-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Chat Window Enhancements */
.unishine-shop-assist-window {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.unishine-shop-assist-window:not(.active) {
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
}

.unishine-shop-assist-window.active {
    transform: translateY(0);
    opacity: 1;
}

/* 消息布局样式 */
.unishine-shop-assist-message {
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    animation: wp-ai-slide-in 0.3s ease-out;
}

.unishine-shop-assist-message.user {
    justify-content: flex-end !important;
}

.unishine-shop-assist-message-content {
    /*display: flex !important; */
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
}

.unishine-shop-assist-message.bot .unishine-shop-assist-message-content {
    background: white;
    color: #333;
}

.unishine-shop-assist-message.user .unishine-shop-assist-message-content {
    background: #4DA6FF;
    color: white;
}

/* Message Animation */
@keyframes wp-ai-slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wp-ai-slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button Hover Effects */
.unishine-shop-assist-send {
    transition: all 0.2s ease;
}

.unishine-shop-assist-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(77, 166, 255, 0.4);
}

.unishine-shop-assist-send:active:not(:disabled) {
    transform: scale(0.95);
}

/* Input Focus Effects */
.unishine-shop-assist-input:focus {
    box-shadow: 0 0 0 3px rgba(77, 166, 255, 0.1);
    transition: box-shadow 0.2s ease;
}

/* Scrollbar Styling */
.unishine-shop-assist-messages::-webkit-scrollbar {
    width: 4px;
}

.unishine-shop-assist-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.unishine-shop-assist-messages::-webkit-scrollbar-thumb {
    background: #4DA6FF;
    border-radius: 3px;
}

.unishine-shop-assist-messages::-webkit-scrollbar-thumb:hover {
    background: #1a8cff;
}

/* Knowledge Base Card Styles */
.wp-ai-knowledge-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 8px 0;
}

.wp-ai-answer-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    animation: wp-ai-card-slide-in 0.4s ease-out;
    animation-fill-mode: both;
}

.wp-ai-answer-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #4DA6FF;
}

.wp-ai-answer-card-number {
    font-size: 11px;
    color: #4DA6FF;
    font-weight: 600;
    margin-bottom: 6px;
}

.wp-ai-answer-card-content {
    font-size: 13px;
    line-height: 1.6;
    color: #333;
    max-height: 60px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Main Answer Card */
.wp-ai-answer-card.main-answer {
    background: linear-gradient(135deg, #e9f8ff 0%, #f0fbff 100%);
    border: 2px solid #4DA6FF;
    box-shadow: 0 4px 12px rgba(77, 166, 255, 0.2);
}

.wp-ai-answer-card.main-answer .wp-ai-answer-card-content {
    font-weight: 500;
    max-height: none; /* Main answer displayed fully */
}

/* Expanded State */
.wp-ai-answer-card.expanded .wp-ai-answer-card-content {
    max-height: 500px;
}

@keyframes wp-ai-card-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Theme: Dark */
.unishine-theme-dark .wp-ai-answer-card {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

.unishine-theme-dark .wp-ai-answer-card-content {
    color: #e0e0e0;
}

.unishine-theme-dark .wp-ai-answer-card.main-answer {
    background: linear-gradient(135deg, #1a3a4a 0%, #2a4a5a 100%);
    border-color: #4DA6FF;
}

/* Theme: Green */
.unishine-theme-green .wp-ai-answer-card:hover {
    border-color: #52c41a;
}

.unishine-theme-green .wp-ai-answer-card-number {
    color: #52c41a;
}

.unishine-theme-green .wp-ai-answer-card.main-answer {
    background: linear-gradient(135deg, #f0fff4 0%, #f6ffed 100%);
    border-color: #52c41a;
}

/* Theme: Purple */
.unishine-theme-purple .wp-ai-answer-card:hover {
    border-color: #722ed1;
}

.unishine-theme-purple .wp-ai-answer-card-number {
    color: #722ed1;
}

.unishine-theme-purple .wp-ai-answer-card.main-answer {
    background: linear-gradient(135deg, #f9f0ff 0%, #f9f0ff 100%);
    border-color: #722ed1;
}

/* Theme: Red */
.unishine-theme-red .wp-ai-answer-card:hover {
    border-color: #f5222d;
}

.unishine-theme-red .wp-ai-answer-card-number {
    color: #f5222d;
}

.unishine-theme-red .wp-ai-answer-card.main-answer {
    background: linear-gradient(135deg, #fff1f0 0%, #fff1f0 100%);
    border-color: #f5222d;
}

@keyframes wp-ai-card-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Theme Styles */
/* Blue Theme (Default) */
.unishine-theme-blue .unishine-shop-assist-header {
    background: linear-gradient(135deg, #4DA6FF, #1a8cff);
}

.unishine-theme-blue .unishine-shop-assist-send {
    background: linear-gradient(135deg, #4DA6FF, #1a8cff);
}

.unishine-theme-blue .wp-ai-answer-card:hover {
    border-color: #4DA6FF;
}

/* 绿色主题 */
.unishine-theme-green .unishine-shop-assist-header {
    background: linear-gradient(135deg, #52c41a, #389e0d);
}

.unishine-theme-green .unishine-shop-assist-send {
    background: linear-gradient(135deg, #52c41a, #389e0d);
}

.unishine-theme-green .unishine-shop-assist-user-message .unishine-shop-assist-message-content {
    background: linear-gradient(135deg, #52c41a, #389e0d);
}

.unishine-theme-green .wp-ai-answer-card.wp-ai-main-answer {
    background: linear-gradient(135deg, #f6ffed 0%, #f0fff0 100%);
    border-color: #52c41a;
}

.unishine-theme-green .wp-ai-loading-dots span {
    background: #52c41a;
}

/* 紫色主题 */
.unishine-theme-purple .unishine-shop-assist-header {
    background: linear-gradient(135deg, #722ed1, #531dab);
}

.unishine-theme-purple .unishine-shop-assist-send {
    background: linear-gradient(135deg, #722ed1, #531dab);
}

.unishine-theme-purple .unishine-shop-assist-user-message .unishine-shop-assist-message-content {
    background: linear-gradient(135deg, #722ed1, #531dab);
}

.unishine-theme-purple .wp-ai-answer-card.wp-ai-main-answer {
    background: linear-gradient(135deg, #f9f0ff 0%, #f5f0ff 100%);
    border-color: #722ed1;
}

.unishine-theme-purple .wp-ai-loading-dots span {
    background: #722ed1;
}

/* 红色主题 */
.unishine-theme-red .unishine-shop-assist-header {
    background: linear-gradient(135deg, #f5222d, #cf1322);
}

.unishine-theme-red .unishine-shop-assist-send {
    background: linear-gradient(135deg, #f5222d, #cf1322);
}

.unishine-theme-red .unishine-shop-assist-user-message .unishine-shop-assist-message-content {
    background: linear-gradient(135deg, #f5222d, #cf1322);
}

.unishine-theme-red .wp-ai-answer-card.wp-ai-main-answer {
    background: linear-gradient(135deg, #fff1f0 0%, #ffeded 100%);
    border-color: #f5222d;
}

.unishine-theme-red .wp-ai-loading-dots span {
    background: #f5222d;
}

/* 深色主题 */
.unishine-theme-dark .unishine-shop-assist-window {
    background: #1f1f1f;
}

.unishine-theme-dark .unishine-shop-assist-header {
    background: linear-gradient(135deg, #333, #1a1a1a);
}

.unishine-theme-dark .unishine-shop-assist-messages {
    background: #2a2a2a;
}

.unishine-theme-dark .unishine-shop-assist-message-content {
    background: #3a3a3a;
    color: #e0e0e0;
}

.unishine-theme-dark .wp-ai-answer-card {
    background: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

.unishine-theme-dark .wp-ai-answer-card:hover {
    border-color: #4DA6FF;
    background: #404040;
}

.unishine-theme-dark .wp-ai-answer-card-content {
    color: #e0e0e0;
}

.unishine-theme-dark .unishine-shop-assist-input {
    background: #2a2a2a;
    border-color: #444;
}

.unishine-theme-dark .unishine-shop-assist-input input {
    background: #3a3a3a;
    color: #e0e0e0;
    border-color: #555;
}

/* 响应式优化 */
@media (max-width: 480px) {
    .unishine-shop-assist-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
    }
    
    .unishine-shop-assist-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .wp-ai-answer-card {
        padding: 12px;
    }
    
    .wp-ai-answer-card-content {
        font-size: 12px;
    }
}

/* Iframe 内部样式 */
body.unishine-shop-assist-window {
    position: relative !important;
    width: 380px !important;
    height: 600px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}
