.wpacl-root {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #111827;
}

.wpacl-root-floating {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  pointer-events: none;
}
.wpacl-root-floating .wpacl-launcher,
.wpacl-root-floating .wpacl-widget {
  pointer-events: auto;
}

.wpacl-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wpacl-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.35);
}

.wpacl-launcher:focus {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.wpacl-launcher-icon {
  font-size: 20px;
}

.wpacl-widget {
  width: min(390px, calc(100vw - 32px));
  min-height: 420px;
  height: clamp(420px, 70vh, 620px);
  margin-top: 12px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.wpacl-widget[data-open="0"],
.wpacl-widget[hidden] {
  display: none;
}

.wpacl-widget.is-inline {
  position: relative;
  margin: 0 auto;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  width: 100%;
  max-width: 640px;
  height: auto;
}

.wpacl-header {
  background: linear-gradient(135deg, #111827, #1f2937);
  color: #f9fafb;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.wpacl-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wpacl-title-text {
  font-weight: 700;
  font-size: 18px;
}

.wpacl-subtitle {
  font-size: 13px;
  opacity: 0.78;
}


.wpacl-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: radial-gradient(circle at top right, rgba(191, 219, 254, 0.22), transparent 60%), #f9fafb;
  scrollbar-width: thin;
  min-height: 260px;
  -webkit-overflow-scrolling: touch;
}

.wpacl-messages::-webkit-scrollbar {
  width: 8px;
}

.wpacl-messages::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
}

.wpacl-msg {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 16px;
  margin: 6px 0 10px;
  line-height: 1.45;
  font-size: 14px;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 10px;
}

.wpacl-msg.user {
  margin-left: auto;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #f8fafc;
  border-bottom-right-radius: 6px;
}

.wpacl-msg.ai {
  margin-right: auto;
  background: #ffffff;
  color: #111827;
  border: 1px solid rgba(37, 99, 235, 0.08);
  border-bottom-left-radius: 6px;
}

.wpacl-msg.typing {
  opacity: 0.75;
  font-style: italic;
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed rgba(148, 163, 184, 0.6);
}

.wpacl-msg-text {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.wpacl-msg-text a {
  color: #1d4ed8;
  text-decoration: underline;
  font-weight: 600;
  word-break: break-word;
}

.wpacl-msg-text a:hover,
.wpacl-msg-text a:focus {
  text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
  .wpacl-root {
    color: #e5e7eb;
  }

  .wpacl-msg-text a {
    color: #93c5fd;
  }

  .wpacl-msg-text a:hover,
  .wpacl-msg-text a:focus {
    color: #bfdbfe;
  }
}

.wpacl-msg-text p {
  margin: 0 0 8px;
}

.wpacl-msg-text p:last-child {
  margin-bottom: 0;
}

.wpacl-msg-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}

.wpacl-msg-media img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.wpacl-msg-location {
  margin-top: 6px;
  font-size: 13px;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  color: inherit;
}

.wpacl-msg-location a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.wpacl-msg-location span {
  font-size: 12px;
  opacity: 0.75;
}

.wpacl-msg-location a:hover {
  text-decoration: underline;
}

.wpacl-msg-meta {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.65;
}

.wpacl-form {
  padding: 16px;
  background: #ffffff;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wpacl-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.wpacl-input-row textarea {
  flex: 1;
}

.wpacl-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wpacl-tool {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #f8fafc;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.wpacl-tool:hover {
  transform: translateY(-1px);
  background: #eef2ff;
}

.wpacl-tool input[type='file'] {
  display: none;
}

.wpacl-drafts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wpacl-draft {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
}

.wpacl-draft img {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
}

.wpacl-draft-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.wpacl-draft-location {
  padding: 12px 16px;
  font-size: 13px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.35);
}

.wpacl-form textarea {
  width: 100%;
  resize: none;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  min-height: 48px;
  font-size: 14px;
  line-height: 1.45;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.wpacl-form textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.wpacl-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wpacl-status {
  font-size: 12px;
  color: rgba(30, 41, 59, 0.72);
}

.wpacl-form-footer {
  justify-content: flex-start;
}

.wpacl-status.is-error {
  color: #dc2626;
}

.wpacl-status.is-warn {
  color: #ca8a04;
}

.wpacl-status.is-success {
  color: #047857;
}

.wpacl-send {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  white-space: nowrap;
}

.wpacl-send:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

.wpacl-send:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.35);
}

.wpacl-dot {
  width: 8px;
  height: 8px;
  margin-right: 4px;
  display: inline-block;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.75);
  animation: wpacl-bounce 1s infinite ease-in-out;
}

.wpacl-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.wpacl-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes wpacl-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .wpacl-root-floating {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .wpacl-widget {
    width: 100%;
    height: min(88vh, 600px);
    max-height: none;
  }

  .wpacl-launcher {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
  }

  .wpacl-launcher-label {
    display: none;
  }

  .wpacl-msg {
    max-width: 92%;
    font-size: 13.5px;
  }

  .wpacl-form {
    padding: 12px;
  }

  .wpacl-header {
    padding: 14px 16px;
  }
}
