/* Support Chat widget — GD Náutica (premium náutico) */

/* FAB fallback — garante visual circular + badge mesmo se awm.css estiver cacheado */
#awm-support-chat-fab.awm-fab--chat {
  position: fixed;
  width: 52px;
  height: 52px;
  bottom: 20px;
  right: 16px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #0b3a52 0%, #1a6b8a 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(11, 58, 82, 0.35), 0 0 0 1px rgba(46, 196, 214, 0.15);
  z-index: var(--awm-z-fab, 1000);
  cursor: pointer;
  padding: 0;
}

#awm-support-chat-fab .awm-fab__compass {
  animation: awm-fab-compass-spin 16s linear infinite;
  transform-origin: center;
}

#awm-support-chat-fab:hover .awm-fab__compass {
  animation-duration: 8s;
}

@keyframes awm-fab-compass-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#awm-support-chat-fab.is-notify {
  animation: awm-fab-notify-pulse 1.4s ease-in-out infinite;
}

@keyframes awm-fab-notify-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 20px rgba(11, 58, 82, 0.35), 0 0 0 0 rgba(46, 196, 214, 0.35);
  }
  50% {
    transform: scale(1.07);
    box-shadow: 0 6px 28px rgba(11, 58, 82, 0.5), 0 0 0 6px rgba(46, 196, 214, 0.12);
  }
}

#awm-support-chat-fab .awm-fab__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

#awm-support-chat-fab.is-notify .awm-fab__badge {
  animation: awm-fab-badge-pop 0.35s ease-out;
  box-shadow: 0 2px 8px rgba(229, 57, 53, 0.45);
  min-width: 20px;
  height: 20px;
  line-height: 20px;
}

@keyframes awm-fab-badge-pop {
  from { transform: scale(0.6); opacity: 0.5; }
  to { transform: scale(1); opacity: 1; }
}

@media (min-width: 960px) {
  #awm-support-chat-fab.awm-fab--chat {
    right: max(20px, calc(50% - 460px - 72px));
  }
}

body.is-quiz-mode #awm-support-chat-fab,
body.is-quiz-mode .whatsapp-button {
  display: none !important;
}

.awm-sc-panel {
  position: fixed;
  z-index: calc(var(--awm-z-fab, 1000) + 1);
  bottom: 84px;
  right: 16px;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--awm-surface, #0f2430);
  color: var(--awm-text, #f2f6f8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(11, 58, 82, 0.35), 0 0 0 1px rgba(46, 196, 214, 0.08);
  overflow: hidden;
  font-family: inherit;
}

[data-theme="light"] .awm-sc-panel,
html[data-theme="light"] .awm-sc-panel {
  background: #fff;
  color: #123a56;
  border-color: rgba(11, 58, 82, 0.1);
  box-shadow: 0 16px 48px rgba(11, 58, 82, 0.15);
}

.awm-sc-panel[hidden] {
  display: none !important;
}

.awm-sc-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #0b3a52 0%, #1a6b8a 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.awm-sc-panel__head::after {
  content: "";
  position: absolute;
  inset: auto -20% -60% -20%;
  height: 80px;
  background: radial-gradient(ellipse at center, rgba(46, 196, 214, 0.25), transparent 70%);
  pointer-events: none;
}

.awm-sc-panel__head > div {
  position: relative;
  z-index: 1;
}

.awm-sc-panel__head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--awm-font-display, Outfit, sans-serif);
  color: #fff;
  letter-spacing: -0.02em;
}

.awm-sc-panel__head p {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  opacity: 0.92;
  color: rgba(255, 255, 255, 0.92);
}

.awm-sc-panel__close {
  position: relative;
  z-index: 1;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.45rem;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.awm-sc-panel__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.awm-sc-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

html[data-theme="light"] .awm-sc-status {
  color: #3d5a6c;
  background: #f5f8fa;
  border-bottom-color: rgba(11, 58, 82, 0.08);
}

.awm-sc-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
  flex-shrink: 0;
}

.awm-sc-status__dot.is-on {
  background: #2e7d32;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.25);
}

.awm-sc-msgs {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(11, 58, 82, 0.04) 0%, transparent 120px);
}

