/* SKM Live Chat widget. Everything is scoped under #skmc-root so the theme cannot restyle it (and it cannot restyle the theme). */
#skmc-root, #skmc-root * { box-sizing: border-box; letter-spacing: normal; text-transform: none; }
#skmc-root {
  --skmc: #4f46e5;
  position: fixed; bottom: 0; z-index: 99990; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.4; color: #1f2937; letter-spacing: normal; text-transform: none;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}
#skmc-root.skmc-right { right: 0; padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#skmc-root.skmc-left  { left: 0;  padding-left:  max(16px, env(safe-area-inset-left, 0px)); }
#skmc-root button, #skmc-root input, #skmc-root textarea { font-family: inherit; font-size: 15px; line-height: 1.4; margin: 0; }
#skmc-root button { cursor: pointer; min-width: 0; min-height: 0; text-shadow: none; }
#skmc-root .skmc-hp { font-size: 16px !important; }

/* Themes often style every <button>; the look-defining properties are therefore !important so the chat always looks the same. */
#skmc-root .skmc-launcher {
  position: relative; display: flex; align-items: center; justify-content: center; width: 58px !important; height: 58px !important; margin: 0 !important; padding: 0 !important;
  border: 0 !important; border-radius: 50% !important; background: var(--skmc) !important; color: #fff !important; box-shadow: 0 6px 20px rgba(0,0,0,.25) !important;
  transition: transform .15s ease, box-shadow .15s ease;
}
.skmc-launcher:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.skmc-launcher:focus-visible, .skmc-send:focus-visible, .skmc-close:focus-visible { outline: 3px solid #fff; outline-offset: -5px; box-shadow: 0 0 0 3px var(--skmc); }
.skmc-launcher svg { width: 28px; height: 28px; fill: currentColor; }
.skmc-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #ef4444; color: #fff; font-size: 12px; font-weight: 700; display: none; align-items: center; justify-content: center; border: 2px solid #fff;
}
.skmc-badge.skmc-on { display: flex; }

.skmc-panel {
  display: none; flex-direction: column; width: 370px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px);
  margin: 0; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
#skmc-root.skmc-open .skmc-panel { display: flex; animation: skmc-in .18s ease; }
#skmc-root.skmc-open .skmc-launcher { display: none; }
@keyframes skmc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.skmc-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; background: var(--skmc); color: #fff; }
.skmc-head-text { flex: 1; min-width: 0; }
.skmc-title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skmc-sub { font-size: 12px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#skmc-root .skmc-close { width: 36px !important; height: 36px !important; flex: 0 0 auto; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: rgba(255,255,255,.18) !important; color: #fff !important; font-size: 20px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.skmc-close:hover { background: rgba(255,255,255,.3); }

.skmc-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; background: #f3f4f6; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.skmc-msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.skmc-msg time { display: block; margin-top: 2px; font-size: 11px; opacity: .65; text-align: right; }
.skmc-in  { align-self: flex-start; background: #fff; color: #1f2937; border-bottom-left-radius: 4px; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.skmc-out { align-self: flex-end; background: var(--skmc); color: #fff; border-bottom-right-radius: 4px; }
.skmc-pending { opacity: .6; }
#skmc-root .skmc-failed { align-self: flex-end; max-width: 82%; font-size: 12px; color: #dc2626 !important; background: transparent !important; border: 0 !important; border-radius: 0 !important; text-align: right; padding: 0 4px !important; text-decoration: underline; }
.skmc-note { align-self: center; font-size: 12px; color: #6b7280; padding: 2px 8px; }

.skmc-form { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: #fff; overflow-y: auto; }
.skmc-form p { margin: 0; color: #4b5563; font-size: 14px; }
.skmc-form label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.skmc-input { width: 100%; height: 44px !important; padding: 0 12px !important; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; color: #111827; font-size: 16px !important; }
.skmc-input:focus, .skmc-text:focus { outline: 2px solid var(--skmc); outline-offset: 0; border-color: transparent; }
.skmc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.skmc-err { color: #dc2626; font-size: 12px; min-height: 16px; margin: 0; }
#skmc-root .skmc-start { height: 46px; padding: 0 16px !important; border: 0 !important; border-radius: 10px !important; background: var(--skmc) !important; color: #fff !important; font-weight: 700; font-size: 15px; }
.skmc-start:disabled { opacity: .5; cursor: default; }

.skmc-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid #e5e7eb; background: #fff; }
.skmc-text { flex: 1; min-width: 0; max-height: 120px; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 20px; resize: none; background: #fff; color: #111827; font-size: 16px !important; line-height: 1.35; }
#skmc-root .skmc-send { width: 44px !important; height: 44px !important; flex: 0 0 auto; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: var(--skmc) !important; color: #fff !important; display: flex; align-items: center; justify-content: center; }
.skmc-send:disabled { opacity: .4; cursor: default; }
.skmc-send svg { width: 20px; height: 20px; fill: currentColor; }
.skmc-foot { padding: 0 10px 8px; background: #fff; color: #9ca3af; font-size: 11px; text-align: center; }

@media (max-width: 520px) {
  #skmc-root.skmc-open { top: 0; left: 0; right: 0; padding: 0 !important; }
  #skmc-root.skmc-open .skmc-panel { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border-radius: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  #skmc-root.skmc-open .skmc-head { padding-top: max(14px, env(safe-area-inset-top, 0px)); }
  #skmc-root.skmc-hide-mobile { display: none; }
}
@media (prefers-reduced-motion: reduce) { #skmc-root.skmc-open .skmc-panel { animation: none; } .skmc-launcher { transition: none; } }
@media (prefers-color-scheme: dark) {
  #skmc-root .skmc-panel { background: #111827; }
  #skmc-root .skmc-body { background: #0b1220; }
  #skmc-root .skmc-in { background: #1f2937; color: #f3f4f6; box-shadow: none; }
  #skmc-root .skmc-form, #skmc-root .skmc-compose, #skmc-root .skmc-foot { background: #111827; border-color: #1f2937; }
  #skmc-root .skmc-form p, #skmc-root .skmc-form label { color: #d1d5db; }
  #skmc-root .skmc-input, #skmc-root .skmc-text { background: #1f2937; color: #f9fafb; border-color: #374151; }
  #skmc-root .skmc-note { color: #9ca3af; }
}
