/* Typography (Montserrat) */

:root{
  --apa-bg: rgba(255,255,255,0.72);
  --apa-stroke: rgba(0,0,0,0.08);
  --apa-shadow: 0 18px 45px rgba(0,0,0,0.20);
  --apa-text: rgba(0,0,0,0.86);
  --apa-sub: rgba(0,0,0,0.55);
  --apa-radius: 18px;
  --apa-grad: linear-gradient(122deg, #FFA663 0%, #FFC294 91%);
}

#apa-chat-root{
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--apa-text);
}

/* Harden against theme/Elementor */
#apa-chat-root button,
#apa-chat-root input,
#apa-chat-root a{
  font-family: inherit !important;
  letter-spacing: inherit !important;
}
#apa-chat-root button,
#apa-chat-root .apa-card-btn,
#apa-chat-root .apa-card-link{
  -webkit-appearance:none !important;
  appearance:none !important;
  border:0 !important;
  outline:none !important;
  text-transform:none !important;
  box-shadow:none !important;
}
#apa-chat-root a{ text-decoration:none !important; }

#apa-chat-root .apa-ic{
  display:inline-flex;
  width:16px; height:16px;
  color:currentColor;
  align-items:center; justify-content:center;
}
#apa-chat-root .apa-ic svg{ width:16px; height:16px; }

#apa-chat-root .apa-shell{
  position:fixed;
  right:18px; bottom:18px;
  z-index:99999;
}

/* Primary button gradient */
#apa-chat-root .apa-btn-primary{
  background: var(--apa-grad) !important;
  color: rgba(0,0,0,0.85) !important;
  font-weight: 600 !important;
  border-radius: 999px !important;
  cursor:pointer !important;
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
  box-shadow: none !important;
}
#apa-chat-root .apa-btn-primary:hover{ filter: brightness(0.98) saturate(1.02); transform: translateY(-1px); }
#apa-chat-root .apa-btn-primary:active{ transform: translateY(0) scale(0.99); }

#apa-chat-root .apa-fab{
  padding: 11px 14px !important;
  display:flex !important;
  gap: 10px !important;
  align-items:center !important;
  border: 1px solid rgba(0,0,0,0.10) !important;
  border-radius: 999px !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
#apa-chat-root .apa-fab .apa-ic{ margin-right:0; }
#apa-chat-root .apa-fab-label{ font-size:14px; font-weight:800; letter-spacing:-0.01em; }

#apa-chat-root .apa-panel{
  position:absolute;
  right:0; bottom:60px;
  width:392px;
  max-width: calc(100vw - 36px);
  height:580px;
  max-height: calc(100vh - 120px);
  border:1px solid var(--apa-stroke);
  background: var(--apa-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--apa-radius);
  box-shadow: var(--apa-shadow);
  overflow:hidden;
  transform: translateY(10px);
  opacity:0;
  pointer-events:none;
  transition: opacity .18s ease, transform .18s ease;
  display:flex;
  flex-direction:column;
}
#apa-chat-root .apa-panel.is-open{ opacity:1; transform: translateY(0); pointer-events:auto; }

#apa-chat-root .apa-panel-header{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 14px;
  border-bottom:1px solid rgba(0,0,0,0.06);
  flex: 0 0 auto;
}
#apa-chat-root .apa-title{ font-weight:800; letter-spacing:-0.02em; }

#apa-chat-root .apa-close{
  width:38px !important;
  height:38px !important;
  border-radius: 14px !important;
  background: rgba(0,0,0,0.06) !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  cursor:pointer !important;
}
#apa-chat-root .apa-close .apa-ic{ margin-right:0; }
#apa-chat-root .apa-close:hover{ background: rgba(0,0,0,0.09) !important; }

#apa-chat-root .apa-messages{
  flex: 1 1 auto;
  padding: 14px;
  overflow:auto;
}

#apa-chat-root .apa-msg{ display:flex; margin:10px 0; }
#apa-chat-root .apa-msg.is-user{ justify-content:flex-end; }
#apa-chat-root .apa-msg.is-assistant{ justify-content:flex-start; }

#apa-chat-root .apa-bubble{
  max-width:86%;
  border-radius: 18px;
  padding: 10px 12px;
  font-size:14px;
  line-height:1.35;
  letter-spacing:-0.01em;
  border:1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.70);
}
#apa-chat-root .apa-msg.is-user .apa-bubble{
  background: rgba(255, 194, 148, 0.40);
  border-color: rgba(255, 166, 99, 0.35);
}

