body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f9;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.chat-container {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        max-width: none;
        border-radius: 0;
    }
    
    body {
        align-items: flex-start; /* Better for mobile keyboard */
    }
}

.chat-header {
    background-color: #007bff;
    color: #fff;
    padding: 15px;
    text-align: center;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

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

.message {
    display: flex;
    margin-bottom: 5px;
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message.system {
    justify-content: center;
}

.message .bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.6; /* Increased line height */
    word-wrap: break-word;
}

/* Markdown Content Styling */
.message .bubble p {
    margin: 0 0 12px 0; /* Increased paragraph spacing */
}

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

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

.message .bubble li {
    margin-bottom: 4px;
}

.message .bubble pre {
    background-color: rgba(0,0,0,0.1);
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
    font-size: 0.85rem;
    margin: 8px 0;
}

.message .bubble code {
    background-color: rgba(0,0,0,0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
    font-size: 0.9rem;
}

.message .bubble blockquote {
    border-left: 3px solid rgba(0,0,0,0.2);
    margin: 8px 0;
    padding-left: 10px;
    color: rgba(0,0,0,0.6);
}

.message .bubble h1, 
.message .bubble h2, 
.message .bubble h3, 
.message .bubble h4 {
    margin: 10px 0 5px 0;
    font-weight: 600;
    line-height: 1.2;
}

.message .bubble h1 { font-size: 1.3em; }
.message .bubble h2 { font-size: 1.2em; }
.message .bubble h3 { font-size: 1.1em; }
.message .bubble h4 { font-size: 1.0em; }

.message .bubble img.chat-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message .bubble a.chat-link, 
.message .bubble a {
    text-decoration: underline;
    word-break: break-all;
}

.message.user .bubble {
    background-color: #007bff;
    color: #fff;
    border-bottom-right-radius: 5px;
}

.message.user .bubble a.chat-link, 
.message.user .bubble a {
    color: #e0e0e0;
}

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

.message.user .bubble blockquote {
    border-left-color: rgba(255,255,255,0.4);
    color: rgba(255,255,255,0.8);
}

.message.bot .bubble {
    background-color: #e9ecef;
    color: #333;
    border-bottom-left-radius: 5px;
}

.message.bot .bubble a.chat-link,
.message.bot .bubble a {
    color: #0056b3;
}

.message.system .bubble {
    background-color: #f8f9fa;
    color: #6c757d;
    font-size: 0.85rem;
    border-radius: 10px;
}

/* Suggestions Styling */
.suggestions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggestion-chip {
    background-color: #fff;
    border: 1px solid #007bff;
    color: #007bff;
    padding: 8px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-align: left;
}

.suggestion-chip:hover {
    background-color: #007bff;
    color: #fff;
}

.chat-input {
    padding: 15px;
    background-color: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}

.chat-input input:focus {
    border-color: #007bff;
}

.chat-input button {
    padding: 10px 20px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

.chat-input button:hover {
    background-color: #0056b3;
}

.chat-input button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

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

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

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