/* TripClap traveler AI chat — parity with travelerChatDock / userLeadDetails */
.tc-ai-root {
  position: fixed;
  right: 16px;
  bottom: 0;
  z-index: 99990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 24px);
  font-family: var(--font-sans, 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', sans-serif);
  font-size: 15px;
  color: #050505;
}

.tc-ai-launcher {
  pointer-events: auto;
  width: 56px;
  height: 56px;
  margin: 0 4px 18px 0;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: #0084ff;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 132, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms ease, background 160ms ease;
}

.tc-ai-launcher:hover {
  transform: scale(1.06);
  background: #0073e6;
}

.tc-ai-launcher svg {
  width: 26px;
  height: 26px;
}

/* Floating greeting bubble above the launcher */
.tc-ai-teaser {
  pointer-events: auto;
  position: relative;
  max-width: min(240px, calc(100vw - 88px));
  margin: 0 8px 4px 0;
  padding: 10px 34px 10px 14px;
  background: #fff;
  color: #050505;
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  animation: tcAiTeaserIn 480ms cubic-bezier(0.23, 1, 0.32, 1) 0.55s both,
    tcAiTeaserFloat 3s ease-in-out 1.2s infinite;
}

.tc-ai-teaser::after {
  content: '';
  position: absolute;
  right: 18px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.03);
  border-radius: 2px;
}

.tc-ai-teaser-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #65676b;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.tc-ai-teaser-close:hover {
  background: #f0f2f5;
  color: #050505;
}

.tc-ai-teaser.is-hidden,
.tc-ai-root.is-open .tc-ai-teaser {
  display: none !important;
}

/* Lead details: AI opens from agents floating menu — hide duplicate bubble/launcher */
.tc-ai-root.tc-ai-embedded .tc-ai-launcher,
.tc-ai-root.tc-ai-embedded .tc-ai-teaser {
  display: none !important;
}

.tc-ai-root.tc-ai-embedded {
  bottom: 0;
  right: 16px;
}

@keyframes tcAiTeaserIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tcAiTeaserFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.tc-ai-panel {
  pointer-events: auto;
  width: 328px;
  height: 455px;
  margin: 0;
  background: #fff;
  border: 1px solid #e4e4e7;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: tcAiChatIn 180ms cubic-bezier(0.23, 1, 0.32, 1) both;
  transition: height 180ms ease;
}

.tc-ai-panel.is-tall {
  height: min(720px, calc(100vh - 24px));
}

.tc-ai-root.is-open .tc-ai-panel {
  display: flex;
}

.tc-ai-root.is-open .tc-ai-launcher {
  display: none;
}

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

.tc-ai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 12px;
  background: #fff;
  border-bottom: 1px solid #e4e6eb;
  color: #050505;
  flex-shrink: 0;
}

.tc-ai-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.tc-ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  display: block;
  border: 1px solid #e4e6eb;
}

.tc-ai-online-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}

.tc-ai-header-text {
  flex: 1;
  min-width: 0;
}

.tc-ai-header-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-ai-header-text span,
.tc-ai-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #65676b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-ai-online-dot-inline {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.tc-ai-header button {
  border: 0;
  background: transparent;
  color: #65676b;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tc-ai-header button:hover {
  background: #f0f2f5;
  color: #050505;
}

.tc-ai-expand-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.tc-ai-panel.is-tall .tc-ai-expand-btn .tc-ai-icon-expand {
  display: none;
}

.tc-ai-panel:not(.is-tall) .tc-ai-expand-btn .tc-ai-icon-collapse {
  display: none;
}

.tc-ai-messages {
  position: relative;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.tc-ai-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.42;
  word-break: break-word;
}

.tc-ai-msg.user {
  align-self: flex-end;
  background: #0084ff;
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.tc-ai-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #050505;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tc-ai-msg.is-expert {
  border: 1px solid #86efac;
  background: #f0fdf4;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.08);
}

.tc-ai-msg-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #15803d;
  margin-bottom: 4px;
}

.tc-ai-msg-body {
  display: block;
}

.tc-ai-msg-body p {
  margin: 0 0 6px;
}

.tc-ai-msg-body p:last-child {
  margin-bottom: 0;
}

.tc-ai-msg-body .tc-ai-detail-title {
  font-size: 15px;
  line-height: 1.3;
  margin-bottom: 2px;
}

.tc-ai-msg-body .tc-ai-detail-title strong {
  color: #0b3d91;
  font-weight: 800;
}

