/* AI 智能助手页面专用样式 */

/* ===== AI Hero 区域 ===== */
.ai-hero {
    padding: 30px 0 10px;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #334155 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.ai-hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
}

.ai-hero-text {
    flex: 1;
}

.ai-hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: #FFFFFF;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.ai-hero-subtitle {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
    max-width: 600px;
}

.ai-hero-illustration {
    flex: 0 0 400px;
}

.illustration-container {
    position: relative;
    width: 400px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 专业科技风格图标 */
.illustration-circle {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    background: rgba(37, 99, 235, 0.1);
    border: 2px solid rgba(37, 99, 235, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.2);
}

.circle-1 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.5);
    z-index: 2;
}

.circle-2 {
    top: 20%;
    right: 10%;
    width: 80px;
    height: 80px;
    font-size: 2rem;
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    animation: pulse-glow 3s ease-in-out infinite;
}

.circle-3 {
    bottom: 20%;
    left: 5%;
    width: 90px;
    height: 90px;
    font-size: 2.2rem;
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.3);
    animation: pulse-glow 3s ease-in-out infinite 1s;
}

.circle-4 {
    top: 10%;
    left: 15%;
    width: 70px;
    height: 70px;
    font-size: 1.8rem;
    background: rgba(147, 197, 253, 0.1);
    border-color: rgba(147, 197, 253, 0.3);
    animation: pulse-glow 3s ease-in-out infinite 0.5s;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(37, 99, 235, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 48px rgba(37, 99, 235, 0.4);
        transform: scale(1.05);
    }
}

/* ===== 主内容区域 ===== */
.ai-main-section {
    padding: 60px 0 80px;
    background-color: var(--pure-white);
}

.ai-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

/* ===== 聊天容器 ===== */
.ai-chat-container {
    background: rgb(255, 255, 255);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

/* ===== 隐私提示 ===== */
.privacy-notice {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-bottom: 1px solid #FCD34D;
    padding: 16px 24px;
}

.privacy-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: #92400E;
}

.privacy-content i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.privacy-content p {
    flex: 1;
    margin: 0;
    line-height: 1.5;
}

.privacy-close {
    background: none;
    border: none;
    color: #92400E;
    cursor: pointer;
    padding: 4px;
    font-size: 1.125rem;
    opacity: 0.7;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.privacy-close:hover {
    opacity: 1;
}

.privacy-notice.hidden {
    display: none;
}

/* ===== 聊天窗口 ===== */
.chat-window {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    max-height: 1000px;
}

/* ===== 消息列表 ===== */
.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.messages-list::-webkit-scrollbar {
    width: 8px;
}

.messages-list::-webkit-scrollbar-track {
    background: var(--light-gray-bg);
}

.messages-list::-webkit-scrollbar-thumb {
    background: var(--border-gray);
    border-radius: 4px;
}

.messages-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light-gray);
}

/* ===== 消息项 ===== */
.message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
    color: white;
}

.assistant-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
}

.message-content {
    flex: 1;
    max-width: 80%;
}

.message-text {
    background: #F5F5F7;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-dark);
    border: 1px solid #E5E5E7;
}

.user-message .message-text {
    background: #0071E3;
    color: white;
    border: 1px solid #0071E3;
}

.message-text p {
    margin: 0 0 12px 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text ul,
.message-text ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-text li {
    margin: 6px 0;
}

.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4 {
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.message-text h1:first-child,
.message-text h2:first-child,
.message-text h3:first-child,
.message-text h4:first-child {
    margin-top: 0;
}

.message-text code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875em;
}

.user-message .message-text code {
    background: rgba(255, 255, 255, 0.2);
}

.message-text pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 12px 0;
}

.message-text pre code {
    background: none;
    padding: 0;
}

.user-message .message-text pre {
    background: rgba(255, 255, 255, 0.15);
}

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

.action-btn {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-gray);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    background: var(--light-gray-bg);
    border-color: var(--border-gray);
    color: var(--text-dark);
}

.action-btn i {
    font-size: 0.875rem;
}

/* 加载动画 */
.message.loading .message-text {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-gray);
    animation: typingDot 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* ===== 推荐问题 ===== */
.suggested-questions {
    padding: 20px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--ultra-light-gray);
}

.suggested-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-gray);
    margin-bottom: 12px;
}

.suggested-title i {
    color: #F59E0B;
}

