/* ─── CHAT WIDGET ────────────────────────────────────────── */
.chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* ─── Chat panel ─────────────────────────────────────────── */
.chat-panel {
  width: 360px;
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 20px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  animation: panelIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}

@keyframes panelIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-panel.open {
  display: flex;
}

.chat-header {
  background: linear-gradient(135deg, var(--brand) 0%, #1d4ed8 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--white);
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}

.chat-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}

.chat-status {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 10px #4ade80;
}

.chat-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--white);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-close:hover {
  background: rgba(255,255,255,0.2);
}

/* ─── Messages ───────────────────────────────────────────── */
.chat-messages {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 250px;
  max-height: 350px;
  overflow-y: auto;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.msg {
  max-width: 85%;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  animation: msgIn 0.3s ease-out both;
}

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

.msg.bot {
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.05);
  padding: 12px 16px;
  border-radius: 4px 16px 16px 16px;
  color: var(--ink);
  align-self: flex-start;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.msg.user {
  background: var(--brand);
  padding: 12px 16px;
  border-radius: 16px 4px 16px 16px;
  color: var(--white);
  align-self: flex-end;
  box-shadow: 0 4px 12px rgba(37,99,235,0.15);
}

/* ─── Quick options ──────────────────────────────────────── */
.chat-options {
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.chat-opt {
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  color: var(--ink-soft);
  transition: all 0.2s ease;
  cursor: pointer;
  animation: optIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes optIn {
  from { opacity: 0; transform: scale(0.9) translateY(5px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-opt:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(37,99,235,0.2);
}

.chat-opt:active {
  transform: translateY(0);
}

/* ─── Input ──────────────────────────────────────────────── */
.chat-input-row {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--white);
}

.chat-input {
  flex: 1;
  border: none;
  padding: 12px 14px;
  font-size: 13px;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.chat-input::placeholder {
  color: var(--ink-faint);
}

.chat-send {
  width: 38px;
  background: none;
  border: none;
  color: var(--brand);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px 0 0;
  transition: color var(--transition);
}

.chat-send:hover {
  color: var(--ink);
}

/* ─── Floating buttons ───────────────────────────────────── */
.float-btn-wrap {
  position: relative;
}

.float-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}

.float-btn:hover {
  transform: scale(1.1);
}

.float-btn.wa {
  background: #25D366;
  box-shadow: 0 4px 18px rgba(37,211,102,0.28);
  color: white;
}

.float-btn.chat-trigger {
  background: var(--brand);
  box-shadow: 0 4px 18px rgba(37,99,235,0.24);
  color: var(--white);
}

.float-label {
  position: absolute;
  right: 62px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--white);
  font-size: 11px;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.float-btn-wrap:hover .float-label {
  opacity: 1;
}

/* ─── Typing indicator ───────────────────────────────────── */
.msg.typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  min-height: unset;
}

.msg.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: typingBounce 1.2s infinite;
}

.msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ─── Notification dot on trigger ───────────────────────── */
.chat-trigger-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #f43f5e;
  border-radius: 50%;
  border: 2px solid var(--white);
  animation: dotPop 0.3s ease;
}

@keyframes dotPop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ─── Link buttons inside messages ────────────────────────── */
.msg.bot a.chat-opt {
  display: inline-block;
  margin-top: 8px;
  background: var(--brand);
  color: var(--white) !important;
  padding: 8px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
}

.msg.bot a.chat-opt:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.2);
  color: var(--white);
}
