/* Alanson Media AI Chat v3.0 */
:root {
  --am-gold:   #FFD700;
  --am-navy:   #1B3A6B;
  --am-dark:   #080C18;
  --am-dark2:  #0C1120;
  --am-dark3:  #060910;
  --am-muted:  #C2D0E8;
  --am-faint:  #8A9BB5;
  --am-border: #2D3F5A;
}

/* ── Bubble ── */
.am-chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--am-gold);
  color: var(--am-dark);
  border: none;
  border-radius: 50px;
  padding: 13px 20px 13px 15px;
  font-family: Barlow, sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 28px rgba(255,215,0,0.4);
  transition: transform .2s ease, box-shadow .2s ease;
}
.am-chat-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 36px rgba(255,215,0,0.5);
}
.am-bubble-open { display: flex; align-items: center; gap: 8px; }
.am-bubble-close { display: none; font-size: 16px; line-height: 1; }
.am-chat-widget.am-open .am-bubble-open { display: none; }
.am-chat-widget.am-open .am-bubble-close { display: block; }

/* ── Panel ── */
.am-chat-panel {
  position: fixed;
  bottom: 94px;
  right: 28px;
  z-index: 99989;
  width: 390px;
  max-width: calc(100vw - 36px);
  background: var(--am-dark2);
  border: 1px solid var(--am-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s cubic-bezier(.34,1.56,.64,1);
}
.am-chat-panel[hidden] { display: flex !important; }
.am-chat-panel.am-panel-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ── */
.am-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--am-dark3);
  border-bottom: 1px solid var(--am-border);
  flex-shrink: 0;
}
.am-chat-header-left { display: flex; align-items: center; gap: 10px; }
.am-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--am-gold);
  color: var(--am-dark);
  font-family: Inter, sans-serif;
  font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.am-chat-name { font-family: Inter, sans-serif; font-weight: 700; font-size: 13px; color: #fff; }
.am-chat-status { font-family: Barlow, sans-serif; font-size: 12px; color: var(--am-faint); display: flex; align-items: center; gap: 5px; }
.am-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
}
.am-close-btn {
  background: transparent; border: none;
  color: var(--am-faint); font-size: 15px;
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
  transition: color .15s, background .15s;
}
.am-close-btn:hover { color: #fff; background: rgba(255,255,255,0.07); }

/* ── Log ── */
.am-chat-log {
  flex: 1;
  height: 300px;
  min-height: 200px;
  max-height: 300px;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--am-border) transparent;
  scroll-behavior: smooth;
}
.am-chat-log::-webkit-scrollbar { width: 3px; }
.am-chat-log::-webkit-scrollbar-thumb { background: var(--am-border); border-radius: 3px; }

/* ── Messages ── */
.am-msg {
  font-family: Barlow, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 88%;
  word-break: break-word;
  animation: amIn .2s ease;
}
@keyframes amIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.am-bot {
  background: #0F1E35;
  color: var(--am-muted);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}
.am-user {
  background: var(--am-navy);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}

/* ── Typing indicator ── */
.am-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  flex-shrink: 0;
}
.am-typing-indicator span {
  width: 7px; height: 7px;
  background: var(--am-faint);
  border-radius: 50%;
  animation: amBounce 1.2s infinite ease-in-out;
}
.am-typing-indicator span:nth-child(2) { animation-delay: .15s; }
.am-typing-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes amBounce {
  0%,80%,100% { transform: scale(0.6); opacity:.4; }
  40% { transform: scale(1); opacity:1; }
}

/* ── Input ── */
.am-input-row {
  display: flex;
  border-top: 1px solid var(--am-border);
  background: var(--am-dark3);
  flex-shrink: 0;
}
.am-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  padding: 14px 16px;
  font-family: Barlow, sans-serif;
  font-size: 14px;
  outline: none;
}
.am-input-row input::placeholder { color: var(--am-faint); }
.am-input-row button {
  background: transparent;
  border: none;
  color: var(--am-gold);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.am-input-row button:hover { background: rgba(255,215,0,0.08); }

/* ── Clickable card styles ── */
[data-am-chat] {
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  position: relative;
}
[data-am-chat]:not(button):not(a):hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
}
/* Subtle "chat" badge on hover */
[data-am-chat]:not(button):not(a)::after {
  content: 'Ask about this ›';
  position: absolute;
  bottom: 14px;
  right: 16px;
  font-family: Barlow, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--am-gold);
  opacity: 0;
  transform: translateY(3px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
[data-am-chat]:not(button):not(a):hover::after {
  opacity: 1;
  transform: translateY(0);
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .am-chat-bubble { right: 12px; bottom: 16px; }
  .am-chat-panel  { right: 8px; bottom: 78px; width: calc(100vw - 16px); }
}