.tc-ai-msg-body .tc-ai-detail-section {
  margin: 8px 0 4px;
  font-size: 13px;
}

.tc-ai-msg-body .tc-ai-detail-section strong {
  color: #0b6bcb;
  font-weight: 800;
}

.tc-ai-msg-body ul.tc-ai-bullets,
.tc-ai-msg-body ol.tc-ai-bullets {
  list-style: none;
  margin: 6px 0 8px;
  padding: 0;
}

.tc-ai-msg-body ul.tc-ai-bullets li,
.tc-ai-msg-body ol.tc-ai-bullets li {
  position: relative;
  margin: 5px 0;
  padding: 7px 10px 7px 14px;
  background: #f3f8ff;
  border-radius: 10px;
  border-left: 3px solid #0084ff;
  color: #1c1e21;
  line-height: 1.4;
}

.tc-ai-msg-body ul,
.tc-ai-msg-body ol {
  margin: 4px 0 6px;
  padding-left: 18px;
}

.tc-ai-msg-body li {
  margin: 2px 0;
}

.tc-ai-msg-body strong {
  font-weight: 700;
  color: #0b6bcb;
}

.tc-ai-msg-body em {
  font-style: italic;
  color: #65676b;
}

.tc-ai-msg-body a.tc-ai-link {
  color: #0084ff;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
}

.tc-ai-msg-gap {
  height: 6px;
}

.tc-ai-msg.system {
  align-self: center;
  background: transparent;
  color: #65676b;
  font-size: 12px;
  text-align: center;
  max-width: 100%;
  box-shadow: none;
  padding: 4px;
}

.tc-ai-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 6px 12px 8px;
  background: #f0f2f5;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tc-ai-chips::-webkit-scrollbar {
  display: none;
}

.tc-ai-chip {
  pointer-events: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  border: 1px solid #e4e6eb;
  background: #fff;
  color: #0084ff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  scroll-snap-align: start;
}

.tc-ai-chip:hover {
  background: #e7f3ff;
}

.tc-ai-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 2px 0 6px;
  width: 100%;
  align-self: stretch;
}

.tc-ai-carousel-wrap {
  position: relative;
  width: 100%;
}

.tc-ai-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 10px;
  width: 100%;
  scrollbar-width: thin;
}

.tc-ai-carousel::-webkit-scrollbar {
  height: 4px;
}

.tc-ai-carousel::-webkit-scrollbar-thumb {
  background: #c5c9d1;
  border-radius: 999px;
}

.tc-ai-carousel-nav {
  display: none;
}

@media (min-width: 768px) {
  .tc-ai-carousel-wrap {
    padding: 0 18px;
  }

  .tc-ai-carousel-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-58%);
    z-index: 2;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #e4e6eb;
    border-radius: 999px;
    background: #fff;
    color: #050505;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
  }

  .tc-ai-carousel-nav svg {
    width: 14px;
    height: 14px;
    display: block;
  }

  .tc-ai-carousel-nav:hover:not(:disabled) {
    background: #f0f2f5;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
  }

  .tc-ai-carousel-nav:disabled {
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
  }

  .tc-ai-carousel-prev {
    left: 0;
  }

  .tc-ai-carousel-next {
    right: 0;
  }
}

