#sr-live-chat-root {
  --sr-lc-primary: #ff2e63;
  --sr-lc-primary-dark: #e01e52;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  z-index: 10050;
}

#sr-live-chat-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sr-lc-primary), var(--sr-lc-primary-dark));
  color: #fff;
  box-shadow: 0 8px 28px rgba(255, 46, 99, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 10050;
}

#sr-live-chat-bubble:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(255, 46, 99, 0.5);
}

#sr-live-chat-root[data-position='bottom-center'] #sr-live-chat-bubble:hover,
#sr-live-chat-root[data-position='top-center'] #sr-live-chat-bubble:hover {
  transform: translateX(-50%) scale(1.05);
}

#sr-live-chat-bubble svg {
  width: 28px;
  height: 28px;
}

#sr-live-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

#sr-live-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10050;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

#sr-live-chat-root[data-position='top-right'] #sr-live-chat-panel,
#sr-live-chat-root[data-position='top-left'] #sr-live-chat-panel,
#sr-live-chat-root[data-position='top-center'] #sr-live-chat-panel {
  bottom: auto;
}

#sr-live-chat-panel.open {
  display: flex;
  animation: srLcSlideUp 0.28s ease;
}

@keyframes srLcSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sr-lc-header {
  background: linear-gradient(135deg, var(--sr-lc-primary), var(--sr-lc-primary-dark));
  color: #fff;
  padding: 18px 18px 14px;
  flex-shrink: 0;
}

.sr-lc-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sr-lc-header-avatar-wrap {
  flex-shrink: 0;
}

.sr-lc-header-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}

.sr-lc-header-copy {
  min-width: 0;
  flex: 1;
}

.sr-lc-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.sr-lc-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.sr-lc-msg.agent .sr-lc-msg-row,
.sr-lc-msg.system .sr-lc-msg-row {
  align-self: flex-start;
}

.sr-lc-msg.agent .sr-lc-msg-bubble,
.sr-lc-msg.system .sr-lc-msg-bubble {
  min-width: 0;
}

.sr-lc-msg.agent {
  align-self: flex-start;
  background: transparent;
  color: inherit;
  border: none;
  padding: 0;
  max-width: 92%;
}

.sr-lc-msg.agent .sr-lc-msg-bubble {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  border-radius: 16px;
}

.sr-lc-msg.system {
  align-self: flex-start;
  background: transparent;
  color: inherit;
  border: none;
  padding: 0;
  max-width: 92%;
}

.sr-lc-msg.system .sr-lc-msg-bubble {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  border-radius: 16px;
}

.sr-lc-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.sr-lc-header p {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.sr-lc-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
}

.sr-lc-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25);
}

.sr-lc-status.offline .sr-lc-status-dot {
  background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
}

.sr-lc-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sr-lc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sr-lc-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.sr-lc-msg.visitor {
  align-self: flex-end;
  background: var(--sr-lc-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.sr-lc-msg-meta {
  display: block;
  font-size: 10px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.sr-lc-form-wrap {
  padding: 12px 14px 14px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.sr-lc-preform {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.sr-lc-preform input,
.sr-lc-preform textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}

.sr-lc-preform input:focus,
.sr-lc-preform textarea:focus {
  border-color: var(--sr-lc-primary);
  box-shadow: 0 0 0 3px rgba(255, 46, 99, 0.12);
}

.sr-lc-preform button,
.sr-lc-send {
  border: none;
  border-radius: 12px;
  background: var(--sr-lc-primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 16px;
  cursor: pointer;
}

.sr-lc-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.sr-lc-input-row textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}

.sr-lc-input-row textarea:focus {
  border-color: var(--sr-lc-primary);
}

.sr-lc-send-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 14px;
}

.sr-lc-send-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sr-lc-msg-text {
  margin-top: 2px;
}

.sr-lc-attachment {
  display: block;
  margin-top: 4px;
  text-decoration: none;
}

.sr-lc-attachment-image img {
  display: block;
  max-width: 220px;
  max-height: 180px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.sr-lc-msg.agent .sr-lc-attachment-image img {
  border-color: rgba(255, 255, 255, 0.35);
}

.sr-lc-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
  color: inherit;
  font-size: 13px;
  font-weight: 600;
}

.sr-lc-msg.visitor .sr-lc-attachment-file,
.sr-lc-msg.agent .sr-lc-attachment-file {
  background: rgba(255, 255, 255, 0.16);
}

.sr-lc-attachment-icon {
  display: inline-flex;
  min-width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #e11d48;
  font-size: 11px;
  font-weight: 800;
}

.sr-lc-attachment-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-lc-attach-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sr-lc-attach-btn:hover {
  border-color: var(--sr-lc-primary);
  color: var(--sr-lc-primary);
}

.sr-lc-attach-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sr-lc-pending {
  padding: 0 14px 8px;
}

.sr-lc-pending-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  font-size: 12px;
  color: #475569;
}

.sr-lc-pending-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-lc-pending-clear {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.sr-lc-preform-file {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 480px) {
  #sr-live-chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 84px;
    height: min(70vh, 520px);
  }
  #sr-live-chat-bubble {
    right: 16px;
    bottom: 16px;
  }
}