html[data-theme="light"] .awm-sc-msgs {
  background: linear-gradient(180deg, rgba(46, 196, 214, 0.06) 0%, transparent 120px);
}

.awm-sc-bubble {
  max-width: 88%;
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.awm-sc-bubble--customer {
  align-self: flex-end;
  background: linear-gradient(135deg, #0b3a52, #1a6b8a);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 2px 8px rgba(11, 58, 82, 0.2);
}

.awm-sc-bubble--automation,
.awm-sc-bubble--system,
.awm-sc-bubble--agent,
.awm-sc-bubble--external {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.1);
  color: #e6edf2;
  border-radius: 14px 14px 14px 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

html[data-theme="light"] .awm-sc-bubble--automation,
html[data-theme="light"] .awm-sc-bubble--system,
html[data-theme="light"] .awm-sc-bubble--agent,
html[data-theme="light"] .awm-sc-bubble--external {
  background: #eef3f6;
  color: #123a56;
  border-color: rgba(11, 58, 82, 0.08);
}

.awm-sc-bubble--typing {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  color: #b0bec5;
  border-radius: 14px 14px 14px 4px;
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-style: italic;
}

html[data-theme="light"] .awm-sc-bubble--typing {
  background: #eef3f6;
  color: #3d5a6c;
}

.awm-sc-typing-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.awm-sc-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  animation: awm-typing-bounce 1.2s infinite ease-in-out;
}

.awm-sc-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.awm-sc-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes awm-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.awm-sc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.85rem 0.5rem;
  flex-shrink: 0;
}

.awm-sc-actions button {
  border: 1px solid rgba(46, 196, 214, 0.35);
  background: rgba(46, 196, 214, 0.1);
  color: inherit;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

html[data-theme="light"] .awm-sc-actions button {
  color: #0b3a52;
  background: rgba(11, 58, 82, 0.06);
  border-color: rgba(11, 58, 82, 0.15);
}

.awm-sc-actions button:hover {
  background: rgba(46, 196, 214, 0.2);
}

.awm-sc-contact {
  padding: 0.5rem 0.85rem;
  display: grid;
  gap: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.awm-sc-contact[hidden] {
  display: none !important;
}

.awm-sc-contact input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
}

html[data-theme="light"] .awm-sc-contact input {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #123;
}

.awm-sc-compose {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.awm-sc-blocked {
  flex: 1 1 100%;
  margin: 0;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: rgba(230, 162, 60, 0.18);
  color: #f4d9a6;
  font-size: 0.85rem;
  line-height: 1.4;
}

html[data-theme="light"] .awm-sc-blocked {
  background: #fff4e5;
  color: #6a3e00;
}

.awm-sc-compose.is-blocked textarea,
.awm-sc-compose.is-blocked button {
  opacity: 0.55;
  pointer-events: none;
}

html[data-theme="light"] .awm-sc-compose {
  background: #f5f8fa;
  border-top-color: rgba(11, 58, 82, 0.08);
}

.awm-sc-compose textarea {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font: inherit;
}

html[data-theme="light"] .awm-sc-compose textarea {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #123;
}

.awm-sc-compose button {
  border: 0;
  border-radius: 10px;
  padding: 0 0.9rem;
  background: linear-gradient(135deg, #0b3a52, #1a6b8a);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
}

.awm-sc-compose button:hover {
  transform: scale(1.02);
}

.awm-sc-waiting {
  padding: 0.35rem 0.85rem 0.65rem;
  font-size: 0.8rem;
  opacity: 0.85;
  flex-shrink: 0;
}

html[data-theme="light"] .awm-sc-waiting {
  color: #3d5a6c;
}

@media (max-width: 640px) {
  .awm-sc-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .awm-sc-compose {
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
  }

  .awm-sc-compose textarea {
    flex: 1 1 auto;
    min-width: 0;
  }

  .awm-sc-compose button {
    flex-shrink: 0;
  }
}

@media (min-width: 960px) {
  .awm-sc-panel {
    right: max(20px, calc(50% - 460px - 72px));
  }
}

body.is-quiz-mode .awm-sc-panel {
  display: none !important;
}
