/* Soltacia Live Chat public widget */
#soltacia-chat-root, #soltacia-chat-root *{box-sizing:border-box}
#soltacia-chat-root.soltacia-chat-root{
  position:fixed;
  z-index:2147483647;
  bottom:calc(18px + env(safe-area-inset-bottom));
  right:calc(18px + env(safe-area-inset-right));
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;

  /* Theme variables (can be overridden by JS via style.setProperty) */
  --soltacia-chat-primary:#111827;
  --soltacia-chat-header-grad-start:#111827;
  --soltacia-chat-header-grad-end:#111827;
  --soltacia-chat-panel-bg:#ffffff;
  --soltacia-chat-panel-border:#e5e7eb;
  --soltacia-chat-messages-bg:#f3f4f6;
  --soltacia-chat-text:#111827;
  --soltacia-chat-muted:#6b7280;
  --soltacia-chat-input-bg:#ffffff;
  --soltacia-chat-input-border:#e5e7eb;
  --soltacia-chat-admin-bubble-bg:#ffffff;
  --soltacia-chat-admin-bubble-border:#e5e7eb;
  --soltacia-chat-admin-text:#111827;
  --soltacia-chat-visitor-bubble-bg:#111827;
  --soltacia-chat-visitor-text:#ffffff;
}
#soltacia-chat-root.soltacia-chat-left{left:calc(18px + env(safe-area-inset-left));right:auto}

.soltacia-chat-fab{
  border:0;
  color:#fff;
  padding:12px 16px;
  border-radius:999px;
  cursor:pointer;
  box-shadow:0 10px 25px rgba(0,0,0,.22);
  font-weight:600;
  background:var(--soltacia-chat-primary);
}

.soltacia-chat-panel{
  position:absolute;
  bottom:56px;
  right:0;
  width:var(--soltacia-chat-widget-width,350px);
  max-width:calc(100vw - 36px);
  height:420px;
  max-height:calc(100vh - 120px);
  background:var(--soltacia-chat-panel-bg);
  border:1px solid var(--soltacia-chat-panel-border);
  border-radius:14px;
  box-shadow:0 20px 50px rgba(0,0,0,.25);
  overflow:hidden;
  display:none;
  flex-direction:column;
  color:var(--soltacia-chat-text);
}

.soltacia-chat-left .soltacia-chat-panel{left:0;right:auto}
.soltacia-chat-panel.open{display:flex}

.soltacia-chat-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  color:#fff;
  background:linear-gradient(135deg,var(--soltacia-chat-header-grad-start),var(--soltacia-chat-header-grad-end));
}

/* Modern style (closer to common live chat widgets) */
.soltacia-chat-style-modern .soltacia-chat-panel{
  width:var(--soltacia-chat-widget-width,390px);
  height:520px;
  border-radius:18px;
}
.soltacia-chat-style-modern .soltacia-chat-header{padding:14px 14px 12px}
.soltacia-chat-style-modern .soltacia-chat-logo{width:40px;height:40px;border-radius:999px;padding:3px}
.soltacia-chat-style-modern .soltacia-chat-title{font-size:15px}
.soltacia-chat-style-modern .soltacia-chat-close{font-size:18px;opacity:.9}
.soltacia-chat-style-modern.soltacia-chat-state-prechat .soltacia-chat-intake{flex:1;overflow:auto;border-top:0;padding:14px;background:var(--soltacia-chat-panel-bg)}
.soltacia-chat-style-modern.soltacia-chat-state-prechat .soltacia-chat-messages{display:none}
.soltacia-chat-style-modern.soltacia-chat-state-prechat .soltacia-chat-compose{display:none}

