/* ============================================
   Medical Chatbot - Message Interface
   Modern, Clean & Professional Design
   ============================================ */

/* Main Chat Container */
.medbot-chat-container {
    width: 100%;
    max-width: 100%;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Header */
.medbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px 32px;
    text-align: center;
}

.medbot-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

.medbot-header .subtitle {
    margin: 8px 0 0 0;
    font-size: 16px;
    opacity: 0.9;
    font-weight: 400;
}

/* Welcome Message Area */
.medbot-welcome {
    padding: 32px;
    background: linear-gradient(to bottom, #f8f9fa, #ffffff);
    border-bottom: 1px solid #e9ecef;
}

.medbot-welcome h2 {
    margin: 0 0 16px 0;
    color: #2d3436;
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.medbot-welcome h2::before {
    content: "👨‍⚕️";
    font-size: 24px;
}

.medbot-welcome > p {
    margin: 0 0 24px 0;
    color: #495057;
    font-size: 16px;
    line-height: 1.7;
}

/* Quick Actions Grid */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.quick-action-btn {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #495057;
    text-decoration: none;
    display: block;
}

.quick-action-btn:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

/* Messages Area */
.medbot-messages {
    max-height: 500px;
    min-height: 300px;
    overflow-y: auto;
    padding: 24px 32px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

/* Individual Message Container */
.medbot-message {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    animation: messageAppear 0.3s ease-out;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User Message Alignment */
.medbot-message-user {
    flex-direction: row-reverse;
}

.medbot-message-bot {
    align-items: flex-start;
}

/* Message Avatar */
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.medbot-message-user .message-avatar {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.medbot-message-bot .message-avatar::before {
    content: "⚕️";
}

.medbot-message-user .message-avatar::before {
    content: "👤";
}

/* Message Content */
.message-content {
    max-width: 75%;
    min-width: 200px;
}

.medbot-message-user .message-content {
    align-items: flex-end;
}

/* Message Text Bubble */
.message-bubble {
    padding: 16px 20px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 15px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Bot Message */
.medbot-message-bot .message-bubble {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 18px 18px 18px 6px;
    color: #2d3436;
}

/* User Message */
.medbot-message-user .message-bubble {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 18px 18px 6px 18px;
}

/* Message Header (Sender & Time) */
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.message-sender {
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
}

.medbot-message-user .message-sender {
    color: rgba(255, 255, 255, 0.9);
}

.message-time {
    font-size: 11px;
    color: #adb5bd;
    font-weight: 400;
}

.medbot-message-user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Message Text Formatting */
.message-bubble p {
    margin: 0 0 12px 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble ul,
.message-bubble ol {
    margin: 12px 0;
    padding-left: 24px;
}

.message-bubble li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.message-bubble strong {
    font-weight: 600;
}

.medbot-message-bot .message-bubble strong {
    color: #667eea;
}

.medbot-message-user .message-bubble strong {
    color: inherit;
    opacity: 0.9;
}

/* Code Formatting */
.message-bubble code {
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #e9ecef;
}

.medbot-message-user .message-bubble code {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* Quick Questions Bar */
.quick-questions-bar {
    background: #f8f9fa;
    padding: 20px 32px;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.quick-questions-bar p {
    margin: 0 0 16px 0;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-questions-bar p::before {
    content: "💡";
}

.quick-questions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-question-btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.quick-question-btn:hover {
    border-color: #667eea;
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.15);
}

/* Input Area */
.medbot-input-area {
    padding: 24px 32px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.input-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

.medbot-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    resize: none;
    min-height: 60px;
    max-height: 120px;
    font-family: inherit;
    line-height: 1.5;
}

.medbot-input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    outline: none;
}

.medbot-input::placeholder {
    color: #adb5bd;
}

/* Send Button */
.send-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-button::after {
    content: "➤";
    font-size: 18px;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    color: #495057;
    font-size: 14px;
    max-width: fit-content;
    margin: 0 auto;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Suggestions Panel */
.suggestions-panel {
    background: white;
    padding: 20px 32px;
    border-top: 1px solid #e9ecef;
}

.suggestions-panel h3 {
    margin: 0 0 16px 0;
    color: #2d3436;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.suggestions-panel h3::before {
    content: "📚";
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.suggestion-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.suggestion-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.suggestion-item h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 600;
}

.suggestion-item p {
    margin: 0;
    font-size: 13px;
    opacity: 0.8;
    line-height: 1.5;
}

.suggestion-item:hover p {
    opacity: 0.9;
}

/* Scrollbar Styling */
.medbot-messages::-webkit-scrollbar {
    width: 8px;
}

.medbot-messages::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 4px;
}

.medbot-messages::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.medbot-messages::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .medbot-chat-container {
        border-radius: 12px;
    }
    
    .medbot-header,
    .medbot-welcome,
    .medbot-messages,
    .medbot-input-area,
    .quick-questions-bar,
    .suggestions-panel {
        padding: 20px 24px;
    }
    
    .medbot-header h1 {
        font-size: 24px;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .input-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .send-button {
        width: 100%;
        height: 52px;
    }
    
    .quick-questions {
        flex-direction: column;
    }
    
    .quick-question-btn {
        width: 100%;
        text-align: center;
    }
    
    .suggestions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .medbot-header,
    .medbot-welcome,
    .medbot-messages,
    .medbot-input-area,
    .quick-questions-bar,
    .suggestions-panel {
        padding: 16px 20px;
    }
    
    .medbot-header h1 {
        font-size: 22px;
    }
    
    .medbot-welcome h2 {
        font-size: 20px;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .message-bubble {
        padding: 14px 18px;
        font-size: 14.5px;
    }
}