/* MQ Chatbot Widget - ARBO centrum branded (WhatsApp Style) */

:root {
    --mq-cb-primary: #ff6600;
    --mq-cb-primary-hover: #e55c00;
    --mq-cb-primary-light: #fff4eb;
    --mq-cb-secondary: #0090e3;
    --mq-cb-secondary-light: #cde9f9;
    --mq-cb-bg: #ffffff;
    --mq-cb-bg-chat: #efeae2; /* WhatsApp web background */
    --mq-cb-text: #111b21;
    --mq-cb-text-light: #667781;
    --mq-cb-text-muted: #8696a0;
    --mq-cb-border: #d1d7db;
    --mq-cb-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    --mq-cb-shadow-sm: 0 1px 2px rgba(11, 20, 26, 0.1);
    --mq-cb-radius: 16px;
    --mq-cb-radius-sm: 8px;
    --mq-cb-user-bg: #ff6600;
    --mq-cb-user-text: #ffffff;
    --mq-cb-bot-bg: #ffffff;
    --mq-cb-bot-text: #111b21;
    --mq-cb-header-bg: #ff6600;
    --mq-cb-text-primary: #111b21;
    --mq-cb-text-secondary: #667781;
    --mq-cb-bg-bubble-bot: #f0f2f5;
    --mq-cb-font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#mq-chatbot-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999990;
    font-family: var(--mq-cb-font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Toggle button */
.mq-chatbot-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--mq-cb-primary);
    color: #ffffff;
    cursor: pointer;
    box-shadow: var(--mq-cb-shadow);
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    padding: 0;
    margin: 0;
    position: relative;
}

.mq-chatbot-toggle:hover {
    background: var(--mq-cb-primary-hover);
    transform: scale(1.06);
    box-shadow: 0 10px 36px rgba(255, 102, 0, 0.3);
}

.mq-chatbot-toggle:active {
    transform: scale(0.97);
}

.mq-chatbot-toggle:focus-visible {
    outline: 3px solid var(--mq-cb-secondary);
    outline-offset: 3px;
}

.mq-chatbot-toggle svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.mq-chatbot-toggle--close .mq-chatbot-icon-chat {
    display: none;
}

.mq-chatbot-toggle--close .mq-chatbot-icon-close {
    display: block;
}

.mq-chatbot-toggle .mq-chatbot-icon-close {
    display: none;
}

/* Container */
.mq-chatbot-container {
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 400px;
    max-height: 600px;
    background: var(--mq-cb-bg);
    border-radius: var(--mq-cb-radius);
    box-shadow: var(--mq-cb-shadow);
    overflow: hidden;
    animation: mqCbSlideUp 0.25s ease;
}

.mq-chatbot-container--open {
    display: flex;
}

@keyframes mqCbSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.mq-chatbot-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--mq-cb-primary);
    color: #ffffff;
    flex-shrink: 0;
    cursor: default;
}

.mq-chatbot-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.2);
}

.mq-chatbot-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mq-chatbot-header-text {
    flex: 1;
    min-width: 0;
}

.mq-chatbot-header-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
    padding: 0;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mq-chatbot-header-subtitle {
    font-size: 13px;
    opacity: 0.9;
    margin: 2px 0 0;
    padding: 0;
    font-weight: 400;
}

/* Messages area */
.mq-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--mq-cb-bg-chat);
    /* Subtle WhatsApp-like doodle background */
    background-image: radial-gradient(circle at center, rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 250px;
    max-height: 400px;
    scroll-behavior: smooth;
}

.mq-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.mq-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.mq-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 10px;
}

/* Message Rows */
.mq-chatbot-message-row {
    display: flex;
    width: 100%;
    margin-bottom: 4px;
    animation: mqCbFadeIn 0.2s ease;
}

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

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

.mq-chatbot-message-row--error {
    justify-content: center;
}

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

/* Bubbles */
.mq-chatbot-message {
    position: relative;
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: var(--mq-cb-shadow-sm);
}

.mq-chatbot-message--bot {
    background: var(--mq-cb-bot-bg);
    color: var(--mq-cb-bot-text);
    border-top-left-radius: 0;
}

.mq-chatbot-message--bot::before {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent var(--mq-cb-bot-bg) transparent transparent;
}

.mq-chatbot-message--user {
    background: var(--mq-cb-user-bg);
    color: var(--mq-cb-user-text);
    border-top-right-radius: 0;
}