#apa-chat-root .apa-inputbar{
  flex:0 0 auto;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding: 12px;
  border-top:1px solid rgba(0,0,0,0.06);
}
#apa-chat-root .apa-input{
  width:100% !important;
  height:44px !important;
  border-radius: 999px !important;
  border:1px solid rgba(0,0,0,0.10) !important;
  background: rgba(255,255,255,0.86) !important;
  padding: 0 14px !important;
  outline:none !important;
  font-size:14px !important;
}
#apa-chat-root .apa-input:focus{
  border-color: rgba(255, 166, 99, 0.65) !important;
  box-shadow: 0 0 0 5px rgba(255, 166, 99, 0.22) !important;
}
#apa-chat-root .apa-send{
  width:100% !important;
  height:44px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap: 8px !important;
}
#apa-chat-root .apa-send:disabled{ opacity:0.65 !important; cursor:not-allowed !important; }

#apa-chat-root .apa-footnote{
  flex:0 0 auto;
  padding: 0 14px 14px 14px;
  font-size:12px;
  color: var(--apa-sub);
  display:flex;
  align-items:center;
  gap:8px;
}
#apa-chat-root .apa-footnote .apa-ic{ opacity:.75; }

#apa-chat-root .apa-cards{
  margin-top: 10px;
  display:grid;
  gap: 10px;
}
#apa-chat-root .apa-card{
  display:grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.78);
}
#apa-chat-root .apa-card-img{
  width:56px; height:56px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,0.06);
  background: rgba(0,0,0,0.03);
}
#apa-chat-root .apa-card-title{
  font-weight:800;
  letter-spacing:-0.02em;
  font-size:13px;
  margin-bottom:2px;
}
#apa-chat-root .apa-card-meta{
  font-size:12px;
  color: var(--apa-sub);
  margin-bottom: 6px;
}
#apa-chat-root .apa-card-note{
  font-size:12px;
  color: rgba(0,0,0,0.72);
  margin-bottom: 6px;
}
#apa-chat-root .apa-card-why{
  font-size:12px;
  color: rgba(0,0,0,0.62);
  margin-bottom: 10px;
}
#apa-chat-root .apa-card-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
#apa-chat-root .apa-card-btn{
  height:34px !important;
  padding: 0 14px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap: 8px !important;
  border-radius: 999px !important;
  white-space:nowrap;
}
#apa-chat-root .apa-card-link{
  display:inline-flex !important;
  align-items:center !important;
  gap: 6px !important;
  font-size:12px !important;
  color: rgba(0,0,0,0.70) !important;
  font-weight:800 !important;
  padding: 6px 10px !important;
  border-radius: 999px !important;
  background: rgba(0,0,0,0.05) !important;
}
#apa-chat-root .apa-card-link:hover{ background: rgba(0,0,0,0.08) !important; }

#apa-chat-root .apa-missing{
  margin-top:10px;
  font-size:12px;
  color: rgba(0,0,0,0.65);
  padding-top:8px;
  border-top:1px solid rgba(0,0,0,0.06);
}

#apa-chat-root .apa-typing{
  display:inline-flex;
  gap:6px;
  margin:10px 0 0 0;
  padding:10px 12px;
  border-radius:18px;
  border:1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.70);
}
#apa-chat-root .apa-typing-dot{
  width:7px; height:7px;
  border-radius:999px;
  background: rgba(0,0,0,0.25);
  animation: apaPulse 1.1s infinite ease-in-out;
}
#apa-chat-root .apa-typing-dot:nth-child(2){ animation-delay:.12s; }
#apa-chat-root .apa-typing-dot:nth-child(3){ animation-delay:.24s; }
@keyframes apaPulse{
  0%,80%,100%{ transform: translateY(0); opacity:.35; }
  40%{ transform: translateY(-3px); opacity:.8; }
}

#apa-chat-root .apa-toast{
  position:absolute;
  left:50%;
  bottom:120px;
  transform: translateX(-50%) translateY(10px);
  opacity:0;
  padding:10px 12px;
  border-radius:999px;
  background: rgba(0,0,0,0.78);
  color: rgba(255,255,255,0.95);
  font-size:12px;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events:none;
}
#apa-chat-root .apa-toast.is-show{ opacity:1; transform: translateX(-50%) translateY(0); }

/* Admin cards */
.apa-admin-card{
  max-width: 980px;
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(14px);
}

