/* ============================================================
   SOLARMAR - Floating WhatsApp button + Chatbot widget
   Sharp edges, industrial navy/amber palette
   ============================================================ */

/* ---------- Floating WhatsApp button ---------- */
.wa-fab {
  position: fixed;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 9200;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  box-shadow: 0 10px 24px rgba(18, 140, 126, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.wa-fab svg {
  width: 30px;
  height: 30px;
}

.wa-fab:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 16px 32px rgba(18, 140, 126, 0.55);
}

.wa-fab__ring {
  position: absolute;
  inset: 0;
  border: 2px solid #25d366;
  animation: waPulse 2.2s ease-out infinite;
  pointer-events: none;
}

@keyframes waPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.55); opacity: 0; }
}

.wa-fab__status {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--amber-300, #ffd166);
  color: var(--navy-900, #0d1b2a);
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  font-size: 0.68rem;
  text-indent: 0;
}

/* ---------- Chat widget ---------- */
.chat {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 9500;
}

.chat__toggle {
  position: relative;
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--amber-300, #ffd166);
  background: linear-gradient(135deg, var(--navy-900, #0d1b2a), #16283f);
  color: var(--amber-300, #ffd166);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s ease;
}

.chat__toggle:hover {
  transform: translateY(-3px);
}

.chat__toggle svg {
  width: 28px;
  height: 28px;
}

.chat__toggle-close { display: none; }

.chat.is-open .chat__toggle-icon { display: none; }
.chat.is-open .chat__toggle-close { display: block; }

.chat__notif {
  position: absolute;
  top: -4px;
  right: -6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e63946;
  color: #fff;
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  animation: waPulse 2s ease-out infinite;
}

.chat.is-open .chat__notif { display: none; }

/* Panel */
.chat__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 1rem);
  width: min(382px, calc(100vw - 2.5rem));
  display: flex;
  flex-direction: column;
  background: var(--navy-900, #0d1b2a);
  border: 1px solid rgba(255, 209, 102, 0.35);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.chat.is-open .chat__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.chat__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  background:
    linear-gradient(135deg, rgba(244, 162, 97, 0.14), rgba(13, 27, 42, 0) 60%),
    var(--navy-900);
  border-bottom: 2px solid var(--amber-300, #ffd166);
}

.chat__head-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--amber-300, #ffd166);
  color: var(--navy-900, #0d1b2a);
}

.chat__head-avatar svg {
  width: 22px;
  height: 22px;
}

.chat__head-text {
  flex: 1;
  min-width: 0;
}

.chat__head-text strong {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-light, #fff);
}

.chat__head-text span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.65);
}

.chat__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.15rem;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease;
}

.chat__close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--amber-300, #ffd166);
}

/* Messages */
.chat__body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem;
  min-height: 220px;
  max-height: 340px;
  height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat__msg {
  max-width: 86%;
  padding: 0.62rem 0.85rem;
  font-size: 0.87rem;
  line-height: 1.55;
  word-break: break-word;
  animation: msgIn 0.28s ease both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat__msg--bot {
  align-self: flex-start;
  background: #16283f;
  color: rgba(255, 255, 255, 0.92);
  border-left: 3px solid var(--amber-300, #ffd166);
}

.chat__msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--amber-400, #f4a261), var(--amber-300, #ffd166));
  color: var(--navy-900, #0d1b2a);
  font-weight: 600;
}

.chat__msg a {
  color: var(--amber-300, #ffd166);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chat__msg--user a {
  color: var(--navy-900, #0d1b2a);
}

.chat__typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.7rem 0.95rem;
  background: #16283f;
  border-left: 3px solid var(--amber-300, #ffd166);
}

.chat__typing i {
  width: 6px;
  height: 6px;
  background: var(--amber-300, #ffd166);
  animation: typingDot 1.1s ease-in-out infinite;
}

.chat__typing i:nth-child(2) { animation-delay: 0.15s; }
.chat__typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Suggestion chips */
.chat__suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.15rem 1rem 0.85rem;
}

.chat__suggest button {
  padding: 0.42rem 0.8rem;
  border: 1px solid rgba(255, 209, 102, 0.45);
  background: rgba(255, 209, 102, 0.08);
  color: var(--amber-300, #ffd166);
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease;
}

.chat__suggest button:hover {
  background: var(--amber-300, #ffd166);
  color: var(--navy-900, #0d1b2a);
}

/* Input */
.chat__input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat__input input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-light, #fff);
  font-size: 0.87rem;
}

.chat__input input::placeholder { color: rgba(255, 255, 255, 0.4); }

.chat__input button {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--amber-300, #ffd166);
  color: var(--navy-900, #0d1b2a);
  transition: background 0.2s ease;
}

.chat__input button:hover { background: var(--amber-400, #f4a261); }

.chat__input button svg {
  width: 20px;
  height: 20px;
}

/* Scrollbar */
.chat__body::-webkit-scrollbar { width: 6px; }
.chat__body::-webkit-scrollbar-thumb { background: rgba(255, 209, 102, 0.4); }

/* Responsive */
@media (max-width: 560px) {
  .chat__panel {
    position: fixed;
    right: 0.75rem;
    left: 0.75rem;
    bottom: 5.5rem;
    width: auto;
    height: min(70vh, 520px);
  }

  .chat__body { height: auto; flex: 1; max-height: none; }

  .wa-fab {
    left: 0.9rem;
    bottom: auto;
    top: calc(100vh - 5.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-fab__ring,
  .chat__notif,
  .chat__typing i,
  .chat__msg,
  .chat__panel,
  .chat__toggle {
    animation: none;
    transition: none;
  }
}