/* =============================================
   Mocha AI Chat — Widget Styles
   ============================================= */

.mocha-chat {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.mocha-chat--right {
    right: 20px;
    bottom: 20px;
}

.mocha-chat--left {
    left: 20px;
    bottom: 20px;
}

.mocha-chat--hide-mobile {
    display: none;
}

@media (min-width: 769px) {
    .mocha-chat--hide-mobile {
        display: block;
    }
}

/* Trigger Button */
.mocha-chat__trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--mocha-primary, #4A7C59);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    z-index: 2;
}

.mocha-chat__trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.mocha-chat__trigger:active {
    transform: scale(0.96);
}

/* Chat Window */
.mocha-chat__window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-height: 600px;
    height: calc(100vh - 200px);
    max-height: 600px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.mocha-chat--left .mocha-chat__window {
    right: auto;
    left: 0;
}

.mocha-chat.is-open .mocha-chat__window {
    display: flex;
}

/* Header */
.mocha-chat__header {
    background: var(--mocha-primary, #4A7C59);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.mocha-chat__header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.mocha-chat__header-info {
    flex: 1;
    min-width: 0;
}

.mocha-chat__header-info h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    font-family: inherit;
}

.mocha-chat__header-info span {
    font-size: 11px;
    opacity: 0.85;
}

.mocha-chat__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.mocha-chat__close:hover {
    opacity: 1;
}

/* Messages */
.mocha-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9fafb;
}

.mocha-chat__message {
    display: flex;
    max-width: 85%;
}

.mocha-chat__message--user {
    align-self: flex-end;
}

.mocha-chat__message--bot {
    align-self: flex-start;
}

.mocha-chat__bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}

.mocha-chat__message--user .mocha-chat__bubble {
    background: var(--mocha-primary, #4A7C59);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.mocha-chat__message--bot .mocha-chat__bubble {
    background: #fff;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.mocha-chat__message--typing .mocha-chat__bubble {
    color: #9ca3af;
    font-style: italic;
}

/* Quick Replies */
.mocha-chat__quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.mocha-chat__quick-reply {
    padding: 6px 14px;
    border: 1px solid var(--mocha-primary, #4A7C59);
    background: #fff;
    color: var(--mocha-primary, #4A7C59);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.mocha-chat__quick-reply:hover {
    background: var(--mocha-primary, #4A7C59);
    color: #fff;
}

/* Input Area */
.mocha-chat__input-area {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #fff;
    flex-shrink: 0;
}

.mocha-chat__input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.15s;
}

.mocha-chat__input:focus {
    border-color: var(--mocha-primary, #4A7C59);
    box-shadow: 0 0 0 2px rgba(74, 124, 89, 0.15);
}

.mocha-chat__send {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--mocha-primary, #4A7C59);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.mocha-chat__send:hover {
    background: #2D5A3D;
}

.mocha-chat__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Escalation Banner */
.mocha-chat__escalation {
    padding: 12px 16px;
    border-top: 1px solid #fde68a;
    background: #fffbeb;
    text-align: center;
    flex-shrink: 0;
}

.mocha-chat__escalation p {
    margin: 0 0 8px;
    font-size: 12px;
    color: #92400e;
}

/* Inline Shortcode */
.mocha-ai-chat-inline {
    margin: 1rem 0;
}

/* Responsive */
@media (max-width: 480px) {
    .mocha-chat__window {
        width: calc(100vw - 32px);
        max-height: calc(100vh - 120px);
        right: -4px;
    }

    .mocha-chat--left .mocha-chat__window {
        left: -4px;
    }
}

/* Animation */
@keyframes mocha-chat-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mocha-chat__message {
    animation: mocha-chat-fade-in 0.3s ease;
}