/* La Salve Chatbot Widget */

/* Attach-photo button + uploaded image bubbles */
.lasalve-chatbot__attach {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s, color .15s;
}
.lasalve-chatbot__attach:hover { color: #000; background: #f0f0f0; }
.lasalve-chatbot__msg--image { background: none !important; padding: 4px 0 !important; }

#lasalve-chatbot-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

#lasalve-chatbot-container.lasalve-chatbot--bottom-right {
    bottom: 20px;
    right: 20px;
}

#lasalve-chatbot-container.lasalve-chatbot--bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Trigger button */
.lasalve-chatbot__trigger {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #bb4200;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: absolute;
    bottom: 0;
    right: 0;
}

.lasalve-chatbot--bottom-left .lasalve-chatbot__trigger {
    right: auto;
    left: 0;
}

.lasalve-chatbot__trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Chat window */
.lasalve-chatbot__window {
    width: 380px;
    height: 520px;
    max-height: calc(100vh - 100px);
    background: #1b1b1b;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 84px;
    right: 0;
}

.lasalve-chatbot--bottom-left .lasalve-chatbot__window {
    right: auto;
    left: 0;
}

/* Header */
.lasalve-chatbot__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #000000;
    color: #FFFFFF;
    flex-shrink: 0;
}

.lasalve-chatbot__header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lasalve-chatbot__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #FFFFFF;
}

.lasalve-chatbot__title {
    display: block;
    font-weight: 600;
    font-size: 15px;
}

.lasalve-chatbot__subtitle {
    display: block;
    font-size: 12px;
    opacity: 0.7;
}

.lasalve-chatbot__close {
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.lasalve-chatbot__close:hover {
    opacity: 1;
}

/* Messages */
.lasalve-chatbot__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lasalve-chatbot__messages::-webkit-scrollbar {
    width: 4px;
}

.lasalve-chatbot__messages::-webkit-scrollbar-track {
    background: transparent;
}

.lasalve-chatbot__messages::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}

.lasalve-chatbot__msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    animation: lasalve-fade-in 0.3s ease;
}

.lasalve-chatbot__msg--user {
    align-self: flex-end;
    background: #FFFFFF;
    color: #1b1b1b;
    border-bottom-right-radius: 4px;
}

.lasalve-chatbot__msg--assistant {
    align-self: flex-start;
    background: #2a2a2a;
    color: #FFFFFF;
    border-bottom-left-radius: 4px;
}

.lasalve-chatbot__msg--assistant a {
    color: #d4a843;
    text-decoration: underline;
}

.lasalve-chatbot__msg--system {
    align-self: center;
    background: #333;
    color: #aaa;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
}

@keyframes lasalve-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Typing indicator */
.lasalve-chatbot__typing {
    padding: 4px 16px 8px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.lasalve-chatbot__typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #555;
    animation: lasalve-typing 1.4s infinite ease-in-out;
}

.lasalve-chatbot__typing span:nth-child(2) { animation-delay: 0.2s; }
.lasalve-chatbot__typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes lasalve-typing {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* Quick actions */
.lasalve-chatbot__quick-actions {
    padding: 8px 16px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lasalve-chatbot__quick-actions button {
    background: #2a2a2a;
    color: #FFFFFF;
    border: 1px solid #444;
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.lasalve-chatbot__quick-actions button:hover {
    background: #333;
    border-color: #666;
}

/* Escalation form */
.lasalve-chatbot__escalation {
    padding: 12px 16px;
    background: #222;
    border-top: 1px solid #333;
}

.lasalve-chatbot__escalation p {
    color: #ccc;
    margin: 0 0 8px;
    font-size: 13px;
}

.lasalve-chatbot__esc-input {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: #1b1b1b;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    box-sizing: border-box;
}

.lasalve-chatbot__esc-input:focus {
    outline: none;
    border-color: #d4a843;
}

.lasalve-chatbot__esc-btn {
    width: 100%;
    padding: 8px;
    background: #FFFFFF;
    color: #1b1b1b;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: opacity 0.2s;
}

.lasalve-chatbot__esc-btn:hover {
    opacity: 0.9;
}

/* Rating */
.lasalve-chatbot__rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    background: #222;
    border-top: 1px solid #333;
}

.lasalve-chatbot__rating span {
    color: #aaa;
    font-size: 13px;
}

.lasalve-chatbot__rate-btn {
    background: none;
    border: 1px solid #444;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.lasalve-chatbot__rate-btn:hover {
    background: #333;
    border-color: #666;
}

.lasalve-chatbot__rate-btn.rated {
    background: #333;
    border-color: #d4a843;
}

.lasalve-chatbot__rating--done span {
    color: #d4a843;
}

/* Input area */
.lasalve-chatbot__input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: #1b1b1b;
    border-top: 1px solid #333;
}

.lasalve-chatbot__input {
    flex: 1;
    resize: none;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 8px 12px;
    background: #2a2a2a;
    color: #FFFFFF;
    font-size: 14px;
    font-family: inherit;
    max-height: 100px;
    overflow-y: auto;
    box-sizing: border-box;
}

.lasalve-chatbot__input:focus {
    outline: none;
    border-color: #666;
}

.lasalve-chatbot__input::placeholder {
    color: #777;
}

.lasalve-chatbot__send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #FFFFFF;
    color: #1b1b1b;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.lasalve-chatbot__send:disabled {
    opacity: 0.3;
    cursor: default;
}

.lasalve-chatbot__send:not(:disabled):hover {
    opacity: 0.85;
}

/* Push theme "back to top" above chatbot */
body #mkdf-back-to-top {
    bottom: 90px !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .lasalve-chatbot__window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100dvh;
        height: 100vh; /* fallback */
        max-height: none;
        border-radius: 0;
    }

    #lasalve-chatbot-container.lasalve-chatbot--bottom-right .lasalve-chatbot__window,
    #lasalve-chatbot-container.lasalve-chatbot--bottom-left .lasalve-chatbot__window {
        right: 0;
        left: 0;
    }
}
