/* Chat Interface Styles */

/* Header */
.chat-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--navbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 1rem 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.back-button:hover {
    color: var(--primary-color);
    background-color: var(--background-secondary);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.ai-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary-color);
    background: var(--background-secondary);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.title-text h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.title-text p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Main Chat Area */
.chat-main {
    margin-top: 5rem;
    min-height: calc(100vh - 5rem);
    padding-bottom: 140px;
}

.chat-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    padding: 3rem 2rem;
}

.welcome-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--primary-color);
    background: var(--background-secondary);
    box-shadow: var(--shadow-large);
}

.welcome-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.welcome-section h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.welcome-section p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Suggested Questions */
.suggested-questions {
    margin-top: 3rem;
}

.suggested-questions h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.question-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.question-btn {
    background: var(--background-primary);
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-weight: 500;
    box-shadow: var(--shadow-light);
}

.question-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Chat Messages */
.chat-messages {
    padding: 2rem;
    max-width: 100%;
}

.message {
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--background-secondary);
    border: 2px solid var(--border-color);
}

.message.ai .message-avatar {
    border-color: var(--primary-color);
}

.message.user .message-avatar {
    background: var(--primary-color);
    border-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.25rem;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    max-width: calc(100% - 56px);
}

.message-bubble {
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-light);
    position: relative;
}

.message.user .message-bubble {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.message.ai .message-bubble {
    border-left: 4px solid var(--primary-color);
}

.message-text {
    line-height: 1.6;
    margin: 0;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    text-align: right;
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Chat Input */
.chat-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background-primary);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    backdrop-filter: blur(10px);
}

.chat-input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    background: var(--background-secondary);
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    resize: none;
    min-height: 48px;
    max-height: 120px;
    transition: var(--transition);
}

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

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

.send-button {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: white;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.send-button:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    opacity: 0.5;
}

.input-footer {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    margin-top: 0.5rem;
}

.disclaimer {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    background: var(--background-primary);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-large);
    max-width: 300px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text-secondary);
    margin: 0;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        padding: 1rem 0;
    }
    
    .welcome-section {
        padding: 2rem 1rem;
    }
    
    .welcome-avatar {
        width: 100px;
        height: 100px;
    }
    
    .question-buttons {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .chat-messages {
        padding: 1rem;
    }
    
    .header-title {
        gap: 0.75rem;
    }
    
    .ai-avatar {
        width: 40px;
        height: 40px;
    }
    
    .title-text h1 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .back-button {
        padding: 0.5rem;
    }
    
    .welcome-section h2 {
        font-size: 1.5rem;
    }
    
    .question-btn {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .message-bubble {
        padding: 1rem;
    }
    
    #chat-input {
        padding: 1rem;
    }
}