/* Mobile */
@media (max-width: 520px) {
  #apa-chat-root .apa-panel{
    width: calc(100vw - 24px);
    height: calc(100vh - 140px);
    right: 0;
  }
  #apa-chat-root .apa-shell{ right: 12px; bottom: 12px; }
}

#apa-chat-root button,
#apa-chat-root input,
#apa-chat-root .apa-fab,
#apa-chat-root .apa-send,
#apa-chat-root .apa-card-btn,
#apa-chat-root .apa-card-link{
  font-family: Montserrat, -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji" !important;
}
#apa-chat-root .apa-fab,
#apa-chat-root .apa-send,
#apa-chat-root .apa-card-btn,
#apa-chat-root .apa-card-link{
  font-size: 14px !important;
  font-weight: 600 !important;
}

#apa-chat-root .apa-cats{
  margin-top: 10px;
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}
#apa-chat-root .apa-cat-chip{
  display:inline-flex !important;
  align-items:center !important;
  gap: 8px !important;
  padding: 10px 12px !important;
  border-radius: 999px !important;
  background: rgba(0,0,0,0.05) !important;
  color: rgba(0,0,0,0.78) !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  cursor: pointer !important;
  box-shadow: none !important;
}
#apa-chat-root .apa-cat-chip:hover{ background: rgba(0,0,0,0.08) !important; }

#apa-chat-root a.apa-card-title{
  color: rgba(0,0,0,0.86) !important;
  font-family: Montserrat, -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}
#apa-chat-root a.apa-card-title:hover{ text-decoration: underline !important; }

#apa-chat-root .apa-card-icon{
  width: 34px !important;
  height: 34px !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0,0,0,0.06) !important;
  color: rgba(0,0,0,0.70) !important;
  box-shadow: none !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
}
#apa-chat-root .apa-card-icon .apa-ic{ width:16px; height:16px; opacity: .95; }
#apa-chat-root .apa-card-icon:hover{
  background: rgba(0,0,0,0.09) !important;
  border-color: rgba(0,0,0,0.12) !important;
}

#apa-chat-root .apa-more-btn{
  margin-top: 10px;
  width: 100%;
  height: 44px;
  border-radius: 999px !important;
  background: rgba(0,0,0,0.05) !important;
  color: rgba(0,0,0,0.80) !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  box-shadow: none !important;
}
#apa-chat-root .apa-more-btn:hover{ background: rgba(0,0,0,0.08) !important; }

#apa-chat-root .apa-card-actions{ justify-content: flex-start; }
#apa-chat-root .apa-head-actions{
  display:inline-flex;
  gap: 10px;
  align-items:center;
}
#apa-chat-root .apa-clear{
  width:38px !important;
  height:38px !important;
  border-radius: 14px !important;
  background: rgba(0,0,0,0.06) !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  cursor:pointer !important;
  box-shadow:none !important;
}
#apa-chat-root .apa-clear:hover{ background: rgba(0,0,0,0.09) !important; }
#apa-chat-root .apa-more-btn--subtle{
  height: 36px !important;
  font-size: 13px !important;
  padding: 0 12px !important;
  background: rgba(0,0,0,0.04) !important;
  color: rgba(0,0,0,0.65) !important;
}
#apa-chat-root .apa-more-btn--subtle .apa-ic{ opacity: .75; }

#apa-chat-root .apa-close{ color: rgba(0,0,0,0.72) !important; }
#apa-chat-root .apa-close:hover{ color: rgba(0,0,0,0.72) !important; }
#apa-chat-root .apa-clear{ color: rgba(0,0,0,0.72) !important; }
#apa-chat-root .apa-clear:hover{ color: rgba(0,0,0,0.72) !important; }

#apa-chat-root .apa-card-btn{ font-size: 13px !important; }
#apa-chat-root .apa-confirm-actions{
  margin-top: 12px;
  display:flex;
  gap: 10px;
  justify-content: flex-end;
}
#apa-chat-root .apa-confirm-btn{
  height: 34px;
  padding: 0 14px;
  border-radius: 999px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  box-shadow: none !important;
  border: 1px solid rgba(0,0,0,0.10) !important;
  background: rgba(255,255,255,0.70) !important;
  color: rgba(0,0,0,0.78) !important;
}
#apa-chat-root .apa-confirm-btn:hover{ background: rgba(0,0,0,0.05) !important; }
#apa-chat-root .apa-confirm-ok{
  background: var(--apa-grad) !important;
  border: 0 !important;
  color: rgba(0,0,0,0.85) !important;
}
#apa-chat-root .apa-confirm-ok:hover{ filter: brightness(0.98); }
