/* Missio Concierge chat widget — self-contained, scoped under #mc-widget. */

#mc-widget { --mc-brand: #1a4d8f; }
#mc-widget * { box-sizing: border-box; }

#mc-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99998;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--mc-brand);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.15s ease;
}
#mc-launcher:hover { filter: brightness(0.9); transform: translateY(-2px); }
#mc-launcher svg { width: 28px; height: 28px; fill: #fff; }

/* Bottom-left placement (used while another widget occupies bottom-right). */
#mc-widget.mc-pos-left #mc-launcher,
#mc-widget.mc-pos-left #mc-panel { right: auto; left: 20px; }

#mc-panel {
    position: fixed;
    right: 20px;
    bottom: 92px;
    z-index: 99999;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.28);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #1d2327;
}
#mc-panel.mc-open { display: flex; }

#mc-header {
    background: var(--mc-brand);
    color: #fff;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
#mc-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
#mc-newchat {
    background: rgba(255, 255, 255, 0.16);
    border: none;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
}
#mc-newchat:hover { background: rgba(255, 255, 255, 0.28); }
#mc-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

#mc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f6f7f9;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mc-msg {
    max-width: 80%;
    padding: 9px 12px;
    border-radius: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.mc-msg-visitor {
    align-self: flex-end;
    background: var(--mc-brand);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mc-msg-bot,
.mc-msg-system {
    align-self: flex-start;
    background: #fff;
    color: #1d2327;
    border: 1px solid #e2e4e7;
    border-bottom-left-radius: 4px;
}
.mc-msg-agent {
    align-self: flex-start;
    background: #e7f0fb;
    color: #1d2327;
    border: 1px solid #c6dbf5;
    border-bottom-left-radius: 4px;
}
.mc-author {
    display: block;
    font-size: 11px;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 2px;
}
.mc-typing {
    letter-spacing: 2px;
    opacity: 0.6;
    font-size: 18px;
    line-height: 1;
}

/* Rendered markdown inside bot/agent/system bubbles */
.mc-msg-bot ul,
.mc-msg-agent ul,
.mc-msg-system ul {
    margin: 4px 0;
    padding-left: 20px;
}
.mc-msg-bot li,
.mc-msg-agent li,
.mc-msg-system li { margin: 2px 0; }
.mc-msg-bot a,
.mc-msg-agent a,
.mc-msg-system a { color: var(--mc-brand); text-decoration: underline; }
.mc-msg-bot strong,
.mc-msg-agent strong,
.mc-msg-system strong { font-weight: 700; }

#mc-inputbar {
    display: flex;
    border-top: 1px solid #e2e4e7;
    padding: 8px;
    gap: 8px;
    background: #fff;
}
#mc-input {
    flex: 1;
    resize: none;
    border: 1px solid #d0d3d8;
    border-radius: 8px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 14px;
    max-height: 96px;
    line-height: 1.4;
}
#mc-input:focus { outline: none; border-color: var(--mc-brand); }
#mc-send {
    border: none;
    background: var(--mc-brand);
    color: #fff;
    border-radius: 8px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 600;
}
#mc-send:disabled { opacity: 0.5; cursor: default; }

#mc-handoff-bar {
    background: #fff;
    border-top: 1px solid #e2e4e7;
    padding: 8px;
    text-align: center;
}
#mc-handoff-btn {
    background: none;
    border: 1px solid var(--mc-brand);
    color: var(--mc-brand);
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    width: 100%;
}
#mc-handoff-btn:hover { background: #f0f5fb; }

#mc-handoff-form {
    background: #fff;
    border-top: 1px solid #e2e4e7;
    padding: 12px;
}
#mc-handoff-form .mc-hf-lead {
    margin: 0 0 8px;
    font-size: 13px;
    color: #4b5158;
}
#mc-handoff-form input {
    width: 100%;
    border: 1px solid #d0d3d8;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    margin-bottom: 8px;
    font-family: inherit;
}
#mc-handoff-form input:focus { outline: none; border-color: var(--mc-brand); }
.mc-hf-actions { display: flex; gap: 8px; }
#mc-hf-submit {
    flex: 1;
    border: none;
    background: var(--mc-brand);
    color: #fff;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    font-weight: 600;
}
#mc-hf-submit:disabled { opacity: 0.5; cursor: default; }
#mc-hf-cancel {
    border: 1px solid #d0d3d8;
    background: #fff;
    color: #4b5158;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
}
.mc-hf-error {
    color: #d63638;
    font-size: 12px;
    margin-top: 6px;
    min-height: 14px;
}

/* Source links beneath an answer */
.mc-sources {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #edeef0;
    font-size: 11px;
    line-height: 1.5;
    color: #6b7177;
}
.mc-sources-label { font-weight: 600; margin-right: 2px; }
.mc-sources a { color: var(--mc-brand); text-decoration: underline; }

#mc-footnote {
    text-align: center;
    font-size: 11px;
    color: #8a8f94;
    padding: 4px 0 8px;
    background: #fff;
}
