/* MLC Chat Widget - Modern UI */
:root {
  --mlc-color: #6c63ff;
  --mlc-color-dark: #574fd6;
  --mlc-color-light: #ede9ff;
  --mlc-radius: 20px;
  --mlc-shadow: 0 12px 40px rgba(0,0,0,.18);
  --mlc-font: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
}
.mlc-widget { position: fixed; z-index: 999999; font-family: var(--mlc-font); font-size: 14px; line-height: 1.5; box-sizing: border-box; }
.mlc-widget * { box-sizing: border-box; }
.mlc-widget.bottom-right { bottom: 20px; right: 20px; }
.mlc-widget.bottom-left { bottom: 20px; left: 20px; }
.mlc-toggle-btn { width: 60px; height: 60px; border-radius: 50%; background: var(--mlc-color); border: none; cursor: pointer; box-shadow: 0 4px 20px rgba(108,99,255,.5); display: flex; align-items: center; justify-content: center; transition: transform .2s; position: relative; color: #fff; }
.mlc-toggle-btn:hover { transform: scale(1.08); }
.mlc-toggle-btn svg { width: 26px; height: 26px; }
.mlc-unread-dot { position: absolute; top: 5px; right: 5px; width: 14px; height: 14px; border-radius: 50%; background: #f44; border: 2px solid #fff; }
.mlc-cta { position: absolute; bottom: 72px; right: 0; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: var(--mlc-shadow); font-size: 13px; max-width: 230px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(108,99,255,.15); }
.mlc-cta-close { background: none; border: none; cursor: pointer; color: #aaa; font-size: 16px; padding: 0; }
.bottom-left .mlc-cta { right: auto; left: 0; }
.mlc-window { position: absolute; bottom: 74px; right: 0; width: 380px; height: 580px; max-height: calc(100vh - 100px); background: #fff; border-radius: var(--mlc-radius); box-shadow: var(--mlc-shadow); overflow: hidden; display: flex; flex-direction: column; border: 1px solid rgba(0,0,0,.06); animation: mlc-slide-up .25s ease; }
.bottom-left .mlc-window { right: auto; left: 0; }
@media(max-width:440px) { .mlc-window { width: calc(100vw - 16px); height: calc(100vh - 88px); right: -8px; border-radius: 16px; } .bottom-left .mlc-window { right: auto; left: -8px; } }
@keyframes mlc-slide-up { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
.mlc-win-header { background: linear-gradient(135deg, var(--mlc-color) 0%, var(--mlc-color-dark) 100%); padding: 0 16px; height: 72px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; border-radius: 20px 20px 0 0; }
.mlc-header-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mlc-header-logo { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: #fff; flex-shrink: 0; }
.mlc-header-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mlc-win-title { font-size: 16px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlc-presence { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.85); }
.mlc-presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #bbb; flex-shrink: 0; }
.mlc-presence.is-online .mlc-presence-dot { background: #4ade80; }
.mlc-presence.is-offline .mlc-presence-dot { background: rgba(255,255,255,.4); }
.mlc-win-close { background: rgba(255,255,255,.15); border: none; color: #fff; cursor: pointer; width: 32px; height: 32px; border-radius: 50%; font-size: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mlc-win-close:hover { background: rgba(255,255,255,.3); }
.mlc-prechat { padding: 24px 20px; overflow-y: auto; flex: 1; background: #f7f7fb; }
.mlc-prechat-intro { font-size: 16px; font-weight: 700; color: #222; margin: 0 0 6px; }
.mlc-prechat-helper { font-size: 13px; color: #777; margin: 0 0 20px; }
.mlc-field { margin-bottom: 14px; }
.mlc-field label { display: block; font-size: 12px; font-weight: 600; color: #444; margin-bottom: 5px; }
.mlc-req { color: var(--mlc-color); }
.mlc-field input { width: 100%; border: 1.5px solid #e0e0ea; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; background: #fff; outline: none; }
.mlc-field input:focus { border-color: var(--mlc-color); box-shadow: 0 0 0 3px rgba(108,99,255,.12); }
.mlc-start-btn { width: 100%; padding: 12px; background: var(--mlc-color); color: #fff; border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 6px; }
.mlc-start-btn:hover { background: var(--mlc-color-dark); }
.mlc-start-btn:disabled { opacity: .6; cursor: not-allowed; }
.mlc-chat-area { display: flex; flex-direction: column; flex: 1; overflow: hidden; background: #f7f7fb; }
.mlc-msg-list { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; }
.mlc-bubble { max-width: 82%; padding: 10px 14px 6px; border-radius: 18px; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.mlc-bubble.visitor { background: var(--mlc-color); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.mlc-bubble.visitor .mlc-bubble-time { color: rgba(255,255,255,.65); text-align: right; }
.mlc-bubble.agent { background: #fff; color: #222; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.mlc-bubble.agent .mlc-bubble-time { color: #aaa; }
.mlc-bubble.system { align-self: center; background: rgba(0,0,0,.05); color: #666; font-size: 12px; border-radius: 10px; padding: 6px 12px 4px; max-width: 90%; text-align: center; }
.mlc-bubble-time { font-size: 10px; margin-top: 3px; display: block; }
.mlc-attachment { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.mlc-attachment img { max-width: 200px; border-radius: 10px; display: block; }
.mlc-attachment-icon { font-size: 18px; }
.mlc-inline-error, .mlc-upload-notice { font-size: 12px; text-align: center; padding: 4px 0; color: #888; }
.mlc-inline-error { color: #e53e3e; }
.mlc-input-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px 12px; background: #fff; border-top: 1px solid #eee; flex-shrink: 0; position: relative; }
.mlc-bar-icon-btn { width: 38px; height: 38px; border-radius: 50%; background: #f0f0f8; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; color: var(--mlc-color); }
.mlc-bar-icon-btn:hover { background: var(--mlc-color-light); }
.mlc-msg-input { flex: 1; border: 1.5px solid #e0e0ea; border-radius: 24px; padding: 9px 16px; font-size: 14px; font-family: inherit; resize: none; max-height: 100px; background: #f7f7fb; color: #222; outline: none; line-height: 1.45; }
.mlc-msg-input:focus { border-color: var(--mlc-color); background: #fff; }
.mlc-msg-input::placeholder { color: #bbb; }
.mlc-msg-send { width: 42px; height: 42px; border-radius: 50%; background: var(--mlc-color); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 2px 8px rgba(108,99,255,.4); }
.mlc-msg-send:hover { background: var(--mlc-color-dark); }
.mlc-msg-send svg { width: 18px; height: 18px; }
#mlc-emoji-picker { position: absolute; bottom: 60px; left: 14px; background: #fff; border: 1px solid #e0e0ea; border-radius: 12px; box-shadow: var(--mlc-shadow); display: none; grid-template-columns: repeat(5,1fr); gap: 2px; padding: 8px; z-index: 10; width: 200px; }
#mlc-emoji-picker button { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; border-radius: 6px; }
.mlc-offline-notice { padding: 20px; text-align: center; color: #888; font-size: 13px; background: #f7f7fb; flex: 1; display: flex; align-items: center; justify-content: center; }
