/* TR InnovaTech — enhanced chatbot UI */

/* FAB — stronger presence */
.chat-fab-wrap{z-index:1001}
.chat-fab{
  width:62px;height:62px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.15) inset,
    0 6px 20px rgba(6,95,211,.4),
    0 12px 36px rgba(7,38,109,.22);
}
.chat-fab-label{
  font-size:clamp(0.72rem,0.68rem + 0.2vw,0.78rem);
  padding:8px 16px;
  border:1px solid rgba(6,95,211,.2);
  box-shadow:0 6px 24px rgba(7,38,109,.14);
}
.chat-fab.has-unread::after{
  content:'';position:absolute;top:2px;right:2px;width:11px;height:11px;
  background:#ef4444;border-radius:50%;border:2px solid #fff;
  box-shadow:0 0 0 2px rgba(239,68,68,.3);
  animation:chatUnreadPulse 2s ease-in-out infinite;
}
@keyframes chatUnreadPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.15)}}

/* Window — premium glass panel */
.chat-win{
  width:min(420px,calc(100vw - 1.5rem));
  border-radius:26px;
  border:1px solid rgba(255,255,255,.75);
  box-shadow:
    0 0 0 1px rgba(6,95,211,.08),
    0 32px 80px rgba(7,38,109,.24),
    0 12px 32px rgba(6,95,211,.14);
}
.chat-win.open{
  animation:chatWinIn .38s cubic-bezier(.34,1.25,.64,1);
}
@keyframes chatWinIn{
  from{opacity:0;transform:scale(.9) translateY(28px)}
  to{opacity:1;transform:scale(1) translateY(0)}
}

