/* Munich Finest Bakery chat widget — flow UI, bakery branding.
   All rules scoped under #mbc-root to keep specificity low and avoid theme bleed. */
#mbc-root * { box-sizing: border-box; }
#mbc-root { font-family: inherit; font-size: 15px; color: #3a352f; line-height: 1.5; }
#mbc-root .mbc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Trigger bubble */
#mbc-trigger {
    position: fixed; bottom: 24px; right: 24px;
    width: 60px; height: 60px;
    background: #6b4423; color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 6px 24px rgba(107,68,35,0.35);
    z-index: 9998; border: none; padding: 0; margin: 0; font-size: 28px; line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#mbc-trigger:hover { transform: scale(1.05); box-shadow: 0 8px 28px rgba(107,68,35,0.45); }
#mbc-trigger::after {
    content: ''; position: absolute; top: 4px; right: 4px;
    width: 12px; height: 12px; background: #4ecb8d; border: 2px solid #fff; border-radius: 50%;
}
#mbc-trigger.mbc-hidden { display: none; }

/* Panel */
#mbc-panel {
    position: fixed; bottom: 24px; right: 24px;
    width: 380px; height: 620px; max-height: calc(100vh - 48px);
    background: #fff; border-radius: 16px;
    box-shadow: 0 12px 48px rgba(58,43,28,0.25);
    display: flex; flex-direction: column; overflow: hidden;
    z-index: 9999; border: 1px solid #e7dccd;
    animation: mbcSlideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes mbcSlideUp { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
#mbc-panel.mbc-hidden { display: none; }
#mbc-panel[dir="rtl"] { right: auto; left: 24px; }

/* Header */
#mbc-root .mbc-header {
    background: #6b4423; color: #fff; padding: 14px 20px; margin: 0;
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
#mbc-root .mbc-header-info { display: flex; align-items: center; gap: 12px; }
#mbc-root .mbc-header-avatar {
    width: 40px; height: 40px; background: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; line-height: 1;
}
#mbc-root .mbc-header-text h3 { font-size: 15px; font-weight: 700; margin: 0 0 2px 0; padding: 0; color: #fff; }
#mbc-root .mbc-header-text .mbc-status { font-size: 12px; opacity: 0.88; display: flex; align-items: center; gap: 6px; }
#mbc-root .mbc-status-dot { width: 8px; height: 8px; background: #4ecb8d; border-radius: 50%; display: inline-block; flex-shrink: 0; }
#mbc-root .mbc-close {
    background: rgba(255,255,255,0.12); border: none; color: #fff;
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background 0.2s ease; flex-shrink: 0; font-size: 20px; line-height: 1;
}
#mbc-root .mbc-close:hover { background: rgba(255,255,255,0.24); }

/* Messages */
#mbc-root .mbc-messages {
    flex: 1; overflow-y: auto; padding: 16px; margin: 0;
    background: #faf6f1; display: flex; flex-direction: column; gap: 12px;
}
#mbc-root .mbc-messages::-webkit-scrollbar { width: 5px; }
#mbc-root .mbc-messages::-webkit-scrollbar-thumb { background: #e7dccd; border-radius: 3px; }

#mbc-root .mbc-row { display: flex; gap: 8px; align-items: flex-start; animation: mbcFade 0.3s ease; }
@keyframes mbcFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

#mbc-root .mbc-bot-avatar {
    width: 30px; height: 30px; background: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; margin-top: 2px;
    border: 1.5px solid #e7dccd; line-height: 1;
}
#mbc-root .mbc-bubble {
    background: #fff; padding: 12px 14px; margin: 0; border-radius: 8px 14px 14px 14px;
    font-size: 14px; line-height: 1.55; color: #3a352f; max-width: calc(100% - 38px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.07); border: 1px solid #f0e7da;
}
#mbc-root .mbc-bubble strong { color: #6b4423; }
#mbc-root .mbc-bubble a { color: #6b4423; text-decoration: underline; word-break: break-word; }

#mbc-root .mbc-user {
    align-self: flex-end; background: #6b4423; color: #fff; padding: 9px 13px; margin: 0 6px 0 0;
    border-radius: 14px 8px 14px 14px; font-size: 13.5px; max-width: calc(100% - 20px); animation: mbcFade 0.3s ease;
}

/* Typing */
#mbc-root .mbc-typing {
    display: flex; gap: 4px; align-items: center; padding: 12px 14px; background: #fff;
    border-radius: 8px 14px 14px 14px; border: 1px solid #f0e7da; box-shadow: 0 1px 4px rgba(0,0,0,0.07); width: fit-content;
}
#mbc-root .mbc-typing span { width: 7px; height: 7px; background: #c9b69f; border-radius: 50%; animation: mbcBounce 1.2s infinite; display: block; }
#mbc-root .mbc-typing span:nth-child(2) { animation-delay: 0.15s; }
#mbc-root .mbc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes mbcBounce { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Quick replies */
#mbc-root .mbc-quick { display: flex; flex-direction: column; gap: 7px; margin: 4px 0 0 0; padding: 0 6px 0 38px; animation: mbcFade 0.4s ease; }
#mbc-root .mbc-chip {
    background: #fff; border: 1.5px solid #e7dccd; color: #6b4423; padding: 9px 13px; margin: 0;
    border-radius: 22px; font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; display: block; width: 100%;
    transition: background 0.2s ease, border-color 0.2s ease; font-family: inherit; line-height: 1.4; text-decoration: none;
}
#mbc-root .mbc-chip:hover { background: #f6efe6; border-color: #d8c4a8; }
#mbc-root .mbc-chip.mbc-cta { background: #6b4423; color: #fff; border-color: #6b4423; }
#mbc-root .mbc-chip.mbc-cta:hover { background: #7d5230; }