.tc-ai-pkg-card {
  flex: 0 0 228px;
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid #e4e6eb;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.tc-ai-pkg-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.tc-ai-pkg-media {
  position: relative;
  height: 118px;
  background: linear-gradient(135deg, #1d4ed8, #38bdf8);
  overflow: hidden;
}

.tc-ai-pkg-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tc-ai-pkg-media-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 12px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.tc-ai-pkg-badge-row {
  position: absolute;
  left: 8px;
  top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: calc(100% - 16px);
}

.tc-ai-pkg-badge {
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 999px;
  line-height: 1.2;
}

.tc-ai-pkg-badge.is-assured {
  background: #059669;
}

.tc-ai-pkg-badge.is-top {
  background: #d97706;
}

.tc-ai-pkg-badge.is-cert {
  background: #2563eb;
}

.tc-ai-pkg-badge.is-trust {
  background: #0f766e;
}

.tc-ai-pkg-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.tc-ai-pkg-title {
  font-size: 13px;
  font-weight: 700;
  color: #050505;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}

.tc-ai-pkg-meta {
  font-size: 11px;
  color: #65676b;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tc-ai-pkg-price {
  font-size: 14px;
  font-weight: 800;
  color: #0084ff;
}

.tc-ai-pkg-agent {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #65676b;
  min-width: 0;
}

.tc-ai-pkg-agent img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #e7f3ff;
}

.tc-ai-pkg-agent span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-ai-pkg-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

.tc-ai-pkg-actions a,
.tc-ai-pkg-actions button {
  flex: 1;
  text-align: center;
  border-radius: 999px;
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #050505;
}

.tc-ai-pkg-actions button.primary,
.tc-ai-pkg-actions a.primary {
  background: #0084ff;
  border-color: #0084ff;
  color: #fff;
}

.tc-ai-show-more {
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-width: 120px;
  align-self: stretch;
  border: 1px dashed #0084ff;
  background: #e7f3ff;
  color: #0084ff;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.tc-ai-card {
  background: #f8fafc;
  border: 1px solid #e4e6eb;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
}

.tc-ai-card strong {
  display: block;
  font-size: 13px;
  color: #050505;
}

.tc-ai-card span {
  display: block;
  font-size: 12px;
  color: #65676b;
  margin-top: 2px;
}

.tc-ai-card a {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: #0084ff;
  text-decoration: none;
  font-weight: 600;
}

.tc-ai-footer {
  border-top: 1px solid #e4e6eb;
  background: #fff;
  padding: 6px 8px 10px;
  flex-shrink: 0;
}

.tc-ai-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.tc-ai-actions button {
  flex: 1;
  border: 1px solid #e4e6eb;
  background: #fff;
  color: #050505;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tc-ai-actions button.primary {
  background: #0084ff;
  border-color: #0084ff;
  color: #fff;
}

.tc-ai-compose {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.tc-ai-compose textarea {
  flex: 1;
  resize: none;
  border: 0;
  background: #f0f2f5;
  border-radius: 20px;
  padding: 10px 14px;
  min-height: 40px;
  max-height: 100px;
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
  color: #050505;
}

.tc-ai-compose textarea:focus {
  background: #e4e6eb;
}

.tc-ai-compose button {
  border: 0;
  background: #0084ff;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tc-ai-compose button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tc-ai-form {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 0;
}

.tc-ai-form.is-visible {
  display: flex;
}

.tc-ai-footer.is-form-open {
  padding-top: 10px;
}

.tc-ai-form-title {
  font-size: 13px;
  font-weight: 600;
  color: #050505;
  margin-bottom: 2px;
}

.tc-ai-form input {
  border: 1px solid #e4e6eb;
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  background: #f0f2f5;
}

.tc-ai-form .row {
  display: flex;
  gap: 8px;
}

.tc-ai-form .row input {
  flex: 1;
  min-width: 0;
}

.tc-ai-form-dismiss {
  border: 0 !important;
  background: transparent !important;
  color: #65676b !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 4px !important;
  cursor: pointer;
  text-align: center;
}

.tc-ai-form-dismiss:hover {
  color: #0084ff !important;
}

.tc-ai-typing {
  align-self: flex-start;
  color: #65676b;
  font-size: 12px;
  padding: 0 4px;
  font-style: italic;
}

.tc-ai-typing.is-peer {
  font-style: normal;
  font-weight: 500;
  color: #0f766e;
}

.tc-ai-typing-dots::after {
  content: '...';
  animation: tcAiTypingBlink 1.2s ease-in-out infinite;
}

@keyframes tcAiTypingBlink {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

/* Mobile: full-screen chat (parity with FCP / traveler chat dock UX) */
@media (max-width: 767px) {
  .tc-ai-root {
    right: 12px;
    max-width: calc(100vw - 16px);
  }

  .tc-ai-launcher {
    margin: 0 2px 12px 0;
  }

  .tc-ai-root.is-open {
    inset: auto;
    right: 0;
    left: 0;
    top: 0;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    align-items: stretch;
    transform: translateZ(0);
  }

  .tc-ai-root.is-open .tc-ai-panel {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    animation: none;
    transition: none;
  }

  .tc-ai-expand-btn {
    display: none !important;
  }

  html.tc-ai-chat-lock,
  html.tc-ai-chat-lock body {
    overflow: hidden !important;
    overscroll-behavior: none;
    height: 100%;
    position: relative;
  }

  html.tc-ai-chat-lock body {
    touch-action: none;
  }

  .tc-ai-header {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .tc-ai-footer {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .tc-ai-pkg-card {
    flex-basis: 210px;
  }
}