.soltacia-chat-intro{display:flex;gap:10px;align-items:flex-start;margin:2px 0 12px}
.soltacia-chat-intro-avatar{width:36px;height:36px;border-radius:999px;overflow:hidden;flex:0 0 auto;background:rgba(255,255,255,.92);border:1px solid rgba(0,0,0,.08);box-shadow:0 10px 24px rgba(0,0,0,.18)}
.soltacia-chat-intro-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.soltacia-chat-avatar-fallback{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-weight:800;color:#fff;background:rgba(0,0,0,.22)}
.soltacia-chat-intro-text{font-size:13px;line-height:1.35;color:var(--soltacia-chat-text);opacity:.92}

.soltacia-chat-style-modern .soltacia-chat-field{font-size:14px;padding:11px 12px;border-radius:12px}
.soltacia-chat-style-modern .soltacia-chat-field-message{min-height:110px}
.soltacia-chat-style-modern .soltacia-chat-start{padding:12px 14px;border-radius:12px;font-weight:700}
.soltacia-chat-style-modern .soltacia-chat-start::after{content:'➤';margin-left:8px;font-size:14px;opacity:.9}

.soltacia-chat-header-left{display:flex;align-items:center;gap:10px;min-width:0}
.soltacia-chat-logo{width:28px;height:28px;border-radius:8px;object-fit:contain;background:rgba(255,255,255,.92);padding:2px;flex:0 0 auto}
.soltacia-chat-title-wrap{display:flex;flex-direction:column;min-width:0}

.soltacia-chat-title{font-weight:700;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.soltacia-chat-hours{font-size:12px;line-height:1.1;opacity:.85;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.soltacia-chat-presence{font-size:12px;line-height:1.1;opacity:.92;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.soltacia-chat-header-actions{display:flex;align-items:center;gap:10px}
.soltacia-chat-transcript{
  border:1px solid rgba(255,255,255,.35);
  background:rgba(255,255,255,.12);
  color:#fff;
  border-radius:10px;
  padding:6px 10px;
  font-size:12px;
  cursor:pointer;
}
.soltacia-chat-transcript:disabled{opacity:.5;cursor:not-allowed}

.soltacia-chat-close{background:transparent;border:0;color:#fff;font-size:22px;cursor:pointer;line-height:1}

.soltacia-chat-header.layout-center{position:relative;justify-content:center}
.soltacia-chat-header.layout-center .soltacia-chat-header-left{width:100%;justify-content:center}
.soltacia-chat-header.layout-center .soltacia-chat-title-wrap{align-items:center;text-align:center}
.soltacia-chat-header.layout-center .soltacia-chat-header-actions{position:absolute;right:12px;top:50%;transform:translateY(-50%)}

.soltacia-chat-body{display:flex;flex-direction:column;flex:1;min-height:0}
.soltacia-chat-messages{
  flex:1;
  min-height:0;
  overflow:auto;
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
  background:var(--soltacia-chat-messages-bg);
}

.soltacia-chat-compose{flex-shrink:0;display:flex;flex-direction:column;gap:8px;padding:10px;border-top:1px solid var(--soltacia-chat-panel-border);background:var(--soltacia-chat-panel-bg)}
.soltacia-chat-compose textarea{font-size:16px;width:100%;min-height:58px;resize:none;border:1px solid var(--soltacia-chat-input-border);border-radius:10px;padding:10px;background:var(--soltacia-chat-input-bg);color:var(--soltacia-chat-text)}
.soltacia-chat-compose-actions{display:flex;align-items:center;gap:10px;min-width:0}
.soltacia-chat-compose button{border:0;background:var(--soltacia-chat-primary);color:#fff;border-radius:10px;padding:10px 14px;cursor:pointer}
.soltacia-chat-compose button:disabled{opacity:.5;cursor:not-allowed}
#soltaciaChatSendBtn{flex:0 0 auto;min-width:86px;height:42px}

.soltacia-chat-msg{display:flex}
.soltacia-chat-bubble{max-width:82%;padding:9px 10px;border-radius:12px;line-height:1.25;font-size:14px}

.soltacia-chat-visitor{justify-content:flex-end}
.soltacia-chat-visitor .soltacia-chat-bubble{background:var(--soltacia-chat-visitor-bubble-bg);color:var(--soltacia-chat-visitor-text)}

.soltacia-chat-admin{justify-content:flex-start}
.soltacia-chat-admin .soltacia-chat-bubble{background:var(--soltacia-chat-admin-bubble-bg);border:1px solid var(--soltacia-chat-admin-bubble-border);color:var(--soltacia-chat-admin-text)}

.soltacia-chat-system{justify-content:center}
.soltacia-chat-system .soltacia-chat-bubble{background:transparent;color:var(--soltacia-chat-muted);font-size:12px}

.soltacia-chat-intake{padding:10px;background:var(--soltacia-chat-panel-bg);border-top:1px solid var(--soltacia-chat-panel-border);position:relative}
.soltacia-chat-offline-note{margin:0 0 8px;padding:10px;border-radius:10px;background:var(--soltacia-chat-messages-bg);color:var(--soltacia-chat-text);font-size:13px}
.soltacia-chat-field{width:100%;padding:10px;border:1px solid var(--soltacia-chat-input-border);border-radius:10px;margin-bottom:8px;background:var(--soltacia-chat-input-bg);color:var(--soltacia-chat-text)}
.soltacia-chat-start{width:100%;padding:10px;border:0;border-radius:10px;background:var(--soltacia-chat-primary);color:#fff;cursor:pointer}
.soltacia-chat-error{color:#b91c1c;font-size:13px;margin-bottom:8px}

.soltacia-chat-footer{padding:10px 12px;border-top:1px solid var(--soltacia-chat-panel-border);font-size:11px;color:var(--soltacia-chat-muted);background:var(--soltacia-chat-panel-bg);text-align:right}

/* Accessibility */
.soltacia-chat-fab:focus-visible,
.soltacia-chat-close:focus-visible,
.soltacia-chat-transcript:focus-visible,
.soltacia-chat-compose button:focus-visible,
.soltacia-chat-start:focus-visible,
.soltacia-chat-field:focus-visible,
.soltacia-chat-compose textarea:focus-visible{
  outline:3px solid rgba(59,130,246,.55);
  outline-offset:2px;
}

@media (max-width: 420px){
  .soltacia-chat-panel{width:calc(100vw - 24px);right:0;left:0;margin:0 auto}
  .soltacia-chat-style-modern .soltacia-chat-panel{width:calc(100vw - 24px);height:calc(100vh - 140px)}
  #soltacia-chat-root.soltacia-chat-left{left:calc(12px + env(safe-area-inset-left))}
  #soltacia-chat-root.soltacia-chat-root{right:calc(12px + env(safe-area-inset-right));bottom:calc(12px + env(safe-area-inset-bottom))}
  .soltacia-chat-transcript{padding:6px 8px}
}

/* Typing indicator */
.soltacia-chat-typing{font-size:12px;color:var(--soltacia-chat-muted,#64748b);padding:6px 12px}


/* v1.0.12: explicit public palette match for saved settings, even behind page cache. */
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-panel,
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-intake,
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-footer {
  background:#0b1220;
  color:#f9fafb;
  border-color:#1f2937;
}
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-messages,
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-offline-note {
  background:#0f172a;
  color:#f9fafb;
  border-color:#1f2937;
}
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-field,
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-compose textarea {
  background:#0f172a;
  color:#f9fafb;
  border-color:#334155;
}
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-field::placeholder,
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-compose textarea::placeholder {
  color:#94a3b8;
}
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-intro-text,
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-footer,
#soltacia-chat-root.soltacia-chat-palette-dark .soltacia-chat-subtitle {
  color:#cbd5e1;
}


/* v1.0.14: footer link + intake error spacing fix */
.soltacia-chat-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.soltacia-chat-intake {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.soltacia-chat-intake .soltacia-chat-field {
  margin-bottom: 0;
}

.soltacia-chat-error {
  margin: 0 0 2px;
  line-height: 1.35;
  min-height: 18px;
  flex: 0 0 auto;
}

.soltacia-chat-start {
  flex: 0 0 auto;
  min-height: 42px;
  margin-top: 2px;
}

.soltacia-chat-style-modern.soltacia-chat-state-prechat .soltacia-chat-intake {
  padding-bottom: 16px;
}

.soltacia-chat-style-modern.soltacia-chat-state-prechat .soltacia-chat-field-message {
  min-height: 92px;
}


/* v1.0.16: Offline/intake layout must keep Send button visible. */
#soltacia-chat-root .soltacia-chat-panel {
  display: none;
  flex-direction: column;
}

#soltacia-chat-root .soltacia-chat-panel.open {
  display: flex;
}

#soltacia-chat-root .soltacia-chat-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

#soltacia-chat-root.soltacia-chat-state-prechat .soltacia-chat-body {
  overflow: hidden;
}

#soltacia-chat-root.soltacia-chat-state-prechat .soltacia-chat-intake {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 14px;
  box-sizing: border-box;
}

#soltacia-chat-root.soltacia-chat-state-prechat .soltacia-chat-field {
  flex: 0 0 auto;
  margin-bottom: 0;
  box-sizing: border-box;
}

#soltacia-chat-root.soltacia-chat-state-prechat .soltacia-chat-field-message {
  flex: 1 1 98px;
  min-height: 86px;
  max-height: 132px;
  resize: vertical;
}

#soltacia-chat-root.soltacia-chat-state-prechat .soltacia-chat-error {
  flex: 0 0 auto;
  margin: 0;
  min-height: 18px;
  line-height: 1.35;
}

#soltacia-chat-root.soltacia-chat-state-prechat .soltacia-chat-start {
  flex: 0 0 auto;
  display: block;
  min-height: 50px;
  margin-top: 4px;
  margin-bottom: 0;
  padding: 13px 14px;
  box-sizing: border-box;
}

#soltacia-chat-root.soltacia-chat-state-prechat .soltacia-chat-footer {
  flex: 0 0 auto;
}

#soltacia-chat-root.soltacia-chat-style-modern.soltacia-chat-state-prechat .soltacia-chat-panel {
  height:min(var(--soltacia-chat-widget-height,680px), calc(100vh - 96px));
  max-height: calc(100vh - 96px);
}