.mq-chatbot-message--user::before {
    content: "";
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 0 0;
    border-color: var(--mq-cb-user-bg) transparent transparent transparent;
}

.mq-chatbot-message--error {
    background: #fff5f5;
    color: #c0392b;
    border: 1px solid #fadbd8;
    font-size: 12.5px;
    text-align: center;
    max-width: 90%;
    border-radius: var(--mq-cb-radius-sm);
    padding: 6px 12px;
}

/* Message Meta (Time & Checkmarks) */
.mq-chatbot-message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 11px;
    color: var(--mq-cb-text-muted);
    margin-top: 4px;
    line-height: 1;
    float: right;
    margin-left: 12px;
    position: relative;
    top: 4px;
}

.mq-chatbot-message--user .mq-chatbot-message-meta {
    color: rgba(255, 255, 255, 0.7);
}

.mq-chatbot-checkmarks {
    display: inline-flex;
    transition: color 0.3s ease;
}

.mq-chatbot-checkmarks svg {
    width: 16px;
    height: 16px;
}

.mq-chatbot-checkmarks--sent {
    color: rgba(255, 255, 255, 0.5);
}

.mq-chatbot-checkmarks--delivered {
    color: rgba(255, 255, 255, 0.7);
}

.mq-chatbot-checkmarks--read {
    color: #53bdeb;
    animation: mqCbCheckRead 0.3s ease;
}

@keyframes mqCbCheckRead {
    0% { opacity: 0.5; transform: scale(0.8); }
    50% { transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}

/* Action buttons */
.mq-chatbot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    clear: both;
}

.mq-chatbot-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--mq-cb-font);
    color: var(--mq-cb-primary);
    background: var(--mq-cb-bg);
    border: 1px solid var(--mq-cb-primary);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    line-height: 1.3;
}

.mq-chatbot-action-btn:hover {
    background: var(--mq-cb-primary-light);
}

.mq-chatbot-action-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

/* Booking link - prominent CTA */
.mq-chatbot-action-btn--booking {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
    color: #ffffff;
    background: var(--mq-cb-primary);
    border-radius: 6px;
}

.mq-chatbot-action-btn--booking:hover {
    background: var(--mq-cb-primary-hover);
    color: #ffffff;
}

/* Typing indicator */
.mq-chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--mq-cb-bot-bg);
    border-radius: 8px;
    border-top-left-radius: 0;
    box-shadow: var(--mq-cb-shadow-sm);
    position: relative;
    width: fit-content;
}

.mq-chatbot-typing::before {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent var(--mq-cb-bot-bg) transparent transparent;
}

.mq-chatbot-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mq-cb-text-muted);
    animation: mqCbBounce 1.2s infinite;
}

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

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

/* Input area */
.mq-chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f0f2f5; /* WhatsApp input area bg */
    flex-shrink: 0;
}

.mq-chatbot-input {
    flex: 1;
    border: none;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: var(--mq-cb-font);
    outline: none;
    color: var(--mq-cb-text);
    background: #ffffff;
    resize: none;
    min-height: 44px;
    max-height: 44px;
    line-height: 20px;
}

.mq-chatbot-input::placeholder {
    color: var(--mq-cb-text-muted);
}

.mq-chatbot-input:disabled {
    opacity: 0.6;
}

.mq-chatbot-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--mq-cb-primary);
    color: #ffffff;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.15s ease, transform 0.1s ease;
    flex-shrink: 0;
}

.mq-chatbot-send:hover:not(:disabled) {
    background: var(--mq-cb-primary-hover);
}

.mq-chatbot-send:active:not(:disabled) {
    transform: scale(0.95);
}

.mq-chatbot-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--mq-cb-text-muted);
}

.mq-chatbot-send svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    margin-left: 2px;
}

/* Rating buttons */
.mq-chatbot-rating {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.mq-chatbot-rating-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.4;
    transition: opacity 0.2s, background 0.2s;
    line-height: 1;
}

.mq-chatbot-rating-btn:hover {
    opacity: 0.8;
    background: rgba(0, 0, 0, 0.05);
}

.mq-chatbot-rating-btn--active {
    opacity: 1;
}

.mq-chatbot-rating-btn:disabled {
    cursor: default;
}

.mq-chatbot-rating-btn svg {
    fill: var(--mq-cb-text-secondary);
}