#mbc-root .mbc-separator { height: 1px; background: #e7dccd; margin: 4px 0; flex-shrink: 0; }

/* Product list — one selectable row per product */
#mbc-root .mbc-products { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 0 0; padding: 0 6px 0 38px; animation: mbcFade 0.4s ease; }
#mbc-root .mbc-prow {
    display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
    background: #fff; border: 1.5px solid #ece2d4; border-radius: 14px; padding: 9px 11px 9px 9px;
    cursor: pointer; font-family: inherit; box-shadow: 0 1px 3px rgba(58,43,28,0.06);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, transform .08s ease;
}
#mbc-root .mbc-prow:hover { border-color: #d8c4a8; box-shadow: 0 3px 10px rgba(58,43,28,0.12); }
#mbc-root .mbc-prow:active { transform: scale(0.99); }
#mbc-root .mbc-prow.mbc-selected { border-color: #6b4423; background: #fbf6f0; box-shadow: 0 0 0 1px #6b4423 inset, 0 3px 10px rgba(107,68,35,0.15); }

#mbc-root .mbc-thumb {
    width: 54px; height: 54px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
    background: #f3ece1; display: flex; align-items: center; justify-content: center;
}
#mbc-root .mbc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
#mbc-root .mbc-thumb-na::after { content: 'N/A'; font-size: 11px; font-weight: 700; color: #c2b29c; letter-spacing: .03em; }

#mbc-root .mbc-pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#mbc-root .mbc-pname { font-size: 13px; font-weight: 600; color: #3a352f; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#mbc-root .mbc-pprice { font-size: 12.5px; font-weight: 700; color: #6b4423; }
#mbc-root .mbc-ppack { font-weight: 500; color: #9a8d7c; }

#mbc-root .mbc-pcheck {
    width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%;
    border: 1.5px solid #d8c4a8; background: transparent; color: transparent;
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
#mbc-root .mbc-prow.mbc-selected .mbc-pcheck { background: #6b4423; border-color: #6b4423; color: #fff; }

/* Sticky cart bar above the input */
#mbc-root .mbc-cartbar { padding: 10px 14px; border-top: 1px solid #f0e7da; background: #fff; flex-shrink: 0; }
#mbc-root .mbc-cartbar[hidden] { display: none; }
#mbc-root .mbc-cartbar-btn {
    width: 100%; border: 0; background: #6b4423; color: #fff; border-radius: 24px; padding: 12px;
    font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
    box-shadow: 0 4px 14px rgba(107,68,35,0.3); transition: background .2s ease, transform .08s ease;
}
#mbc-root .mbc-cartbar-btn:hover { background: #7d5230; }
#mbc-root .mbc-cartbar-btn:active { transform: scale(0.99); }
#mbc-root .mbc-cartbar-loading { display: block; text-align: center; color: #9a8d7c; padding: 8px; }

/* Footer */
#mbc-root .mbc-footer { padding: 12px 16px; margin: 0; border-top: 1px solid #f0e7da; background: #fff; flex-shrink: 0; }
#mbc-root .mbc-input-row { display: flex; gap: 8px; align-items: center; }
#mbc-root .mbc-input {
    flex: 1; background: #faf6f1; border: 1.5px solid #e7dccd; border-radius: 20px; padding: 9px 14px; margin: 0;
    font-size: 16px; font-family: inherit; color: #3a352f; outline: none; transition: border-color 0.2s ease;
}
#mbc-root .mbc-input:focus { border-color: #6b4423; }
#mbc-root .mbc-send {
    background: #6b4423; color: #fff; border: none; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background 0.2s ease; flex-shrink: 0;
}
#mbc-root .mbc-send:hover { background: #7d5230; }
#mbc-root .mbc-send:disabled, #mbc-root .mbc-input:disabled { opacity: 0.5; cursor: not-allowed; }
#mbc-root .mbc-meta { text-align: center; font-size: 11px; color: #a89c8c; margin: 8px 0 0 0; }
#mbc-root .mbc-restart { background: none; border: none; padding: 0; margin: 0; font-size: 11px; color: #b7a994; cursor: pointer; font-family: inherit; transition: color 0.2s ease; }
#mbc-root .mbc-restart:hover { color: #6b4423; }

/* Mobile */
@media (max-width: 480px) {
    #mbc-panel { bottom: 0; right: 0; left: 0; width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
    #mbc-panel[dir="rtl"] { left: 0; }
    #mbc-trigger { bottom: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    #mbc-panel, #mbc-root .mbc-row, #mbc-root .mbc-quick, #mbc-root .mbc-products { animation: none; }
}
