| 1 |
*, |
| 2 |
*::before, |
| 3 |
*::after { |
| 4 |
box-sizing: border-box; |
| 5 |
} |
| 6 |
|
| 7 |
:host { |
| 8 |
font-family: Arial, sans-serif; |
| 9 |
} |
| 10 |
|
| 11 |
/* Launcher */ |
| 12 |
.wpsc-chatbot-launcher { |
| 13 |
position: fixed; |
| 14 |
bottom: var(--wpsc-chatbot-offset-bottom, 20px); |
| 15 |
right: var(--wpsc-chatbot-offset-right, 20px); |
| 16 |
width: 56px; |
| 17 |
height: 56px; |
| 18 |
border-radius: 50%; |
| 19 |
display: flex; |
| 20 |
align-items: center; |
| 21 |
justify-content: center; |
| 22 |
background: var(--wpsc-chatbot-launcher-bg, #2271b1); |
| 23 |
color: var(--wpsc-chatbot-launcher-icon, #ffffff); |
| 24 |
font-size: 22px; |
| 25 |
cursor: pointer; |
| 26 |
box-shadow: 0 4px 12px rgba(0,0,0,.2); |
| 27 |
z-index: 9999; |
| 28 |
will-change: transform; |
| 29 |
} |
| 30 |
|
| 31 |
/* Widget */ |
| 32 |
.wpsc-chatbot { |
| 33 |
position: fixed; |
| 34 |
bottom: var(--wpsc-chatbot-offset-bottom, 20px); |
| 35 |
right: var(--wpsc-chatbot-offset-right, 20px); |
| 36 |
width: min(400px, calc(100vw - 40px)); |
| 37 |
height: min(700px, calc(100vh - 120px)); |
| 38 |
display: flex; |
| 39 |
flex-direction: column; |
| 40 |
background: #fff; |
| 41 |
border: 1px solid #ddd; |
| 42 |
border-radius: 12px; |
| 43 |
overflow: hidden; |
| 44 |
box-shadow: 0 8px 24px rgba(0,0,0,.15); |
| 45 |
z-index: 9999; |
| 46 |
padding-bottom: env(safe-area-inset-bottom); |
| 47 |
transform-origin: bottom right; |
| 48 |
transform: scale(.8) translateY(20px); |
| 49 |
opacity: 0; |
| 50 |
visibility: hidden; |
| 51 |
pointer-events: none; |
| 52 |
} |
| 53 |
|
| 54 |
.wpsc-chatbot.wpsc-chatbot--active { |
| 55 |
transform: scale(1) translateY(0); |
| 56 |
opacity: 1; |
| 57 |
visibility: visible; |
| 58 |
pointer-events: auto; |
| 59 |
} |
| 60 |
|
| 61 |
.wpsc-chatbot.active { |
| 62 |
transform: scale(1) translateY(0); |
| 63 |
opacity: 1; |
| 64 |
visibility: visible; |
| 65 |
pointer-events: auto; |
| 66 |
} |
| 67 |
|
| 68 |
.wpsc-chatbot-launcher { |
| 69 |
opacity: 1; |
| 70 |
transition: opacity .2s ease; |
| 71 |
} |
| 72 |
|
| 73 |
.wpsc-chatbot-launcher--hidden { |
| 74 |
opacity: 0; |
| 75 |
pointer-events: none; |
| 76 |
} |
| 77 |
|
| 78 |
/* Header Layout */ |
| 79 |
.wpsc-chatbot__header { |
| 80 |
display: flex; |
| 81 |
align-items: center; |
| 82 |
justify-content: space-between; |
| 83 |
gap: 12px; |
| 84 |
flex-shrink: 0; |
| 85 |
padding: 10px 16px; |
| 86 |
background: var(--wpsc-chatbot-header-bg, #ffffff); |
| 87 |
color: var(--wpsc-chatbot-header-fg, #111827); |
| 88 |
border-bottom: 1px solid var(--wpsc-chatbot-header-border, #eeeeee); |
| 89 |
} |
| 90 |
|
| 91 |
.wpsc-chatbot__header-title { |
| 92 |
flex: 1; |
| 93 |
display: flex; |
| 94 |
align-items: center; |
| 95 |
gap: 5px; |
| 96 |
min-width: 0; |
| 97 |
font-size: 16px; |
| 98 |
font-weight: 500; |
| 99 |
overflow: hidden; |
| 100 |
text-overflow: ellipsis; |
| 101 |
white-space: nowrap; |
| 102 |
} |
| 103 |
|
| 104 |
/* Header Actions */ |
| 105 |
.wpsc-chatbot__header-actions { |
| 106 |
display: flex; |
| 107 |
align-items: center; |
| 108 |
flex-shrink: 0; |
| 109 |
gap: 4px; |
| 110 |
} |
| 111 |
|
| 112 |
.wpsc-chatbot__header-btn { |
| 113 |
display: flex; |
| 114 |
align-items: center; |
| 115 |
justify-content: center; |
| 116 |
width: 25px; |
| 117 |
height: 25px; |
| 118 |
padding: 0; |
| 119 |
border: 0; |
| 120 |
border-radius: 6px; |
| 121 |
background: transparent; |
| 122 |
color: var(--wpsc-chatbot-header-btn-fg, var(--wpsc-chatbot-header-fg, #111827)); |
| 123 |
cursor: pointer; |
| 124 |
font-size: 18px; |
| 125 |
line-height: 1; |
| 126 |
transition: background-color .2s ease, color .2s ease; |
| 127 |
} |
| 128 |
|
| 129 |
.wpsc-chatbot__header-btn:hover { |
| 130 |
background: var(--wpsc-chatbot-header-btn-hover, rgba(0, 0, 0, 0.08)); |
| 131 |
color: var(--wpsc-chatbot-header-btn-hover-fg, var(--wpsc-chatbot-header-fg, #111827)); |
| 132 |
} |
| 133 |
|
| 134 |
.wpsc-chatbot__header-btn:focus-visible { |
| 135 |
outline: 2px solid var(--wpsc-chatbot-header-btn-focus, #2271b1); |
| 136 |
outline-offset: 2px; |
| 137 |
} |
| 138 |
|
| 139 |
.wpsc-chatbot__header-btn svg { |
| 140 |
color: currentColor; |
| 141 |
width: 15px; |
| 142 |
height: 15px; |
| 143 |
display: block; |
| 144 |
} |
| 145 |
|
| 146 |
.wpsc-chatbot__header-title svg { |
| 147 |
color: currentColor; |
| 148 |
fill: currentColor; |
| 149 |
} |
| 150 |
|
| 151 |
/* Minimize $ Maximize */ |
| 152 |
.wpsc-chatbot { |
| 153 |
transition: |
| 154 |
transform .50s ease, |
| 155 |
opacity .50s ease, |
| 156 |
visibility .50s ease, |
| 157 |
height .30s ease; |
| 158 |
} |
| 159 |
|
| 160 |
.wpsc-chatbot__footer { |
| 161 |
flex-shrink: 0; |
| 162 |
background: #fff; |
| 163 |
} |
| 164 |
|
| 165 |
.wpsc-chatbot__body, |
| 166 |
.wpsc-chatbot__footer { |
| 167 |
transition: |
| 168 |
opacity .25s ease, |
| 169 |
transform .25s ease; |
| 170 |
} |
| 171 |
|
| 172 |
.wpsc-chatbot__compress, |
| 173 |
.wpsc-chatbot--expanded .wpsc-chatbot__expand, |
| 174 |
.wpsc-chatbot--expanded .wpsc-chatbot__minimize { |
| 175 |
display: none; |
| 176 |
} |
| 177 |
|
| 178 |
.wpsc-chatbot--expanded .wpsc-chatbot__body, |
| 179 |
.wpsc-chatbot--expanded .wpsc-chatbot__footer { |
| 180 |
padding-left: 25vw; |
| 181 |
padding-right: 25vw; |
| 182 |
} |
| 183 |
|
| 184 |
.wpsc-chatbot--expanded .wpsc-chatbot__compress { |
| 185 |
display: inline-flex; |
| 186 |
} |
| 187 |
|
| 188 |
/* Fullscreen */ |
| 189 |
.wpsc-chatbot--fullscreen { |
| 190 |
position: fixed; |
| 191 |
top: 0; |
| 192 |
right: 0; |
| 193 |
bottom: 0; |
| 194 |
left: 0; |
| 195 |
width: 100vw; |
| 196 |
height: 100dvh; |
| 197 |
max-width: none; |
| 198 |
max-height: none; |
| 199 |
border-radius: 0; |
| 200 |
z-index: 999999; |
| 201 |
} |
| 202 |
|
| 203 |
.wpsc-chatbot--fullscreen .wpsc-chatbot__header-title svg { |
| 204 |
width: 35px; |
| 205 |
height: 35px; |
| 206 |
display: block; |
| 207 |
fill: currentColor; |
| 208 |
} |
| 209 |
|
| 210 |
.wpsc-chatbot--fullscreen .wpsc-chatbot__header-btn svg { |
| 211 |
color: var(--wpsc-chatbot-header-fg, #666); |
| 212 |
fill: currentColor; |
| 213 |
width: 20px; |
| 214 |
height: 20px; |
| 215 |
display: block; |
| 216 |
} |
| 217 |
|
| 218 |
.wpsc-chatbot--fullscreen .wpsc-chatbot__header-btn { |
| 219 |
width: 35px; |
| 220 |
height: 35px; |
| 221 |
} |
| 222 |
|
| 223 |
/* Body */ |
| 224 |
.wpsc-chatbot__body { |
| 225 |
background: #f5f5f5; |
| 226 |
flex: 1; |
| 227 |
min-height: 0; |
| 228 |
display: flex; |
| 229 |
flex-direction: column; |
| 230 |
padding: 15px; |
| 231 |
overflow-y: auto; |
| 232 |
overflow-x: hidden; |
| 233 |
word-break: break-word; |
| 234 |
overflow-wrap: break-word; |
| 235 |
opacity: 1; |
| 236 |
transform: translateY(0); |
| 237 |
scroll-behavior: smooth; |
| 238 |
} |
| 239 |
|
| 240 |
/* System Message */ |
| 241 |
.wpsc-chatbot__system__message { |
| 242 |
display: block; |
| 243 |
align-self: flex-start; |
| 244 |
font-size: 13px; |
| 245 |
margin: 5px 0; |
| 246 |
padding: 8px 12px; |
| 247 |
background: #fff; |
| 248 |
border-radius: 1rem; |
| 249 |
box-shadow: 0 .25rem 6px rgba(0, 0, 0, .25); |
| 250 |
max-width: 80%; |
| 251 |
word-break: break-word; |
| 252 |
overflow-wrap: anywhere; |
| 253 |
border-bottom-left-radius: 1px; |
| 254 |
} |
| 255 |
|
| 256 |
/* User Message */ |
| 257 |
.wpsc-chatbot__user__message { |
| 258 |
display: block; |
| 259 |
align-self: flex-end; |
| 260 |
font-size: 13px; |
| 261 |
margin: 5px 0; |
| 262 |
padding: 8px 12px; |
| 263 |
background: #2271b1; |
| 264 |
color: #fff; |
| 265 |
border-radius: 1rem; |
| 266 |
box-shadow: 0 .25rem 6px rgba(0, 0, 0, .25); |
| 267 |
max-width: 80%; |
| 268 |
word-break: break-word; |
| 269 |
overflow-wrap: anywhere; |
| 270 |
border-bottom-right-radius: 1px; |
| 271 |
} |
| 272 |
|
| 273 |
.wpsc-chatbot__message-meta { |
| 274 |
display: flex; |
| 275 |
gap: 6px; |
| 276 |
margin-top: 3px; |
| 277 |
font-size: 10px; |
| 278 |
} |
| 279 |
|
| 280 |
.wpsc-chatbot__message-content p { |
| 281 |
margin: 0; |
| 282 |
} |
| 283 |
|
| 284 |
.wpsc-chatbot__system__message .wpsc-chatbot__message-meta { |
| 285 |
justify-content: flex-start; |
| 286 |
color: #666; |
| 287 |
} |
| 288 |
|
| 289 |
.wpsc-chatbot__user__message .wpsc-chatbot__message-meta { |
| 290 |
justify-content: flex-end; |
| 291 |
color: #ffffff; |
| 292 |
} |
| 293 |
|
| 294 |
/* Footer */ |
| 295 |
/* Input */ |
| 296 |
.wpsc-chatbot__input { |
| 297 |
flex: 1; |
| 298 |
width: 100%; |
| 299 |
height: 44px; |
| 300 |
min-height: 44px; |
| 301 |
max-height: 120px; |
| 302 |
padding: 12px 14px; |
| 303 |
border: 1px solid #e5e7eb; |
| 304 |
border-radius: 6px; |
| 305 |
background: #fff; |
| 306 |
color: #1f2937; |
| 307 |
font: inherit; |
| 308 |
font-size: 14px; |
| 309 |
line-height: 1.4; |
| 310 |
resize: none; |
| 311 |
overflow-y: hidden; |
| 312 |
box-sizing: border-box; |
| 313 |
box-shadow: |
| 314 |
0 1px 2px rgba(0,0,0,.04), |
| 315 |
0 1px 3px rgba(0,0,0,.08); |
| 316 |
transition: |
| 317 |
border-color .2s ease, |
| 318 |
box-shadow .2s ease, |
| 319 |
background-color .2s ease; |
| 320 |
} |
| 321 |
|
| 322 |
.wpsc-chatbot__input-group { |
| 323 |
flex-shrink: 0; |
| 324 |
padding: 15px 15px 0px 15px; |
| 325 |
display: flex; |
| 326 |
gap: 10px; |
| 327 |
border-top: 1px solid #eee; |
| 328 |
opacity: 1; |
| 329 |
transform: translateY(0); |
| 330 |
} |
| 331 |
|
| 332 |
.wpsc-chatbot__input:hover { |
| 333 |
border-color: #d1d5db; |
| 334 |
} |
| 335 |
|
| 336 |
.wpsc-chatbot__input:focus { |
| 337 |
outline: none; |
| 338 |
border-color: #2271b1; |
| 339 |
box-shadow: |
| 340 |
0 0 0 3px rgba(34,113,177,.15), |
| 341 |
0 2px 8px rgba(0,0,0,.08); |
| 342 |
} |
| 343 |
|
| 344 |
.wpsc-chatbot__input::placeholder { |
| 345 |
color: #9ca3af; |
| 346 |
} |
| 347 |
|
| 348 |
.wpsc-chatbot__powered-by { |
| 349 |
display: flex; |
| 350 |
align-items: center; |
| 351 |
justify-content: center; |
| 352 |
margin: 10px 0px 10px 0px; |
| 353 |
font-size: 10px; |
| 354 |
color: #9ca3af; |
| 355 |
} |
| 356 |
|
| 357 |
.wpsc-chatbot__powered-by a { |
| 358 |
display: flex; |
| 359 |
align-items: center; |
| 360 |
justify-content: center; |
| 361 |
height: auto; |
| 362 |
padding-left: 5px; |
| 363 |
} |
| 364 |
|
| 365 |
.wpsc-chatbot__powered-by svg { |
| 366 |
width: 75px; |
| 367 |
} |
| 368 |
|
| 369 |
.wpsc-chatbot__input-conversation-end { |
| 370 |
display: flex; |
| 371 |
align-items: center; |
| 372 |
justify-content: center; |
| 373 |
padding-top: 10px; |
| 374 |
font-size: 10px; |
| 375 |
color: #9ca3af; |
| 376 |
} |
| 377 |
|
| 378 |
/* Send Button */ |
| 379 |
.wpsc-chatbot__send { |
| 380 |
display: none; |
| 381 |
color: var(--wpsc-chatbot-header-fg, #ffffff); |
| 382 |
background-color: var(--wpsc-chatbot-header-bg, #2271b1); |
| 383 |
flex-shrink: 0; |
| 384 |
padding: 8px; |
| 385 |
align-content: center; |
| 386 |
cursor: pointer; |
| 387 |
border-color: var(--wpsc-chatbot-header-bg, #2271b1); |
| 388 |
border-radius: 50%; |
| 389 |
} |
| 390 |
|
| 391 |
@media (hover: hover) { |
| 392 |
.wpsc-chatbot__send:hover { |
| 393 |
color: var(--wpsc-chatbot-header-fg, #ffffff); |
| 394 |
border-color: color-mix(in srgb, var(--wpsc-chatbot-header-bg, #2271b1) 85%, black); |
| 395 |
background-color: color-mix(in srgb, var(--wpsc-chatbot-header-bg, #2271b1) 85%, black); |
| 396 |
box-shadow: 0 0 0 3px color-mix(in srgb, var(--wpsc-chatbot-header-bg, #2271b1) 25%, transparent); |
| 397 |
} |
| 398 |
} |
| 399 |
|
| 400 |
.wpsc-chatbot__header-title svg, |
| 401 |
.wpsc-chatbot__send svg { |
| 402 |
width: 25px; |
| 403 |
height: 25px; |
| 404 |
display: block; |
| 405 |
fill: currentColor; |
| 406 |
} |
| 407 |
|
| 408 |
.wpsc-chatbot-launcher svg { |
| 409 |
width: 30px; |
| 410 |
height: 30px; |
| 411 |
fill: currentColor; |
| 412 |
} |
| 413 |
|
| 414 |
/* Typing Indicator */ |
| 415 |
.wpsc-chatbot__typing { |
| 416 |
display: inline-flex; |
| 417 |
width: auto; |
| 418 |
align-items: center; |
| 419 |
gap: 4px; |
| 420 |
padding: 10px 14px; |
| 421 |
background: #f5f5f5; |
| 422 |
border-radius: 18px; |
| 423 |
max-width: 60px; |
| 424 |
} |
| 425 |
|
| 426 |
.wpsc-chatbot__typing span { |
| 427 |
width: 5px; |
| 428 |
height: 5px; |
| 429 |
border-radius: 50%; |
| 430 |
background: #7a7a7a; |
| 431 |
animation: wpsc-chatbot-typing 1.2s infinite ease-in-out; |
| 432 |
} |
| 433 |
|
| 434 |
.wpsc-chatbot__typing span:nth-child(1) { |
| 435 |
animation-delay: 0s; |
| 436 |
} |
| 437 |
|
| 438 |
.wpsc-chatbot__typing span:nth-child(2) { |
| 439 |
animation-delay: 0.2s; |
| 440 |
} |
| 441 |
|
| 442 |
.wpsc-chatbot__typing span:nth-child(3) { |
| 443 |
animation-delay: 0.4s; |
| 444 |
} |
| 445 |
|
| 446 |
@keyframes wpsc-chatbot-typing { |
| 447 |
0%, |
| 448 |
60%, |
| 449 |
100% { |
| 450 |
transform: translateY(0); |
| 451 |
opacity: .5; |
| 452 |
} |
| 453 |
|
| 454 |
30% { |
| 455 |
transform: translateY(-5px); |
| 456 |
opacity: 1; |
| 457 |
} |
| 458 |
} |
| 459 |
|
| 460 |
.wpsc-chatbot--disabled .wpsc-chatbot__body, |
| 461 |
.wpsc-chatbot--disabled .wpsc-chatbot__footer, |
| 462 |
.wpsc-chatbot--disabled .wpsc-chatbot__header { |
| 463 |
opacity: .4; |
| 464 |
user-select: none; |
| 465 |
} |
| 466 |
|
| 467 |
.wpsc-chatbot--disabled .wpsc-chatbot__body, |
| 468 |
.wpsc-chatbot--disabled .wpsc-chatbot__footer { |
| 469 |
pointer-events: none; |
| 470 |
} |
| 471 |
|
| 472 |
/* WebKit Browsers (Chrome, Edge, Safari) */ |
| 473 |
.wpsc-chatbot__input::-webkit-scrollbar, |
| 474 |
.wpsc-chatbot__body::-webkit-scrollbar { |
| 475 |
width: 8px; |
| 476 |
} |
| 477 |
|
| 478 |
.wpsc-chatbot__input::-webkit-scrollbar-track, |
| 479 |
.wpsc-chatbot__body::-webkit-scrollbar-track { |
| 480 |
background: transparent; |
| 481 |
} |
| 482 |
|
| 483 |
.wpsc-chatbot__input::-webkit-scrollbar-thumb, |
| 484 |
.wpsc-chatbot__body::-webkit-scrollbar-thumb { |
| 485 |
background: #d9d9d9; |
| 486 |
border-radius: 999px; |
| 487 |
} |
| 488 |
|
| 489 |
.wpsc-chatbot__input::-webkit-scrollbar-thumb:hover, |
| 490 |
.wpsc-chatbot__body::-webkit-scrollbar-thumb:hover { |
| 491 |
background: #c5c5c5; |
| 492 |
} |
| 493 |
|
| 494 |
/* Firefox */ |
| 495 |
.wpsc-chatbot__input, |
| 496 |
.wpsc-chatbot__body { |
| 497 |
scrollbar-width: thin; |
| 498 |
scrollbar-color: #d9d9d9 transparent; |
| 499 |
} |
| 500 |
|
| 501 |
/* Responsive */ |
| 502 |
@media (max-width: 768px) { |
| 503 |
|
| 504 |
.wpsc-chatbot__expand, |
| 505 |
.wpsc-chatbot__compress { |
| 506 |
display: none; |
| 507 |
} |
| 508 |
|
| 509 |
.wpsc-chatbot__send { |
| 510 |
display: block; |
| 511 |
} |
| 512 |
|
| 513 |
.wpsc-chatbot__system__message, |
| 514 |
.wpsc-chatbot__user__message { |
| 515 |
font-size: 16px; |
| 516 |
} |
| 517 |
|
| 518 |
.wpsc-chatbot { |
| 519 |
position: fixed; |
| 520 |
top: 0; |
| 521 |
right: 0; |
| 522 |
bottom: 0; |
| 523 |
left: 0; |
| 524 |
width: 100vw; |
| 525 |
height: 100dvh; |
| 526 |
max-width: none; |
| 527 |
max-height: none; |
| 528 |
border-radius: 0; |
| 529 |
z-index: 9999; |
| 530 |
/* Height/top are kept in sync with window.visualViewport via JS while the on-screen |
| 531 |
keyboard is open/closing, so a transition here would fight that and lag/jitter. */ |
| 532 |
transition: transform .3s ease, opacity .3s ease, visibility .3s ease; |
| 533 |
} |
| 534 |
|
| 535 |
/* Prevent iOS Safari from auto-zooming the page when the textarea receives focus - |
| 536 |
it requires the focused field's font-size to be at least 16px. */ |
| 537 |
.wpsc-chatbot__input { |
| 538 |
font-size: 16px; |
| 539 |
} |
| 540 |
|
| 541 |
.wpsc-chatbot--fullscreen { |
| 542 |
position: fixed; |
| 543 |
right: 0; |
| 544 |
bottom: 0; |
| 545 |
left: 0; |
| 546 |
width: 100vw; |
| 547 |
height: 100dvh; |
| 548 |
max-width: none; |
| 549 |
max-height: none; |
| 550 |
border-radius: 0; |
| 551 |
z-index: 999999; |
| 552 |
} |
| 553 |
|
| 554 |
.wpsc-chatbot--expanded .wpsc-chatbot__body { |
| 555 |
padding-left: 2vw; |
| 556 |
padding-right: 2vw; |
| 557 |
} |
| 558 |
|
| 559 |
.wpsc-chatbot--expanded .wpsc-chatbot__footer { |
| 560 |
padding-left: 2vw; |
| 561 |
padding-right: 2vw; |
| 562 |
} |
| 563 |
|
| 564 |
.wpsc-chatbot-launcher { |
| 565 |
bottom: var(--wpsc-chatbot-offset-bottom, 16px); |
| 566 |
right: var(--wpsc-chatbot-offset-right, 16px); |
| 567 |
} |
| 568 |
|
| 569 |
.wpsc-chatbot__header { |
| 570 |
padding: 12px; |
| 571 |
} |
| 572 |
|
| 573 |
.wpsc-chatbot__header-btn { |
| 574 |
width: 36px; |
| 575 |
height: 36px; |
| 576 |
font-size: 20px; |
| 577 |
} |
| 578 |
|
| 579 |
.wpsc-chatbot__header-btn svg { |
| 580 |
width: 18px; |
| 581 |
height: 18px; |
| 582 |
} |
| 583 |
} |