/*
 * Styles for Maverick Assistant Chat v2
 * This stylesheet defines the look and feel of the floating chat button
 * and conversation panel. The primary color is injected via CSS custom
 * property (--primary-color) from JavaScript based on plugin settings.
 */

#mav-assistant-v2-root {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: Arial, sans-serif;
    --primary-color: #067781; /* fallback */
}

.mav-assistant-button {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.mav-assistant-button:hover {
    transform: scale(1.05);
}

.mav-assistant-chat {
    width: 350px;
    max-height: 480px;
    background-color: #ffffff;
    /* Position relative so that the privacy overlay can be
       absolutely positioned within the chat container. */
    position: relative;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 10px;
}

.mav-assistant-chat-header {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 12px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
}

.mav-assistant-chat-header .mav-title {
    flex: 1;
}

.mav-assistant-chat-header .mav-close {
    cursor: pointer;
    font-size: 20px;
    margin-left: 10px;
}

/* Terminate button in header */
.mav-assistant-chat-header .mav-terminate {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 10px;
}

.mav-assistant-chat-header .mav-terminate:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.mav-assistant-chat-messages {
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    background-color: #f8f8f8;
    display: flex;
    flex-direction: column;
}

.mav-message {
    margin-bottom: 8px;
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

/* Display sender name at the top of each message bubble */
.mav-message .mav-name {
    display: block;
    font-weight: bold;
    margin-bottom: 2px;
    font-size: 12px;
}
/* The name inherits the text colour of the message bubble */
.mav-message.user .mav-name {
    color: #ffffff;
}
.mav-message.assistant .mav-name {
    color: #333333;
}
.mav-message.consultant .mav-name {
    color: #333333;
}

.mav-message.assistant {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid var(--primary-color);
}

/* Display time inside message bubbles */
.mav-message .mav-time {
    display: block;
    font-size: 10px;
    color: #666666;
    margin-bottom: 2px;
}

.mav-message.user {
    background-color: var(--primary-color);
    color: #ffffff;
    align-self: flex-end;
}

/* User message time should be white like the message text */
.mav-message.user .mav-time {
    color: #ffffff;
}

/* Style consultant messages like assistant messages: white background with border and dark text */
.mav-message.consultant {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid var(--primary-color);
    align-self: flex-end;
}
/* Consultant message timestamps inherit the message color */
.mav-message.consultant .mav-time {
    color: inherit;
}

/* Collapsed chat: shrink size and hide messages/input */
.mav-assistant-chat.collapsed {
    width: 90px;
    height: 70px;
}
.mav-assistant-chat.collapsed .mav-assistant-chat-messages,
.mav-assistant-chat.collapsed .mav-assistant-chat-input {
    display: none;
}
.mav-assistant-chat.collapsed .mav-title {
    display: none;
}
.mav-assistant-chat.collapsed .mav-terminate {
    display: none;
}

/* Minimize icon styling */
.mav-minimize {
    cursor: pointer;
    font-size: 20px;
    margin-right: 10px;
}

/* Feedback overlay styles */
.mav-feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}
.mav-feedback-content {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    max-width: 300px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    text-align: center;
    position: relative;
}
.mav-feedback-stars {
    margin: 10px 0;
    font-size: 24px;
    color: #cccccc;
    user-select: none;
}
.mav-feedback-stars .mav-star {
    cursor: pointer;
    margin: 0 2px;
}
.mav-feedback-stars .mav-star.selected,
.mav-feedback-stars .mav-star:hover,
.mav-feedback-stars .mav-star:hover ~ .mav-star.selected {
    color: var(--primary-color);
}
.mav-feedback-comment {
    width: 100%;
    margin-bottom: 10px;
    border: 1px solid #cccccc;
    border-radius: 8px;
    padding: 6px;
    font-size: 14px;
}
.mav-feedback-send {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
}

.mav-assistant-chat-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eeeeee;
    background-color: #ffffff;
}

.mav-assistant-chat-input input {
    flex: 1;
    border: 1px solid #cccccc;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    outline: none;
}

.mav-assistant-chat-input button {
    margin-left: 6px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Attachment button styling */
.mav-assistant-chat-input .mav-attach {
    margin-left: 0;
    margin-right: 6px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Typing indicator styling */
.typing-indicator {
    display: inline-block;
    vertical-align: middle;
}
.typing-indicator span {
    display: inline-block;
    width: 4px;
    height: 4px;
    margin: 0 1px;
    background-color: currentColor;
    border-radius: 50%;
    animation: mav-typing 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes mav-typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Consultant prompt button */
.mav-consultant-btn {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 4px;
}
.mav-consultant-btn:hover {
    background-color: #055e61;
}

/* Close (X) icon inside feedback overlay */
.mav-feedback-close {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 20px;
    cursor: pointer;
    color: #666666;
}
.mav-feedback-close:hover {
    color: var(--primary-color);
}

/* Privacy consent overlay styles */
.mav-privacy-overlay {
    /* Overlay covers only the chat container; positioned
       absolutely within the .mav-assistant-chat element. */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    padding: 20px;
    box-sizing: border-box;
}

.mav-privacy-content {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    max-width: 300px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    text-align: center;
}

.mav-privacy-content p {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.mav-privacy-content button {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
}

/* Privacy consent checkbox and label */
.mav-privacy-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
}
.mav-privacy-message a {
    color: var(--primary-color);
    text-decoration: underline;
}
.mav-privacy-message input[type="checkbox"] {
    margin-top: 3px;
}

/* Contact actions prompt */
.mav-contact-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}
.mav-contact-actions button {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
}

/* Contact overlay for leaving contact details */
.mav-contact-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: 10001;
    padding: 20px;
    box-sizing: border-box;
}
.mav-contact-content {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
    text-align: center;
}
.mav-contact-close {
    position: absolute;
    top: 8px;
    right: 12px;
    cursor: pointer;
    font-size: 20px;
}
.mav-contact-content h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}
.mav-contact-content input,
.mav-contact-content textarea {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    box-sizing: border-box;
}
.mav-contact-content textarea {
    resize: vertical;
}
.mav-contact-send {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    width: 100%;
    font-size: 14px;
}