.mq-chatbot-rating-btn--active svg {
    fill: var(--mq-cb-primary);
}

/* Follow-up suggestion chips */
.mq-chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.mq-chatbot-suggestion-btn {
    padding: 5px 12px;
    border: 1px solid var(--mq-cb-primary);
    border-radius: 16px;
    background: transparent;
    color: var(--mq-cb-primary);
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.mq-chatbot-suggestion-btn:hover {
    background: var(--mq-cb-primary);
    color: #fff;
}

/* Footer actions (e-mail transcript) */
.mq-chatbot-footer-actions {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    border-top: 1px solid var(--mq-cb-border);
    background: var(--mq-cb-header-bg);
}

.mq-chatbot-footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--mq-cb-border);
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    color: var(--mq-cb-text-secondary);
    transition: background 0.2s, color 0.2s;
}

.mq-chatbot-footer-btn:hover {
    background: var(--mq-cb-bg-bubble-bot);
    color: var(--mq-cb-text-primary);
}

.mq-chatbot-footer-btn svg {
    fill: currentColor;
}

/* Email overlay */
.mq-chatbot-email-overlay {
    position: absolute;
    bottom: 90px;
    left: 12px;
    right: 12px;
    z-index: 10;
}

.mq-chatbot-email-form {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--mq-cb-border);
}

.mq-chatbot-email-label {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--mq-cb-text-primary);
    font-weight: 600;
}

.mq-chatbot-email-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--mq-cb-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.mq-chatbot-email-input:focus {
    outline: none;
    border-color: var(--mq-cb-primary);
}

.mq-chatbot-email-btns {
    display: flex;
    gap: 8px;
}

.mq-chatbot-email-submit {
    flex: 1;
    padding: 7px;
    border: none;
    border-radius: 8px;
    background: var(--mq-cb-primary);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
}

.mq-chatbot-email-submit:disabled {
    opacity: 0.6;
    cursor: wait;
}

.mq-chatbot-email-cancel {
    padding: 7px 14px;
    border: 1px solid var(--mq-cb-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    color: var(--mq-cb-text-secondary);
}

/* Proactive message bubble */
.mq-chatbot-proactive {
    position: fixed;
    bottom: 90px;
    right: 24px;
    max-width: 260px;
    padding: 12px 36px 12px 16px;
    background: #fff;
    border-radius: 12px 12px 0 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    color: var(--mq-cb-text-primary);
    cursor: pointer;
    z-index: 99998;
    animation: mqProactiveFadeIn 0.4s ease;
}

.mq-chatbot-proactive-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--mq-cb-text-muted);
    line-height: 1;
    padding: 4px;
}

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

/* History panel */
.mq-chatbot-header-history {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.mq-chatbot-header-history:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.mq-chatbot-history-panel {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.mq-chatbot-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--mq-cb-border);
}

.mq-chatbot-history-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--mq-cb-text-primary);
}

.mq-chatbot-history-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--mq-cb-text-muted);
    padding: 0 4px;
    line-height: 1;
}

.mq-chatbot-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    font-size: 13px;
    color: var(--mq-cb-text-secondary);
}

.mq-chatbot-history-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    border-bottom: 1px solid var(--mq-cb-border);
    transition: background 0.15s;
    font-family: inherit;
}

.mq-chatbot-history-item:hover {
    background: var(--mq-cb-bg-bubble-bot);
}

.mq-chatbot-history-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--mq-cb-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mq-chatbot-history-item-meta {
    font-size: 11px;
    color: var(--mq-cb-text-muted);
    margin-top: 2px;
}

.mq-chatbot-history-divider {
    text-align: center;
    padding: 8px 12px;
    font-size: 11px;
    color: var(--mq-cb-text-muted);
    border-top: 1px dashed var(--mq-cb-border);
    border-bottom: 1px dashed var(--mq-cb-border);
    margin: 8px 0;
}

/* Powered by footer */
.mq-chatbot-footer {
    display: none; /* Hide in WhatsApp style */
}

/* Responsive: full width on mobile */
@media (max-width: 480px) {
    #mq-chatbot-root {
        bottom: 0;
        right: 0;
        left: 0;
    }

    .mq-chatbot-toggle {
        position: fixed;
        bottom: 16px;
        right: 16px;
    }

    .mq-chatbot-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .mq-chatbot-messages {
        max-height: none;
        flex: 1;
    }
}