.question-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.question-chip {
    background: rgb(255, 255, 255);
    border: 1px solid var(--border-light);
    color: var(--text-dark);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.question-chip:hover {
    background: var(--tech-blue);
    color: rgb(47, 47, 47);
    border-color: var(--tech-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.question-chip i {
    font-size: 0.875rem;
}

.suggested-questions.hidden {
    display: none;
}

/* ===== 输入区域 ===== */
.chat-input-area {
    padding: 20px 24px;
    border-top: 1px solid var(--border-light);
    background: rgb(243, 243, 243);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    transition: var(--transition-fast);
}

.chat-input:focus {
    outline: none;
    border-color: var(--tech-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-input::placeholder {
    color: var(--text-light-gray);
}

.input-actions {
    display: flex;
    gap: 8px;
}

.clear-chat-btn,
.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1.125rem;
}

.clear-chat-btn {
    background: var(--light-gray-bg);
    color: var(--text-gray);
}

.clear-chat-btn:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.send-btn {
    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
    color: white;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-blue);
}

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

.send-btn.sending {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.input-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-light-gray);
}

.char-count {
    font-weight: 500;
}

.char-count.warning {
    color: #F59E0B;
}

.char-count.error {
    color: #DC2626;
}

/* ===== 侧边栏 ===== */
.ai-sidebar {
    position: sticky;
    top: 100px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition-normal);
}

.sidebar-toggle {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--light-gray-bg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    z-index: 10;
}

.sidebar-toggle:hover {
    background: var(--border-light);
}

.sidebar-toggle i {
    transition: var(--transition-fast);
}

.ai-sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-content {
    padding: 24px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: var(--light-gray-bg);
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border-gray);
    border-radius: 3px;
}

.sidebar-section {
    margin-bottom: 32px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-title i {
    color: var(--tech-blue);
}

/* ===== FAQ 手风琴 ===== */
.faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition-fast);
}

.faq-item:hover {
    border-color: var(--border-gray);
}

.faq-question {
    width: 100%;
    background: rgb(255, 255, 255);
    border: none;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: var(--transition-fast);
}

.faq-question:hover {
    background: var(--ultra-light-gray);
}

.faq-question span {
    flex: 1;
}

.faq-question i {
    font-size: 0.75rem;
    color: var(--text-gray);
    transition: var(--transition-fast);
}

.faq-question[aria-expanded="true"] {
    background: var(--ultra-light-gray);
}

.faq-question[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.faq-answer p {
    padding: 12px 16px;
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-gray);
    background: var(--ultra-light-gray);
}

.faq-item.active .faq-answer {
    max-height: 200px;
}

/* ===== 快速链接 ===== */
.quick-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--ultra-light-gray);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.quick-link-item:hover {
    background: #0071E3;
    color: rgb(255, 255, 255) !important;
    border-color: #0071E3;
    transform: translateX(4px);
}

.quick-link-item:hover i {
    color: rgb(255, 255, 255) !important;
}

.quick-link-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* ===== 免责声明 ===== */
.ai-disclaimer {
    padding: 40px 0;
    background: var(--ultra-light-gray);
    border-top: 1px solid var(--border-light);
}

.disclaimer-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    background: white;
    border-left: 4px solid #F59E0B;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.disclaimer-content i {
    font-size: 1.5rem;
    color: #F59E0B;
    flex-shrink: 0;
    margin-top: 2px;
}

.disclaimer-content p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-gray);
}

.disclaimer-content a {
    color: var(--tech-blue);
    text-decoration: none;
    font-weight: 500;
}

.disclaimer-content a:hover {
    text-decoration: underline;
}

/* ===== 模态框 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    max-width: 480px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: 4px;
    font-size: 1.25rem;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-gray);
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== CTA 提示 ===== */
.cta-hint {
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-left: 3px solid var(--tech-blue);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.cta-hint p {
    margin: 0 0 8px 0;
    color: var(--text-dark);
    font-weight: 500;
}

.cta-hint a {
    color: var(--tech-blue);
    text-decoration: none;
    font-weight: 600;
}

.cta-hint a:hover {
    text-decoration: underline;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
    .ai-layout {
        grid-template-columns: 1fr;
    }

    .ai-sidebar {
        position: relative;
        top: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .ai-sidebar.collapsed .sidebar-content {
        display: none;
    }
}

@media (max-width: 768px) {
    .ai-hero {
        padding: 60px 0 40px;
    }

    .ai-hero-content {
        flex-direction: column;
        gap: 40px;
    }

    .ai-hero h1 {
        font-size: 2rem;
    }

    .ai-hero-subtitle {
        font-size: 1rem;
    }

    .ai-hero-illustration {
        flex: 0 0 250px;
    }

    .illustration-container {
        width: 250px;
        height: 250px;
    }

    .illustration-circle {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .chat-window {
        height: calc(100vh - 300px);
        min-height: 500px;
    }

    .message-content {
        max-width: 85%;
    }

    .question-chips {
        flex-direction: column;
    }

    .question-chip {
        width: 100%;
        justify-content: flex-start;
    }

    .ai-sidebar {
        margin-top: 24px;
    }
}

@media (max-width: 480px) {
    .ai-hero h1 {
        font-size: 1.75rem;
    }

    .ai-hero-subtitle {
        font-size: 0.9375rem;
    }

    .messages-list {
        padding: 16px;
    }

    .message-content {
        max-width: 90%;
    }

    .chat-input-area {
        padding: 16px;
    }

    .input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .input-actions {
        justify-content: flex-end;
    }

    .sidebar-content {
        padding: 16px;
    }
}

/* ===== 可访问性增强 ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 焦点样式 */
button:focus-visible,
a:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--tech-blue);
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .message-text {
        border: 1px solid var(--border-gray);
    }

    .question-chip {
        border-width: 2px;
    }
}