@media (max-height: 720px) {
  #soltacia-chat-root.soltacia-chat-style-modern.soltacia-chat-state-prechat .soltacia-chat-panel {
    height: calc(100vh - 72px);
    max-height: calc(100vh - 72px);
  }

  #soltacia-chat-root.soltacia-chat-state-prechat .soltacia-chat-field-message {
    min-height: 74px;
    max-height: 110px;
  }
}

@media (max-width: 420px) {
  #soltacia-chat-root.soltacia-chat-style-modern.soltacia-chat-state-prechat .soltacia-chat-panel {
    height: calc(100vh - 112px);
    max-height: calc(100vh - 112px);
  }
}


/* v1.0.18: add another 30px height and 30px width for the widget. */


/* v1.0.19: widget size settings */
.soltacia-chat-preview-root .soltacia-chat-panel,
#soltacia-chat-root.soltacia-chat-style-modern .soltacia-chat-panel {
  width: var(--soltacia-chat-widget-width, 390px);
}

#soltacia-chat-root.soltacia-chat-style-modern.soltacia-chat-state-prechat .soltacia-chat-panel {
  height: min(var(--soltacia-chat-widget-height, 680px), calc(100vh - 96px));
}


/* v1.0.22 cleaner screenshot/file attachments */
.soltacia-chat-compose-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.soltacia-chat-compose-actions .soltacia-chat-file-name {
  flex: 1 1 auto;
  min-width: 0;
}
.soltacia-chat-attach-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  min-width: 0;
}
.soltacia-chat-attach-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid var(--soltacia-chat-input-border);
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  color: var(--soltacia-chat-text);
  background: var(--soltacia-chat-input-bg);
  white-space: nowrap;
}
.soltacia-chat-attach-btn input,
.soltacia-chat-attach-btn input[type="file"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.soltacia-chat-file-name {
  display: inline-block;
  font-size: 11px;
  color: var(--soltacia-chat-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.soltacia-chat-intake-attach {
  flex: 0 0 auto;
  align-items: flex-start;
}
.soltacia-chat-intake-attach .soltacia-chat-file-name {
  display: block;
  margin-top: 4px;
}
.soltacia-chat-attachment {
  max-width: 240px;
}
.soltacia-chat-attachment a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
}
.soltacia-chat-attachment img {
  display: block;
  max-width: 220px;
  max-height: 160px;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.35);
}
.soltacia-chat-attachment span {
  font-size: 12px;
  text-decoration: underline;
}

@media (max-width: 420px) {
  .soltacia-chat-compose-actions {
    gap: 8px;
  }
  #soltaciaChatSendBtn {
    min-width: 74px;
  }
}


