/* ─────────────────────────────────────────────────────────────
   Masseria Convertini — chat widget
   Editorial-minimalist palette matching the main site.
   ───────────────────────────────────────────────────────────── */

:root {
    --mc-olive:       #5C5A3E;
    --mc-olive-dark:  #43412C;
    --mc-parchment:   #F4EFE6;
    --mc-cream:       #FAF7F0;
    --mc-ink:         #2A2A24;
    --mc-soft-ink:    #5D5D54;
    --mc-line:        #D9D2C2;
    --mc-shadow:      rgba(67, 65, 44, 0.18);
}

/* Floating button — bottom right of every page */
.mc-chat-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--mc-olive);
    color: var(--mc-cream);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--mc-shadow);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    font-family: 'Cormorant Garamond', serif;
}

.mc-chat-fab:hover {
    background: var(--mc-olive-dark);
    transform: translateY(-1px);
}

.mc-chat-fab svg {
    width: 24px;
    height: 24px;
    fill: var(--mc-cream);
}

/* Chat panel — slides up when fab is clicked */
.mc-chat-panel {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 380px;
    max-width: calc(100vw - 56px);
    height: 560px;
    max-height: calc(100vh - 140px);
    background: var(--mc-cream);
    border-radius: 6px;
    box-shadow: 0 10px 40px var(--mc-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 998;
    font-family: 'Inter', sans-serif;
}

.mc-chat-panel.open {
    display: flex;
}

.mc-chat-header {
    padding: 18px 22px 16px;
    background: var(--mc-parchment);
    border-bottom: 1px solid var(--mc-line);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.mc-chat-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 19px;
    color: var(--mc-ink);
    margin: 0 0 2px 0;
    letter-spacing: 0.2px;
}

.mc-chat-header .mc-chat-subtitle {
    font-size: 11px;
    color: var(--mc-soft-ink);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.mc-chat-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--mc-soft-ink);
    padding: 0;
    line-height: 1;
    font-size: 22px;
}

.mc-chat-close:hover {
    color: var(--mc-ink);
}

/* Message stream */
.mc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.mc-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.mc-chat-messages::-webkit-scrollbar-thumb {
    background: var(--mc-line);
    border-radius: 3px;
}

.mc-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.mc-msg.user {
    align-self: flex-end;
    background: var(--mc-olive);
    color: var(--mc-cream);
    border-bottom-right-radius: 3px;
}

.mc-msg.assistant {
    align-self: flex-start;
    background: var(--mc-parchment);
    color: var(--mc-ink);
    border-bottom-left-radius: 3px;
}

.mc-msg.assistant.thinking {
    color: var(--mc-soft-ink);
    font-style: italic;
}

.mc-msg.error {
    align-self: center;
    background: transparent;
    color: var(--mc-soft-ink);
    font-style: italic;
    font-size: 12.5px;
    text-align: center;
    max-width: 100%;
}

/* Markdown-ish: render bold, line breaks, lists */
.mc-msg strong { font-weight: 600; }
.mc-msg ul, .mc-msg ol {
    margin: 6px 0;
    padding-left: 18px;
}
.mc-msg li { margin: 3px 0; }

/* Input area */
.mc-chat-input-area {
    border-top: 1px solid var(--mc-line);
    padding: 14px 18px;
    background: var(--mc-cream);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.mc-chat-input {
    flex: 1;
    border: 1px solid var(--mc-line);
    background: white;
    border-radius: 6px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--mc-ink);
    resize: none;
    min-height: 38px;
    max-height: 110px;
    line-height: 1.4;
}

.mc-chat-input:focus {
    outline: none;
    border-color: var(--mc-olive);
}

.mc-chat-send {
    background: var(--mc-olive);
    color: var(--mc-cream);
    border: none;
    border-radius: 6px;
    padding: 9px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    letter-spacing: 0.3px;
    transition: background 0.2s;
}

.mc-chat-send:hover:not(:disabled) {
    background: var(--mc-olive-dark);
}

.mc-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .mc-chat-panel {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .mc-chat-fab {
        bottom: 18px;
        right: 18px;
    }
}
