/* Emma Chat Styles */

.emma-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 9998;
    overflow: hidden;
    border: 3px solid #fff;
}

.emma-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

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

.emma-chat-modal {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
}

.emma-chat-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.emma-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgb(175, 161, 133) 0%, rgb(155, 141, 113) 100%);
    color: #fff;
    border-radius: 16px 16px 0 0;
}

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

.emma-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
}

.emma-header-content h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.emma-header-content p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.emma-close-button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.emma-close-button:hover {
    opacity: 0.8;
}

.emma-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f8fc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.emma-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.emma-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.emma-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.emma-message {
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
}

.emma-message.user .message-content {
    align-items: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Markdown styling within message bubbles */
.message-bubble p {
    margin: 0 0 8px 0;
}

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

.message-bubble a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
}

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

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

.message-bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Monaco', 'Courier New', monospace;
}

.message-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-bubble pre code {
    background: none;
    padding: 0;
}

.message-bubble strong {
    font-weight: 600;
}

.message-bubble em {
    font-style: italic;
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
    margin: 12px 0 8px 0;
    font-weight: 600;
}

.message-bubble h1 {
    font-size: 18px;
}

.message-bubble h2 {
    font-size: 16px;
}

.message-bubble h3 {
    font-size: 15px;
}

.message-bubble blockquote {
    border-left: 3px solid rgba(0, 0, 0, 0.1);
    padding-left: 12px;
    margin: 8px 0;
    color: rgba(0, 0, 0, 0.7);
}

/* Adjust styles for user messages */
.emma-message.user .message-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.emma-message.user .message-bubble pre {
    background: rgba(255, 255, 255, 0.15);
}

.emma-message.user .message-bubble blockquote {
    border-left-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

.emma-message.assistant .message-bubble {
    background: #fff;
    color: #1a202c;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.emma-message.user .message-bubble {
    background: linear-gradient(135deg, rgb(175, 161, 133) 0%, rgb(155, 141, 113) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #718096;
    padding: 0 8px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 16px !important;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    animation: typing 1.4s infinite;
}

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

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

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

.emma-chat-input {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 16px 16px;
}

.emma-chat-input form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.emma-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.emma-input:focus {
    box-shadow: 0 0 0 2px rgba(255, 252, 246, 0.1);
}

.emma-send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, rgb(175, 161, 133) 0%, rgb(155, 141, 113) 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

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

.emma-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quick Action Buttons */
.emma-quick-actions {
    display: flex;
    gap: 8px;
    padding: 0 0 12px 0;
    overflow-x: auto;
}

.emma-quick-actions::-webkit-scrollbar {
    height: 4px;
}

.emma-quick-actions::-webkit-scrollbar-thumb {
    background: rgba(175, 161, 133, 0.3);
    border-radius: 2px;
}

.emma-quick-button {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(175, 161, 133, 0.3);
    background: rgba(175, 161, 133, 0.1);
    color: rgb(145, 131, 103);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.emma-quick-button:hover {
    background: rgba(175, 161, 133, 0.2);
    border-color: rgba(175, 161, 133, 0.5);
    transform: translateY(-1px);
}

.emma-quick-button:active {
    transform: translateY(0);
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .emma-chat-button {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    .emma-chat-modal {
        bottom: 80px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
        height: 500px;
    }
}
