/* MedChat Plugin Styles */

.medchat-container {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.medchat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.medchat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.medchat-logo {
    flex-shrink: 0;
}

.medchat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

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

.medchat-clear-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.medchat-clear-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.medchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    min-height: 400px;
}

.medchat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: #4b5563;
}

.medchat-welcome-icon {
    margin-bottom: 20px;
    color: #667eea;
}

.medchat-welcome h4 {
    margin: 0 0 12px 0;
    font-size: 24px;
    color: #1f2937;
}

.medchat-welcome p {
    margin: 0 0 24px 0;
    font-size: 16px;
    color: #6b7280;
}

.medchat-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.medchat-suggestion {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #4b5563;
}

.medchat-suggestion:hover {
    border-color: #667eea;
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.medchat-message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
}

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

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

.medchat-message-user .medchat-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 12px 18px;
    max-width: 70%;
    word-wrap: break-word;
}

.medchat-message-assistant {
    display: flex;
    justify-content: flex-start;
}

.medchat-message-assistant .medchat-message-content {
    background: white;
    color: #1f2937;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 18px;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.medchat-message-content {
    font-size: 15px;
    line-height: 1.6;
}

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

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

.medchat-message-content ul,
.medchat-message-content ol {
    margin: 12px 0;
    padding-left: 20px;
}

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

.medchat-message-content strong {
    font-weight: 600;
    color: #111827;
}

.medchat-message-content em {
    font-style: italic;
}

.medchat-message-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.medchat-sources {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.medchat-sources-title {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
}

.medchat-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 12px;
    margin-bottom: 4px;
    font-size: 13px;
}

.medchat-source a {
    color: #667eea;
    text-decoration: none;
}

.medchat-source a:hover {
    text-decoration: underline;
}

.medchat-typing {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 20px;
}

.medchat-typing-indicator {
    background: white;
    border-radius: 18px;
    padding: 12px 18px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

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

.medchat-typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.medchat-input-container {
    border-top: 1px solid #e5e7eb;
    padding: 16px;
    background: white;
}

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

.medchat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    max-height: 120px;
    font-family: inherit;
}

.medchat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.medchat-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
}

.medchat-submit:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.medchat-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.medchat-disclaimer {
    margin-top: 12px;
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
}

.medchat-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.medchat-error-icon {
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 640px) {
    .medchat-suggestions {
        grid-template-columns: 1fr;
    }
    
    .medchat-message-user .medchat-message-content,
    .medchat-message-assistant .medchat-message-content {
        max-width: 90%;
    }
    
    .medchat-header h3 {
        font-size: 16px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .medchat-container {
        background: #1f2937;
        border-color: #374151;
    }
    
    .medchat-messages {
        background: #111827;
    }
    
    .medchat-message-assistant .medchat-message-content {
        background: #1f2937;
        color: #f3f4f6;
    }
    
    .medchat-message-content strong {
        color: #f9fafb;
    }
    
    .medchat-message-content code {
        background: #374151;
        color: #f3f4f6;
    }
    
    .medchat-input-container {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .medchat-input {
        background: #111827;
        border-color: #374151;
        color: #f3f4f6;
    }
    
    .medchat-input:focus {
        border-color: #667eea;
    }
    
    .medchat-suggestion {
        background: #1f2937;
        border-color: #374151;
        color: #d1d5db;
    }
    
    .medchat-suggestion:hover {
        background: #374151;
    }
}