/* AirpakAI floating chat — bottom-right widget */
.ap-chat-fab{
  position:fixed; right:22px; bottom:22px;
  width:62px; height:62px; border-radius:50%;
  background:linear-gradient(135deg,#CD2727 0%,#9b1a1a 100%);
  border:0; cursor:pointer; outline:none;
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 10px 28px rgba(205,39,39,.45), 0 3px 8px rgba(0,0,0,.18);
  z-index:2147483645;
  transition:transform .18s cubic-bezier(.2,.9,.3,1.3), box-shadow .18s, opacity .18s;
  animation:ap-fab-in .45s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes ap-fab-in{
  0%{ transform:scale(0) rotate(-30deg); opacity:0; }
  60%{ transform:scale(1.08) rotate(0); opacity:1; }
  100%{ transform:scale(1); }
}
.ap-chat-fab:hover{ transform:translateY(-3px) scale(1.05); box-shadow:0 14px 34px rgba(205,39,39,.55), 0 4px 10px rgba(0,0,0,.22); }
.ap-chat-fab:active{ transform:translateY(-1px) scale(.98); }
.ap-chat-fab svg{ width:28px; height:28px; }
.ap-chat-fab .ap-chat-dot{
  position:absolute; top:8px; right:9px;
  width:11px; height:11px; border-radius:50%;
  background:#34c759; border:2px solid #fff;
  box-shadow:0 0 0 0 rgba(52,199,89,.6);
  animation:ap-pulse 2s infinite;
}
@keyframes ap-pulse{
  0%{ box-shadow:0 0 0 0 rgba(52,199,89,.55); }
  70%{ box-shadow:0 0 0 10px rgba(52,199,89,0); }
  100%{ box-shadow:0 0 0 0 rgba(52,199,89,0); }
}
.ap-chat-fab.open svg.ap-icon-msg{ display:none; }
.ap-chat-fab:not(.open) svg.ap-icon-close{ display:none; }

/* tooltip "Need help?" peeking out on hover */
.ap-chat-tip{
  position:fixed; right:96px; bottom:32px;
  background:#1a1a24; color:#fff;
  padding:7px 12px; border-radius:10px;
  font:600 12.5px/1 'Inter','Segoe UI',system-ui,sans-serif;
  white-space:nowrap;
  opacity:0; transform:translateX(8px); pointer-events:none;
  transition:opacity .2s, transform .2s;
  z-index:2147483644;
  box-shadow:0 6px 16px rgba(0,0,0,.18);
}
.ap-chat-tip::after{
  content:""; position:absolute; right:-5px; top:50%;
  width:0; height:0; transform:translateY(-50%);
  border:5px solid transparent; border-left-color:#1a1a24;
}
.ap-chat-fab:hover + .ap-chat-tip{ opacity:1; transform:translateX(0); }

/* Chat panel — opens from bottom-right, slides up */
.ap-chat-panel{
  position:fixed; right:22px; bottom:98px;
  width:384px; max-width:calc(100vw - 28px);
  height:580px; max-height:calc(100vh - 130px);
  background:#fff; color:#1a1a24;
  border-radius:18px; overflow:hidden;
  display:none; flex-direction:column;
  box-shadow:0 24px 60px rgba(0,0,0,.28), 0 6px 18px rgba(0,0,0,.14);
  font-family:'Inter','Segoe UI',system-ui,sans-serif;
  z-index:2147483646;
  transform-origin:bottom right;
}
.ap-chat-panel.open{
  display:flex;
  animation:ap-panel-in .28s cubic-bezier(.2,.9,.3,1.15);
}
@keyframes ap-panel-in{
  0%{ opacity:0; transform:translateY(20px) scale(.9); }
  100%{ opacity:1; transform:translateY(0) scale(1); }
}
.ap-chat-head{
  background:linear-gradient(135deg,#CD2727 0%,#9b1a1a 100%);
  color:#fff; padding:14px 16px;
  display:flex; align-items:center; gap:12px;
  position:relative;
}
.ap-chat-head::after{
  content:""; position:absolute; left:0; right:0; bottom:0; height:3px;
  background:linear-gradient(90deg,transparent, rgba(255,255,255,.35), transparent);
}
.ap-chat-head .ap-chat-avatar{
  width:38px; height:38px; border-radius:50%;
  background:rgba(255,255,255,.18);
  display:flex; align-items:center; justify-content:center;
  font-size:17px;
  position:relative;
}
.ap-chat-head .ap-chat-avatar::after{
  content:""; position:absolute; right:-1px; bottom:-1px;
  width:10px; height:10px; border-radius:50%;
  background:#34c759; border:2px solid #9b1a1a;
}
.ap-chat-head .ap-chat-title{ font-weight:700; font-size:14.5px; line-height:1.15; }
.ap-chat-head .ap-chat-sub{ font-size:11.5px; opacity:.9; margin-top:2px; }
.ap-chat-head .ap-chat-close{
  margin-left:auto; background:rgba(255,255,255,.12); border:0; color:#fff;
  font-size:18px; cursor:pointer; padding:0;
  width:30px; height:30px; border-radius:8px;
  display:flex; align-items:center; justify-content:center;
  transition:background .15s;
}
.ap-chat-head .ap-chat-close:hover{ background:rgba(255,255,255,.22); }

.ap-chat-body{
  flex:1; overflow-y:auto; padding:16px;
  background:linear-gradient(180deg,#f9f9fb 0%,#f3f3f7 100%);
  display:flex; flex-direction:column; gap:10px;
  scroll-behavior:smooth;
}
.ap-chat-body::-webkit-scrollbar{ width:6px; }
.ap-chat-body::-webkit-scrollbar-thumb{ background:rgba(0,0,0,.15); border-radius:3px; }

.ap-chat-msg{
  max-width:85%; padding:10px 13px;
  border-radius:16px; font-size:13.5px; line-height:1.45;
  white-space:pre-wrap; word-wrap:break-word;
  animation:ap-msg-in .22s ease-out;
}
@keyframes ap-msg-in{ from{ opacity:0; transform:translateY(6px);} to{ opacity:1; transform:translateY(0);} }
.ap-chat-msg.user{ align-self:flex-end; background:linear-gradient(135deg,#CD2727,#9b1a1a); color:#fff; border-bottom-right-radius:5px; box-shadow:0 2px 6px rgba(205,39,39,.25); }
.ap-chat-msg.bot{ align-self:flex-start; background:#fff; color:#1a1a24; border:1px solid #ececef; border-bottom-left-radius:5px; box-shadow:0 1px 3px rgba(0,0,0,.05); }
.ap-chat-msg.err{ align-self:flex-start; background:#fff3f3; color:#9b1a1a; border:1px solid #f3caca; }

.ap-chat-typing{ display:flex; gap:4px; align-self:flex-start; padding:12px 14px; background:#fff; border:1px solid #ececef; border-radius:16px; box-shadow:0 1px 3px rgba(0,0,0,.05); }
.ap-chat-typing span{ width:7px; height:7px; border-radius:50%; background:#CD2727; opacity:.6; animation:ap-blink 1.3s infinite; }
.ap-chat-typing span:nth-child(2){ animation-delay:.18s; }
.ap-chat-typing span:nth-child(3){ animation-delay:.36s; }
@keyframes ap-blink{ 0%,80%,100%{ transform:scale(.7); opacity:.5;} 40%{ transform:scale(1); opacity:1;} }

.ap-chat-quick{ display:flex; flex-wrap:wrap; gap:6px; padding:4px 16px 10px; background:linear-gradient(180deg,#f3f3f7,#f3f3f7); }
.ap-chat-quick button{
  font:600 12px 'Inter',sans-serif; color:#CD2727;
  background:#fff; border:1px solid #f3caca; border-radius:999px;
  padding:6px 11px; cursor:pointer; transition:.15s;
}
.ap-chat-quick button:hover{ background:#CD2727; color:#fff; border-color:#CD2727; }

.ap-chat-input{
  display:flex; gap:8px; padding:12px;
  border-top:1px solid #ececef; background:#fff;
}
.ap-chat-input textarea{
  flex:1; resize:none; border:1px solid #e5e5e9; border-radius:12px;
  padding:10px 12px; font:13.5px 'Inter',sans-serif; outline:none;
  max-height:90px; transition:border-color .15s, box-shadow .15s;
}
.ap-chat-input textarea:focus{ border-color:#CD2727; box-shadow:0 0 0 3px rgba(205,39,39,.12); }
.ap-chat-input button{
  border:0; background:linear-gradient(135deg,#CD2727,#9b1a1a); color:#fff;
  width:42px; border-radius:12px; cursor:pointer; font-size:16px;
  display:flex; align-items:center; justify-content:center;
  transition:transform .12s, opacity .12s;
}
.ap-chat-input button:hover:not(:disabled){ transform:scale(1.05); }
.ap-chat-input button:disabled{ opacity:.45; cursor:not-allowed; }

@media(max-width:520px){
  .ap-chat-fab{ right:14px; bottom:14px; width:56px; height:56px; }
  .ap-chat-tip{ display:none; }
  .ap-chat-panel{ right:10px; left:10px; bottom:82px; width:auto; height:72vh; }
}

/* ===== Human handoff card ===== */
.ap-chat-head .ap-chat-headtxt{ flex:1; min-width:0; }
.ap-chat-human{
  display:inline-flex; align-items:center; gap:6px;
  background:rgba(255,255,255,.16); color:#fff;
  border:0; border-radius:999px; padding:6px 11px;
  font:600 12px/1 Inter,system-ui,sans-serif; cursor:pointer;
  margin-right:6px; transition:background .15s, transform .15s;
}
.ap-chat-human:hover{ background:rgba(255,255,255,.28); transform:translateY(-1px); }
.ap-chat-human i{ font-size:11px; }

.ap-quick-human{
  background:#fff5f5 !important; color:#CD2727 !important;
  border:1px solid #f4c8c8 !important; font-weight:700 !important;
}
.ap-quick-human:hover{ background:#ffe9e9 !important; }

.ap-chat-handoff{
  margin:8px 12px 4px; padding:14px;
  background:linear-gradient(180deg,#fff7f7 0%,#fff 100%);
  border:1px solid #f1c9c9; border-radius:14px;
  box-shadow:0 4px 14px rgba(205,39,39,.08);
  animation:ap-handoff-in .35s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes ap-handoff-in{
  0%{opacity:0; transform:translateY(8px) scale(.98);}
  100%{opacity:1; transform:none;}
}
.ap-handoff-head{ display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.ap-handoff-pulse{
  width:12px; height:12px; border-radius:50%; background:#34c759;
  box-shadow:0 0 0 0 rgba(52,199,89,.6);
  animation:ap-pulse 2s infinite; flex:0 0 auto;
}
.ap-handoff-title{ font:700 14px/1.2 Inter,system-ui,sans-serif; color:#1a1a24; }
.ap-handoff-sub{ font:400 11.5px/1.3 Inter,system-ui,sans-serif; color:#666; margin-top:2px; }

.ap-handoff-row{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.ap-handoff-opt{
  display:flex; align-items:center; gap:8px;
  padding:10px; border-radius:10px; text-decoration:none;
  background:#fff; border:1px solid #eee;
  transition:transform .15s, box-shadow .15s, border-color .15s;
  min-width:0;
}
.ap-handoff-opt:hover{ transform:translateY(-2px); border-color:#CD2727; box-shadow:0 6px 16px rgba(205,39,39,.12); }
.ap-handoff-opt i{
  width:30px; height:30px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  color:#fff; font-size:13px; flex:0 0 auto;
}
.ap-handoff-opt.phone    i{ background:#34c759; }
.ap-handoff-opt.whatsapp i{ background:#25d366; }
.ap-handoff-opt.email    i{ background:#CD2727; }
.ap-handoff-opt span{ display:flex; flex-direction:column; min-width:0; }
.ap-handoff-opt b{ font:700 12px/1.2 Inter,system-ui,sans-serif; color:#1a1a24; }
.ap-handoff-opt em{ font:400 10.5px/1.2 Inter,system-ui,sans-serif; color:#666; font-style:normal;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }

.ap-handoff-or{ position:relative; text-align:center; margin:14px 0 8px; }
.ap-handoff-or::before{ content:""; position:absolute; left:0; right:0; top:50%; border-top:1px solid #eee; }
.ap-handoff-or span{ position:relative; background:#fff7f7; padding:0 10px; font:500 11px/1 Inter,sans-serif; color:#888; text-transform:uppercase; letter-spacing:.06em; }

.ap-handoff-form{ display:grid; gap:6px; }
.ap-handoff-form input, .ap-handoff-form textarea{
  width:100%; border:1px solid #e2e2e2; border-radius:9px;
  padding:9px 11px; font:400 13px/1.4 Inter,system-ui,sans-serif;
  background:#fff; color:#1a1a24; outline:none;
  transition:border-color .15s, box-shadow .15s;
}
.ap-handoff-form input:focus, .ap-handoff-form textarea:focus{
  border-color:#CD2727; box-shadow:0 0 0 3px rgba(205,39,39,.14);
}
.ap-handoff-form textarea{ resize:vertical; min-height:46px; }
.ap-handoff-form button{
  margin-top:4px; padding:10px 14px; border:0; border-radius:9px;
  background:linear-gradient(135deg,#CD2727 0%,#9b1a1a 100%);
  color:#fff; font:600 13px/1 Inter,sans-serif; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  transition:transform .15s, box-shadow .15s, opacity .15s;
}
.ap-handoff-form button:hover{ transform:translateY(-1px); box-shadow:0 6px 16px rgba(205,39,39,.3); }
.ap-handoff-form button:disabled{ opacity:.6; cursor:wait; transform:none; }
.ap-handoff-status{ font:500 12px/1.3 Inter,sans-serif; min-height:16px; padding:2px 2px 0; color:#666; }
.ap-handoff-status.ok{ color:#1f8a3a; }
.ap-handoff-status.err{ color:#b00020; }
.ap-handoff-foot{ margin-top:10px; font:400 11.5px/1.3 Inter,sans-serif; color:#666; text-align:center; }
.ap-handoff-foot a{ color:#CD2727; font-weight:600; text-decoration:none; }
.ap-handoff-foot a:hover{ text-decoration:underline; }

@media (max-width:480px){
  .ap-handoff-row{ grid-template-columns:1fr; }
  .ap-handoff-opt em{ font-size:11px; }
}