/* v1.0.23: cleaner paperclip attachment control */
.soltacia-chat-compose-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "attach send"
    "name send";
  align-items: center;
  gap: 4px 10px;
}

.soltacia-chat-compose-actions .soltacia-chat-attach-btn {
  grid-area: attach;
  justify-self: start;
}

.soltacia-chat-compose-actions .soltacia-chat-file-name {
  grid-area: name;
  max-width: 100%;
  padding-left: 4px;
}

.soltacia-chat-compose-actions #soltaciaChatSendBtn {
  grid-area: send;
  align-self: stretch;
  min-height: 44px;
}

.soltacia-chat-paperclip {
  display: inline-block;
  line-height: 1;
  margin-right: 5px;
}

.soltacia-chat-attach-btn {
  gap: 4px;
}

.soltacia-chat-intake-attach {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
}

.soltacia-chat-intake-attach .soltacia-chat-file-name {
  padding-left: 2px;
}


/* v1.0.24: reliable custom file picker, no native browser file chrome */
.soltacia-chat-hidden-file,
.soltacia-chat-attach-row input[type="file"].soltacia-chat-hidden-file,
.soltacia-chat-compose-actions input[type="file"].soltacia-chat-hidden-file {
  position: fixed !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
}

.soltacia-chat-compose-actions {
  grid-template-columns: auto minmax(0,1fr) auto;
  grid-template-areas:
    "attach name send";
}

.soltacia-chat-compose-actions .soltacia-chat-file-name {
  align-self: center;
}

.soltacia-chat-attach-btn {
  border: 1px solid var(--soltacia-chat-input-border) !important;
  background: var(--soltacia-chat-input-bg) !important;
}

.soltacia-chat-attach-btn:hover {
  filter: brightness(1.08);
}

/* v1.0.25: attachment upload/status responsiveness */
.soltacia-chat-file-name {
  min-height: 16px;
}


/* v1.0.26: image-only uploads with visible upload progress */
.soltacia-chat-upload-progress {
  width: 100%;
  min-width: 120px;
  grid-column: 1 / -1;
  margin-top: 2px;
}

.soltacia-chat-upload-bar {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148,163,184,.28);
}

.soltacia-chat-upload-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--soltacia-chat-primary);
  transition: width .18s ease;
}

.soltacia-chat-upload-text {
  margin-top: 3px;
  font-size: 11px;
  color: var(--soltacia-chat-muted);
}

.soltacia-chat-intake-attach .soltacia-chat-upload-progress {
  grid-column: 1 / -1;
}
