/*
 * PAS Concierge chat widget styles
 * All class names are prefixed with "pasc-" to avoid host-page collisions.
 */

/* ---- Layout container ---- */
.pasc-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483647; /* max z-index */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  box-sizing: border-box;
}

.pasc-widget *,
.pasc-widget *::before,
.pasc-widget *::after {
  box-sizing: inherit;
}

/* ---- Floating bubble ---- */
.pasc-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: background-color 0.2s ease, transform 0.15s ease,
    box-shadow 0.2s ease;
  flex-shrink: 0;
  margin-top: 12px;
  outline: none;
}

.pasc-bubble:hover {
  background-color: #1d4ed8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  transform: scale(1.06);
}

.pasc-bubble:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

.pasc-bubble:active {
  transform: scale(0.97);
}

.pasc-bubble--open {
  background-color: #1e40af;
}

/* ---- Chat panel ---- */
.pasc-panel {
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 100px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pasc-slide-up 0.22s ease;
}

.pasc-panel[hidden] {
  display: none;
}

@keyframes pasc-slide-up {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---- Header ---- */
.pasc-header {
  background-color: #2563eb;
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.pasc-header-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.pasc-close {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.15s ease, background-color 0.15s ease;
  outline: none;
}

.pasc-close:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.15);
}

.pasc-close:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}

/* ---- Messages scroll area ---- */
.pasc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* Custom scrollbar (Webkit) */
.pasc-messages::-webkit-scrollbar {
  width: 5px;
}
.pasc-messages::-webkit-scrollbar-track {
  background: transparent;
}
.pasc-messages::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 3px;
}

/* ---- Individual message rows ---- */
.pasc-message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.pasc-message--user {
  align-self: flex-end;
  align-items: flex-end;
}

.pasc-message--assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.pasc-message--error {
  align-self: center;
  align-items: center;
  max-width: 100%;
}

.pasc-message-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.5;
}

.pasc-message--user .pasc-message-bubble {
  background-color: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.pasc-message--assistant .pasc-message-bubble {
  background-color: #f3f4f6;
  color: #111827;
  border-bottom-left-radius: 4px;
}

.pasc-message--error .pasc-message-bubble {
  background-color: #fef2f2;
  color: #b91c1c;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
}

/* ---- Booking link ---- */
.pasc-booking-link-row {
  margin-top: 6px;
}

.pasc-booking-link {
  display: inline-block;
  padding: 7px 14px;
  background-color: #2563eb;
  color: #ffffff;
  text-decoration: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

.pasc-booking-link:hover {
  background-color: #1d4ed8;
  text-decoration: none;
}

.pasc-booking-link:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

/* ---- Typing indicator ---- */
.pasc-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px 8px;
  flex-shrink: 0;
}

.pasc-typing--hidden {
  display: none;
}

.pasc-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #9ca3af;
  animation: pasc-typing-bounce 1.2s infinite;
}

.pasc-typing-dot:nth-child(1) {
  animation-delay: 0s;
}
.pasc-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.pasc-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pasc-typing-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ---- Input row ---- */
.pasc-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  flex-shrink: 0;
}

.pasc-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #111827;
  background: #f9fafb;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  min-width: 0;
}

.pasc-input:focus {
  border-color: #2563eb;
  background: #ffffff;
}

.pasc-input::placeholder {
  color: #9ca3af;
}

.pasc-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pasc-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease, transform 0.1s ease;
  outline: none;
}

.pasc-send:hover {
  background-color: #1d4ed8;
}

.pasc-send:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

.pasc-send:active {
  transform: scale(0.94);
}

.pasc-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ---- Responsive: narrow screens ---- */
@media (max-width: 480px) {
  .pasc-widget {
    bottom: 12px;
    right: 12px;
  }

  .pasc-panel {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    height: 70vh;
    max-height: 70vh;
  }
}

/* ---- Guided flow (button-driven) ---- */
.pasc-input-row--hidden {
  display: none;
}

.pasc-guided {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 12px 12px;
  align-items: flex-start;
}

.pasc-guided-btn {
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: 1px solid #d4d9e0;
  border-radius: 12px;
  background-color: #fff;
  color: #1f2430;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, transform 0.06s ease;
}

.pasc-guided-btn:hover {
  border-color: #2563eb;
  background-color: #f3f7ff;
}

.pasc-guided-btn:active {
  transform: translateY(1px);
}

.pasc-guided-cta {
  width: 100%;
  text-align: center;
  padding: 11px 14px;
  border-radius: 12px;
  background-color: #2563eb;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #2563eb;
  cursor: pointer;
  box-sizing: border-box;
}

.pasc-guided-cta:hover {
  background-color: #1d4fd0;
}

.pasc-guided-cta--ghost {
  background-color: #fff;
  color: #2563eb;
}

.pasc-guided-cta--ghost:hover {
  background-color: #f3f7ff;
}

.pasc-guided-type {
  align-self: center;
  margin-top: 2px;
  padding: 4px 6px;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}

.pasc-guided-async {
  display: flex;
  gap: 8px;
  width: 100%;
}

.pasc-guided-async .pasc-input {
  flex: 1;
}

.pasc-guided-async .pasc-guided-cta {
  width: auto;
  white-space: nowrap;
}
