/* wisechat widget v2 — branding-defaults */
#wisechat-root {
    --brand: #3E607E;
    --bot-bg: #f7f8ff;
    --user-bg: var(--brand);
    --text: #1a1a1a;
    --text-on-brand: #ffffff;
    --border: #e2e6ea;
    --radius: 12px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    font-family: var(--font);
    color: var(--text);
    box-sizing: border-box;
}

#wisechat-root *,
#wisechat-root *::before,
#wisechat-root *::after {
    box-sizing: inherit;
}

/* Desktop full-embed */
#wisechat-root.wm-embed {
    width: 100%;
    max-width: 720px;
    margin: 24px auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    display: flex;
    flex-direction: column;
    height: 600px;
    overflow: hidden;
}

/* Mobile floating bubble */
#wisechat-root.wm-bubble {
    position: fixed;
    bottom: 16px;
    left: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--text-on-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#wisechat-root.wm-bubble.wm-open {
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: calc(100vw - 32px);
    height: calc(100vh - 32px);
    max-width: 480px;
    max-height: 720px;
    border-radius: var(--radius);
    background: white;
    color: var(--text);
    cursor: default;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

/* Header */
.wm-header {
    background: var(--brand);
    color: var(--text-on-brand);
    padding: 12px 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wm-header button {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

/* Messages */
.wm-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: white;
}

.wm-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: var(--radius);
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.wm-msg.wm-user {
    align-self: flex-end;
    background: var(--user-bg);
    color: var(--text-on-brand);
}

.wm-msg.wm-bot {
    align-self: flex-start;
    background: var(--bot-bg);
}

.wm-msg a {
    color: inherit;
    text-decoration: underline;
}

/* Starter prompts */
.wm-starters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 16px 8px;
    background: white;
}

.wm-starter {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}

.wm-starter:hover {
    background: var(--bot-bg);
}

/* Input */
.wm-input {
    border-top: 1px solid var(--border);
    padding: 8px;
    display: flex;
    gap: 8px;
    background: white;
}

.wm-input input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
}

.wm-input input:focus {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.wm-input button {
    background: var(--brand);
    color: var(--text-on-brand);
    border: 0;
    border-radius: var(--radius);
    padding: 0 16px;
    cursor: pointer;
    font-family: inherit;
}

.wm-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Privacy modal */
.wm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wm-modal {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    max-width: 90vw;
    width: 480px;
    text-align: left;
    line-height: 1.5;
}

.wm-modal h3 {
    margin: 0 0 12px;
    color: var(--brand);
}

.wm-modal-actions {
    margin-top: 16px;
    text-align: right;
}

.wm-modal-actions button {
    background: var(--brand);
    color: var(--text-on-brand);
    border: 0;
    border-radius: var(--radius);
    padding: 8px 16px;
    cursor: pointer;
}

/* Tooltip on bubble */
.wm-tooltip {
    position: absolute;
    bottom: 60px;
    left: 0;
    background: white;
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
}