/* Header — AI command center feel */
.chat-hdr{
  padding:1.1rem 1.1rem 1rem;
  background:linear-gradient(145deg,var(--navy) 0%,#0a3580 40%,#0a3d8f 100%);
}
.chat-hdr-top{margin-bottom:.55rem}
.chat-av{
  width:46px;height:46px;border-radius:15px;
  font-size:1.15rem;
}
.chat-hdr-title{font-size:clamp(0.92rem,0.88rem + 0.2vw,1rem)}
.chat-status{font-size:clamp(0.66rem,0.62rem + 0.15vw,0.72rem)}
.chat-hdr-pills{
  display:flex;flex-wrap:wrap;gap:.35rem;margin:.5rem 0 .15rem;position:relative;z-index:1;
}
.chat-hdr-pill{
  font-size:clamp(0.58rem,0.55rem + 0.1vw,0.64rem);
  padding:4px 10px;
  background:rgba(255,255,255,.12);
  border-color:rgba(255,255,255,.2);
}
.chat-hdr-actions{margin-top:.5rem;gap:.5rem}
.chat-act{padding:9px 12px;font-size:clamp(0.68rem,0.64rem + 0.15vw,0.74rem);border-radius:11px}
.chat-close-btn{width:36px;height:36px}

/* Body */
.chat-body-wrap{min-height:0;flex:1;display:flex;flex-direction:column;background:#f4f7fc}
.chat-scroll{
  background:linear-gradient(180deg,#f8fafc 0%,#eef3fb 50%,#e8eef8 100%);
  scroll-behavior:smooth;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}

/* Intro card — stronger first impression */
.chat-intro{padding:1rem 1rem .5rem;margin-top:0}
.chat-intro-card{
  padding:1.1rem 1.2rem;
  border-radius:20px;
  border:1px solid rgba(6,95,211,.14);
  box-shadow:0 10px 32px rgba(7,38,109,.1),0 2px 8px rgba(6,95,211,.06);
}
.chat-intro-card h4{font-size:clamp(0.95rem,0.9rem + 0.25vw,1.05rem)}
.chat-intro-card p{font-size:clamp(0.78rem,0.74rem + 0.2vw,0.84rem);margin-bottom:.65rem}
.chat-intro-stats{
  display:grid;grid-template-columns:repeat(3,1fr);gap:.45rem;margin-bottom:.65rem;
}
.chat-intro-stat{
  padding:.45rem .35rem;border-radius:12px;
  background:linear-gradient(180deg,#fff 0%,var(--g50) 100%);
}
.chat-intro-stat strong{font-size:clamp(0.8rem,0.76rem + 0.2vw,0.88rem)}
.chat-intro-stat span{font-size:clamp(0.56rem,0.54rem + 0.1vw,0.62rem)}
.chat-intro-chips{
  display:grid;grid-template-columns:1fr 1fr;gap:.4rem;
}
.chat-intro-chip{
  font-size:clamp(0.7rem,0.66rem + 0.15vw,0.76rem);
  padding:9px 11px;border-radius:12px;
  min-height:40px;
}

/* Messages */
.chat-msgs{padding:.75rem 1rem 1rem;gap:.9rem}
.msg{max-width:92%}
.msg-bbl{
  font-size:clamp(0.81rem,0.78rem + 0.15vw,0.875rem);
  line-height:1.62;
  padding:12px 15px;
}
.msg.bot .msg-bbl{
  background:#fff;
  border:1px solid rgba(6,95,211,.12);
  box-shadow:0 3px 14px rgba(7,38,109,.07);
}
.msg.usr .msg-bbl{
  box-shadow:0 4px 16px rgba(6,95,211,.3);
}
.msg-meta{font-size:clamp(0.58rem,0.55rem + 0.1vw,0.64rem)}

/* Chips — quick replies */
.chips{padding:.25rem 1rem .85rem;gap:.45rem}
.chip{
  font-size:clamp(0.71rem,0.68rem + 0.15vw,0.78rem);
  padding:8px 15px;
  min-height:36px;
  display:inline-flex;align-items:center;
}

/* Booking progress */
.chat-booking-bar.show{max-height:72px}
.chat-booking-fill{
  background:linear-gradient(90deg,var(--indigo),var(--accent-light),var(--violet));
  background-size:200% 100%;
  animation:bookingShine 3s ease infinite;
}
@keyframes bookingShine{0%,100%{background-position:0% 50%}50%{background-position:100% 50%}}

/* Compose area */
.chat-compose{
  padding:.85rem 1rem max(.85rem,env(safe-area-inset-bottom));
  background:#fff;
  border-top:1px solid var(--g200);
  box-shadow:0 -4px 20px rgba(7,38,109,.06);
}
.chat-compose-inner{
  border-radius:18px;padding:7px 7px 7px 15px;
  border-width:1.5px;
}
.chat-compose-inner:focus-within{
  border-color:rgba(6,95,211,.45);
  box-shadow:0 0 0 4px rgba(6,95,211,.1);
}
#chatInput,.chat-input-field{
  font-size:max(16px,0.84rem);
  line-height:1.5;
}
.chat-send-btn{
  width:40px;height:40px;border-radius:13px;
  transition:transform .2s,box-shadow .2s,opacity .2s;
}
.chat-send-btn:not(:disabled):hover{transform:scale(1.06)}
.chat-send-btn.is-sending i{animation:sendSpin .8s linear infinite}
@keyframes sendSpin{to{transform:rotate(360deg)}}
.chat-compose-foot{
  display:flex;align-items:center;justify-content:space-between;
  margin-top:.5rem;gap:.5rem;
}
.chat-hint{
  font-size:clamp(0.62rem,0.6rem + 0.1vw,0.68rem);
  color:var(--g400);margin:0;
}
.chat-hint kbd{
  font-family:inherit;font-size:.9em;
  background:var(--g100);border:1px solid var(--g200);
  border-radius:4px;padding:1px 5px;
}
.chat-hint-link{
  color:var(--indigo);font-weight:600;background:none;border:none;
  font-family:inherit;font-size:inherit;cursor:pointer;padding:0;
  text-decoration:underline;text-underline-offset:2px;
}
.chat-hint-link:hover{color:var(--violet)}
.chat-powered{
  font-size:clamp(0.56rem,0.54rem + 0.08vw,0.62rem);
  color:var(--g400);white-space:nowrap;
}
.chat-powered i{color:var(--indigo)}

/* Scroll to bottom */
.chat-scroll-btn{
  bottom:1rem;right:1rem;
  width:34px;height:34px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 4px 16px rgba(7,38,109,.15);
}
.chat-scroll-btn.show{opacity:1}

/* Typing indicator */
.typing-dots{padding:13px 18px;border-radius:18px;background:#fff;border:1px solid rgba(6,95,211,.1)}

/* Body lock when chat open on mobile */
body.chat-open{overflow:hidden;touch-action:none}
body.chat-open .chat-win{touch-action:auto}

/* Connection status */
.chat-status.is-busy .sdot{background:#f59e0b;box-shadow:0 0 6px rgba(245,158,11,.6)}
.chat-status.is-busy{color:rgba(255,255,255,.75)}
.chat-status.is-error .sdot{background:#ef4444;animation:none}

@media(max-width:768px){
  .chat-win{
    width:100vw;right:0;left:0;bottom:0;
    height:min(88vh,720px);
    border-radius:24px 24px 0 0;
    transform-origin:bottom center;
  }
  .chat-win.open{transform:translateY(0)}
  .chat-fab-wrap{right:max(1rem,env(safe-area-inset-right));bottom:max(1.25rem,env(safe-area-inset-bottom))}
  .chat-intro-chips{grid-template-columns:1fr}
  .chat-hdr-pills{display:none}
}

@media(prefers-reduced-motion:reduce){
  .chat-win.open,.chat-fab.has-unread::after,.bookingShine,.sendSpin{animation:none!important}
  .chat-scroll{scroll-behavior:auto}
}
