/**
 * Profissionais da Fronteira - Chat & Push Plugin Stylesheet
 * Alinhado com a paleta Fronteira Esmeralda Noturna
 */

.pf-contact-dual-inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.pf-contact-stack-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.pf-chat-launch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--pf-font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: 14.5px;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  line-height: 1.2;
}

.pf-chat-launch-btn.pf-w-full {
  width: 100%;
}

.pf-chat-btn-primary {
  background: var(--pf-accent, #00E59B);
  color: var(--pf-accent-ink, #04261B) !important;
  border: 1px solid transparent;
  box-shadow: 0 6px 20px rgba(0, 229, 155, 0.22);
}

.pf-chat-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0, 229, 155, 0.34);
}

.pf-chat-btn-secondary {
  background: rgba(19, 37, 46, 0.92);
  color: var(--pf-accent, #00E59B) !important;
  border: 1px solid rgba(0, 229, 155, 0.45);
}

.pf-chat-btn-secondary:hover {
  background: rgba(0, 229, 155, 0.12);
  border-color: var(--pf-accent, #00E59B);
  transform: translateY(-1px);
}

/* Header & Drawer Chat Triggers */
.pf-header-chat-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(25, 49, 61, 0.72);
  border: 1px solid rgba(0, 229, 155, 0.28);
  color: var(--pf-ink, #F4F8FA);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.pf-header-chat-btn:hover {
  background: rgba(0, 229, 155, 0.14);
  border-color: var(--pf-accent, #00E59B);
  color: var(--pf-accent, #00E59B);
}

.pf-icon-chat {
  color: var(--pf-accent, #00E59B);
}

/* Profile Chat + Push Bar */
.pf-profile-chat-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 14px 0 4px;
}

.pf-profile-chat-open-btn,
.pf-profile-push-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  font-family: var(--pf-font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pf-profile-chat-open-btn {
  background: rgba(0, 229, 155, 0.13);
  border: 1px solid rgba(0, 229, 155, 0.42);
  color: var(--pf-accent, #00E59B);
}

.pf-profile-chat-open-btn:hover {
  background: rgba(0, 229, 155, 0.22);
}

.pf-profile-push-btn {
  background: rgba(25, 49, 61, 0.85);
  border: 1px solid var(--pf-border, #224352);
  color: var(--pf-ink, #F4F8FA);
}

.pf-profile-push-btn:hover {
  border-color: var(--pf-accent, #00E59B);
  color: var(--pf-accent, #00E59B);
}

.pf-profile-push-btn[data-push-state="granted"] {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

/* Modal Centralizado de Chat */
.pf-chat-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(5, 12, 16, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  padding: 16px !important;
  z-index: 999999 !important;
}

.pf-chat-modal-backdrop[hidden] {
  display: none !important;
}

.pf-chat-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 580px;
  height: min(680px, 88dvh);
  max-height: 88dvh;
  background: var(--pf-surface, #13252E);
  color: var(--pf-ink, #F4F8FA);
  border: 1px solid var(--pf-accent, #00E59B);
  border-radius: 22px;
  padding: 0 !important;
  overflow: hidden !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}

.pf-chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  margin: 0 !important;
  background: rgba(11, 22, 28, 0.72);
  border-bottom: 1px solid rgba(34, 67, 82, 0.85);
  flex-shrink: 0;
}

.pf-chat-modal-header .pf-modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pf-chat-header-texts {
  min-width: 0;
}

.pf-chat-header-texts h2 {
  margin: 0;
  font-family: var(--pf-font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: 16px;
  font-weight: 800;
  color: var(--pf-ink, #F4F8FA);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-chat-header-texts .pf-modal-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--pf-muted, #8BA4B0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-chat-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(25, 49, 61, 0.9);
  border: 1px solid var(--pf-border, #224352);
  color: var(--pf-ink, #F4F8FA);
  cursor: pointer;
  flex-shrink: 0;
}

.pf-chat-back-btn:hover {
  border-color: var(--pf-accent, #00E59B);
  color: var(--pf-accent, #00E59B);
}

.pf-chat-back-btn[hidden] {
  display: none !important;
}

/* Push Notification Banner inside Modal */
.pf-chat-push-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(90deg, rgba(0, 229, 155, 0.14), rgba(20, 184, 166, 0.08));
  border-bottom: 1px solid rgba(0, 229, 155, 0.25);
  flex-shrink: 0;
}

.pf-chat-push-banner[hidden] {
  display: none !important;
}

.pf-chat-push-banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(0, 229, 155, 0.18);
  color: var(--pf-accent, #00E59B);
  flex-shrink: 0;
}

.pf-chat-push-banner-text {
  flex: 1;
  min-width: 0;
}

.pf-chat-push-banner-text strong {
  display: block;
  font-size: 12.5px;
  color: var(--pf-ink, #F4F8FA);
}

.pf-chat-push-banner-text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--pf-muted, #8BA4B0);
  line-height: 1.35;
}

.pf-chat-push-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pf-chat-push-close {
  background: transparent;
  border: none;
  color: var(--pf-muted, #8BA4B0);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 15px;
}

/* Inbox View */
.pf-chat-view-inbox {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}

.pf-chat-view-inbox[hidden],
.pf-chat-view-thread[hidden] {
  display: none !important;
}

.pf-chat-conversations-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pf-chat-conv-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: rgba(11, 22, 28, 0.65);
  border: 1px solid rgba(34, 67, 82, 0.85);
  border-radius: 16px;
  color: var(--pf-ink, #F4F8FA);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.15s ease;
}

.pf-chat-conv-card:hover {
  border-color: var(--pf-accent, #00E59B);
  background: rgba(25, 49, 61, 0.72);
  transform: translateY(-1px);
}

.pf-chat-conv-card.has-unread {
  border-color: rgba(0, 229, 155, 0.55);
  background: rgba(0, 229, 155, 0.06);
}

.pf-chat-conv-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(0, 229, 155, 0.35);
  flex-shrink: 0;
}

.pf-chat-conv-body {
  flex: 1;
  min-width: 0;
}

.pf-chat-conv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pf-chat-conv-partner {
  font-size: 14px;
  font-weight: 700;
  color: var(--pf-ink, #F4F8FA);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-chat-conv-date {
  font-size: 11px;
  color: var(--pf-muted, #8BA4B0);
  flex-shrink: 0;
}

.pf-chat-conv-service {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--pf-accent, #00E59B);
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pf-chat-conv-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pf-chat-conv-preview {
  margin: 0;
  font-size: 12.5px;
  color: var(--pf-muted, #8BA4B0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-chat-conv-badge {
  background: var(--pf-accent, #00E59B);
  color: var(--pf-accent-ink, #04261B);
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pf-chat-empty-box {
  text-align: center;
  padding: 40px 20px;
  color: var(--pf-muted, #8BA4B0);
}

.pf-chat-empty-box i {
  font-size: 36px;
  color: rgba(0, 229, 155, 0.5);
  margin-bottom: 12px;
  display: block;
}

.pf-chat-empty-box strong {
  display: block;
  color: var(--pf-ink, #F4F8FA);
  font-size: 15px;
  margin-bottom: 6px;
}

/* Thread View */
.pf-chat-view-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pf-chat-thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: radial-gradient(circle at 80% 10%, rgba(0, 229, 155, 0.05), transparent 50%), rgba(11, 22, 28, 0.55);
}

.pf-chat-welcome-card {
  margin: auto 0;
  padding: 20px;
  border-radius: 16px;
  background: rgba(19, 37, 46, 0.9);
  border: 1px dashed rgba(0, 229, 155, 0.35);
  text-align: center;
}

.pf-chat-welcome-card i {
  font-size: 28px;
  color: var(--pf-accent, #00E59B);
  margin-bottom: 8px;
}

.pf-chat-welcome-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--pf-ink, #F4F8FA);
}

.pf-chat-welcome-card p {
  margin: 0;
  font-size: 13px;
  color: var(--pf-muted, #8BA4B0);
}

.pf-chat-bubble-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.pf-chat-bubble-row.is-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.pf-chat-bubble-row.is-theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.pf-chat-bubble-sender {
  font-size: 11px;
  font-weight: 700;
  color: var(--pf-muted, #8BA4B0);
  margin: 0 6px 3px;
}

.pf-chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.pf-chat-bubble-row.is-mine .pf-chat-bubble {
  background: var(--pf-accent, #00E59B);
  color: var(--pf-accent-ink, #04261B);
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.pf-chat-bubble-row.is-theirs .pf-chat-bubble {
  background: var(--pf-surface-elevated, #19313D);
  color: var(--pf-ink, #F4F8FA);
  border: 1px solid rgba(34, 67, 82, 0.9);
  border-bottom-left-radius: 4px;
}

.pf-chat-bubble-time {
  font-size: 10px;
  color: var(--pf-muted, #8BA4B0);
  margin: 3px 6px 0;
}

/* Auth Gate */
.pf-chat-auth-gate {
  padding: 20px;
  text-align: center;
  background: rgba(11, 22, 28, 0.85);
  border-top: 1px solid var(--pf-border, #224352);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pf-chat-auth-gate[hidden] {
  display: none !important;
}

.pf-chat-auth-gate i {
  font-size: 24px;
  color: var(--pf-accent, #00E59B);
}

.pf-chat-auth-gate p {
  margin: 0;
  font-size: 13px;
  color: var(--pf-muted, #8BA4B0);
}

/* Compose Form */
.pf-chat-compose-form {
  padding: 12px 16px 14px;
  background: rgba(11, 22, 28, 0.88);
  border-top: 1px solid rgba(34, 67, 82, 0.9);
  flex-shrink: 0;
}

.pf-chat-compose-form[hidden] {
  display: none !important;
}

.pf-chat-guest-name-wrap {
  margin-bottom: 10px;
}

.pf-chat-guest-name-wrap[hidden] {
  display: none !important;
}

.pf-chat-guest-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--pf-accent, #00E59B);
  margin-bottom: 5px;
}

.pf-chat-guest-input {
  width: 100%;
  padding: 9px 14px !important;
  font-size: 13.5px !important;
}

.pf-chat-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.pf-chat-message-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 16px;
  border-radius: 22px;
  background: var(--pf-surface, #13252E);
  border: 1px solid var(--pf-border, #224352);
  color: var(--pf-ink, #F4F8FA);
  font-family: var(--pf-font-body, 'DM Sans', sans-serif);
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  outline: none;
}

.pf-chat-message-input:focus {
  border-color: var(--pf-accent, #00E59B);
  box-shadow: 0 0 0 2px rgba(0, 229, 155, 0.16);
}

.pf-chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--pf-accent, #00E59B);
  color: var(--pf-accent-ink, #04261B);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.pf-chat-send-btn:hover {
  transform: scale(1.04);
}

.pf-chat-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pf-chat-send-error {
  margin-top: 6px;
  font-size: 12px;
  color: #fca5a5;
}

.pf-fav-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 229, 155, 0.14);
  border: 1px solid rgba(0, 229, 155, 0.35);
  color: var(--pf-accent, #00E59B);
  cursor: pointer;
  font-size: 14px;
}

.pf-fav-chat-btn:hover {
  background: var(--pf-accent, #00E59B);
  color: var(--pf-accent-ink, #04261B);
}

@media (max-width: 600px) {
  .pf-chat-modal-backdrop {
    padding: 8px !important;
  }
  .pf-chat-dialog {
    height: 90dvh;
    max-height: 90dvh;
    border-radius: 18px;
  }
  .pf-chat-push-banner {
    flex-wrap: wrap;
  }
  .pf-contact-dual-inline {
    width: 100%;
  }
  .pf-contact-dual-inline > a,
  .pf-contact-dual-inline > button {
    flex: 1 1 auto;
  }
}

/* Scrollbar, Overscroll Containment & Font Consistency */
.pf-chat-dialog {
  font-family: var(--pf-font-body, 'DM Sans', sans-serif);
  overscroll-behavior: contain;
}

.pf-chat-dialog h2,
.pf-chat-dialog h3,
.pf-chat-conv-partner,
.pf-chat-empty-box strong,
.pf-chat-welcome-card strong {
  font-family: var(--pf-font-heading, 'Plus Jakarta Sans', sans-serif);
}

.pf-chat-view-inbox,
.pf-chat-thread-messages {
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 229, 155, 0.5) #0A151B;
}

.pf-chat-view-inbox::-webkit-scrollbar,
.pf-chat-thread-messages::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.pf-chat-view-inbox::-webkit-scrollbar-track,
.pf-chat-thread-messages::-webkit-scrollbar-track {
  background: #0A151B;
  border-radius: 999px;
}

.pf-chat-view-inbox::-webkit-scrollbar-thumb,
.pf-chat-thread-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 155, 0.45);
  border-radius: 999px;
}

.pf-chat-view-inbox::-webkit-scrollbar-thumb:hover,
.pf-chat-thread-messages::-webkit-scrollbar-thumb:hover {
  background: #00E59B;
}

