/* Chat Page Styles - Enhanced */
.chat-page {
    padding: 40px 20px 80px;
    min-height: calc(100vh - 70px);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Chat Layout */
.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto 60px;
}

/* Sidebar */
.chat-sidebar {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 25px;
    height: fit-content;
    position: sticky;
    top: 90px;
    border: 1px solid var(--border-color);
}

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

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

.sidebar-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* Scenario List */
.scenario-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scenario-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-primary);
    text-align: left;
}

.scenario-btn:hover {
    background: var(--border-color);
    transform: translateX(5px);
}

.scenario-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.scenario-icon {
    font-size: 18px;
}

/* Quick Questions */
.quick-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-question {
    padding: 10px 15px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: left;
}

.quick-question:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

/* History */
.history-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.history-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-clear-history {
    width: 100%;
    padding: 10px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-clear-history:hover {
    background: #fee2e2;
    color: #991b1b;
    border-color: #dc2626;
}

/* Chat Main */
.chat-main {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    border: 1px solid var(--border-color);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-light);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-icon {
    font-size: 24px;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
}

.icon-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 15px;
    animation: fadeIn 0.3s;
}

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

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

.message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-user .message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-content {
    max-width: 75%;
    padding: 18px 22px;
    border-radius: var(--radius-lg);
    line-height: 1.7;
    box-shadow: var(--shadow-sm);
}

.message-assistant .message-content {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.message-user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.welcome-message {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 25px;
    border-radius: var(--radius-lg);
    border: 2px dashed var(--primary-color);
}

.welcome-message .message-content {
    max-width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.welcome-message h4 {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.welcome-message ul {
    margin: 15px 0;
    padding-left: 25px;
}

.welcome-message li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.message-content p {
    margin: 0 0 10px 0;
}

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

.message-content h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.message-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 5px;
}

/* Chat Input */
.chat-input-container {
    border-top: 2px solid var(--border-color);
    padding: 20px 30px;
    background: var(--bg-light);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.input-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

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

.chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    transition: all 0.2s;
    background: var(--bg-white);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.chat-tips {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* Loading indicator */
.message-loading {
    display: flex;
    gap: 5px;
    padding: 10px;
}

.message-loading span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

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

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

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

/* Chat Features */
.chat-features {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.chat-features h3 {
    font-size: 28px;
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.feature-item {
    text-align: center;
    padding: 25px;
    background: var(--bg-light);
    border-radius: var(--radius);
    transition: transform 0.2s;
}

.feature-item:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.feature-item h4 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.feature-item p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 1024px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
    
    .chat-sidebar {
        position: static;
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .chat-page {
        padding: 20px 15px 60px;
    }
    
    .page-title {
        font-size: 32px;
    }
    
    .chat-main {
        height: calc(100vh - 150px);
    }
    
    .chat-messages {
        padding: 20px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-input-container {
        padding: 15px;
    }
    
    .chat-features {
        padding: 25px 20px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}
