/* LSRR Live Chat (embedded inside the consultation popup) */
.consult-switch{
  margin: 14px 0 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.consult-switch-btn{
  border: 1px solid rgba(59,45,32,.14);
  border-radius: 14px;
  background: #fff;
  padding: 12px 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #171411;
}
.consult-switch-btn.is-active{
  background: linear-gradient(135deg, #111827, #1f2937);
  color: #fff;
  border-color: transparent;
}
.consult-chat{
  margin-top: 6px;
}

.lsrr-chat-shell{
  border: 1px solid rgba(59,45,32,.14);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(60vh, 520px);
}
.lsrr-chat-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.lsrr-chat-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.lsrr-chat-form input,
.lsrr-chat-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
}
.lsrr-chat-form textarea { grid-column: 1 / -1; resize: vertical; min-height: 80px; }
.lsrr-chat-form .full { grid-column: 1 / -1; }
.lsrr-chat-form button {
  grid-column: 1 / -1;
  border: none;
  background: #111827;
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 900;
  cursor: pointer;
}
.lsrr-chat-form button:disabled { opacity: .65; cursor: not-allowed; }
.lsrr-chat-status { font-size: 13px; color: #6b7280; }

/* Embedded layout doesn't need its own header/close button */
.lsrr-chat-header,
.lsrr-chat-close { display:none !important; }

.lsrr-chat-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.lsrr-chat-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.lsrr-chat-form input,
.lsrr-chat-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
}
.lsrr-chat-form textarea { grid-column: 1 / -1; resize: vertical; min-height: 80px; }
.lsrr-chat-form .full { grid-column: 1 / -1; }
.lsrr-chat-form button {
  grid-column: 1 / -1;
  border: none;
  background: #4f46e5;
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
}
.lsrr-chat-form button:disabled { opacity: .65; cursor: not-allowed; }
.lsrr-chat-status { font-size: 13px; color: #6b7280; }

.lsrr-chat-messages {
  flex: 1;
  overflow: auto;
  display: none;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.lsrr-chat-reply-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  background: #f0fdf4;
  color: #14532d;
  font-size: 12px;
  font-weight: 800;
}
.lsrr-chat-reply-timer[hidden] {
  display: none !important;
}
.lsrr-chat-reply-countdown {
  min-width: 48px;
  text-align: center;
  padding: 5px 7px;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.lsrr-chat-messages.is-active { display: flex; }
.lsrr-chat-bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
}
.lsrr-chat-bubble.visitor { background: #111827; color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.lsrr-chat-bubble.admin { background: #eef2ff; color: #111827; align-self: flex-start; border-bottom-left-radius: 6px; }
.lsrr-chat-busy {
  display: grid;
  gap: 12px;
}
.lsrr-chat-whatsapp-icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(34, 197, 94, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.lsrr-chat-whatsapp-icon:hover,
.lsrr-chat-whatsapp-icon:focus-visible {
  background: #16a34a;
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(34, 197, 94, 0.34);
}
.lsrr-chat-whatsapp-icon svg {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}
.lsrr-chat-time { font-size: 10px; color: #6b7280; margin-top: 4px; }

.lsrr-chat-input {
  display: none;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-top: 1px solid #e5e7eb;
  padding: 10px 12px;
  background: #fff;
}
.lsrr-chat-input.is-active { display: grid; }
.lsrr-chat-input input {
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
.lsrr-chat-input button {
  border: none;
  background: #22c55e;
  color: #0b1220;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
}
.lsrr-chat-input button:disabled { opacity: .65; cursor: not-allowed; }

.lsrr-chat-actions {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(59,45,32,.14);
  background: #fff;
}
.lsrr-chat-action {
  flex: 1;
  min-height: 46px;
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
}
.lsrr-chat-action.clear { background: #fee2e2; color: #991b1b; }
.lsrr-chat-action.whatsapp { background: #dcfce7; color: #166534; }

.lsrr-permission-popup {
  position: fixed;
  inset: 0;
  z-index: 1000002;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.lsrr-permission-popup.is-open {
  display: flex;
}

.lsrr-permission-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
}

.lsrr-permission-card {
  position: relative;
  z-index: 1;
  width: min(460px, calc(100vw - 28px));
  border-radius: 18px;
  background: #fff;
  color: #111827;
  box-shadow: 0 28px 80px rgba(0,0,0,.32);
  padding: 22px;
}

.lsrr-permission-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: #f3f4f6;
  color: #374151;
  font-size: 24px;
  cursor: pointer;
}

.lsrr-permission-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #111827;
  color: #fff;
  font-weight: 900;
  margin-bottom: 12px;
}

.lsrr-permission-card h3 {
  margin: 0 36px 8px 0;
  color: #111827;
  font-family: inherit;
  font-size: 1.25rem;
  line-height: 1.25;
}

.lsrr-permission-card p {
  margin: 0 0 12px;
  color: #4b5563;
  line-height: 1.55;
}

.lsrr-permission-card ul {
  margin: 0 0 16px;
  padding-left: 18px;
  color: #374151;
  line-height: 1.55;
  font-size: 0.92rem;
}

.lsrr-permission-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lsrr-permission-actions button {
  border: none;
  border-radius: 12px;
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.lsrr-permission-allow {
  background: #111827;
  color: #fff;
}

.lsrr-permission-consult {
  background: #fef3c7;
  color: #92400e;
}

.lsrr-permission-help {
  margin-top: 12px;
  color: #6b7280;
  font-size: 0.86rem;
  line-height: 1.45;
}

@media (max-width: 700px) {
  .consult-switch {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px 0 8px;
  }

  .consult-switch-btn {
    min-height: 46px;
    padding: 10px;
    border-radius: 13px;
    font-size: 0.92rem;
  }

  .consult-chat {
    margin-top: 4px;
  }

  .lsrr-chat-shell {
    border-radius: 14px;
    max-height: calc(92svh - 220px);
  }

  .lsrr-chat-body {
    padding: 10px;
    gap: 8px;
  }

  .lsrr-chat-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .lsrr-chat-form input,
  .lsrr-chat-form textarea {
    min-height: 44px;
    font-size: 16px;
    border-radius: 11px;
  }

  .lsrr-chat-form textarea {
    min-height: 68px;
  }

  .lsrr-chat-messages {
    min-height: 220px;
    max-height: calc(92svh - 370px);
    gap: 8px;
    padding-right: 0;
  }

  .lsrr-chat-bubble {
    max-width: 92%;
    font-size: 13.5px;
    padding: 9px 11px;
  }

  .lsrr-chat-whatsapp-icon {
    width: 46px;
    min-width: 46px;
    height: 46px;
  }

  .lsrr-chat-input {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 9px 10px;
  }

  .lsrr-chat-input input {
    min-height: 46px;
    font-size: 16px;
  }

  .lsrr-chat-input button {
    min-height: 46px;
  }

  .lsrr-chat-actions {
    grid-template-columns: 1fr;
    display: grid;
    gap: 8px;
    padding: 9px 10px;
  }

  .lsrr-permission-popup {
    align-items: flex-end;
    padding: 12px;
  }

  .lsrr-permission-card {
    width: 100%;
    padding: 18px;
    border-radius: 18px;
  }

  .lsrr-permission-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .lsrr-chat-shell {
    max-height: calc(92svh - 190px);
  }

  .lsrr-chat-messages {
    min-height: 180px;
    max-height: calc(92svh - 340px);
  }
}

