/* EUROTSI Live Chat (animated launcher + end chat + correct stacking) */

.eurotsi-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ===== Animated launcher ===== */
.eurotsi-chat__launcher {
  position: relative;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px 12px 14px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  background: #111827;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  transform: translateZ(0);
}

.eurotsi-chat__launcher:focus {
  outline: 2px solid rgba(59, 130, 246, 0.75);
  outline-offset: 2px;
}

.eurotsi-chat__launcher-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.75);
}

/* subtle pulse */
.eurotsi-chat__launcher--pulse .eurotsi-chat__launcher-dot {
  animation: eurotsiPulseDot 1.8s ease-out infinite;
}

@keyframes eurotsiPulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.65); }
  70%  { box-shadow: 0 0 0 12px rgba(34,197,94,0.0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.0); }
}

/* shimmer sweep */
.eurotsi-chat__launcher::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -60%;
  width: 60%;
  height: 180%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.12), rgba(255,255,255,0));
  transform: rotate(20deg);
  animation: eurotsiShimmer 4.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes eurotsiShimmer {
  0%   { left: -70%; opacity: 0; }
  10%  { opacity: 1; }
  45%  { left: 120%; opacity: 0; }
  100% { left: 120%; opacity: 0; }
}

/* ===== Backdrop below panel ===== */
.eurotsi-chat__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.22);
  z-index: 999997;
}
.eurotsi-chat__backdrop--hidden { display: none; }

/* ===== Panel above backdrop ===== */
.eurotsi-chat__panel {
  position: fixed;
  right: 18px;
  bottom: 72px;
  width: 380px;
  max-width: calc(100vw - 36px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  overflow: hidden;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  border: 1px solid rgba(0,0,0,0.08);
  z-index: 999999;
}
.eurotsi-chat__panel--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.eurotsi-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 12px 14px;
  background: #ffffff;
  color: #111827;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.eurotsi-chat__title {
  font-weight: 900;
  font-size: 15px;
  line-height: 1.1;
}
.eurotsi-chat__subtitle {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 3px;
}

.eurotsi-chat__body {
  height: calc(100% - 56px);
  background: #fff;
}

.eurotsi-chat__step {
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
}
.eurotsi-chat__step--hidden { display: none; }

/* Ensure buttons are visible when chat step is shown */
#eurotsi-chat-step-chat:not(.eurotsi-chat__step--hidden) .eurotsi-chat__bottom-buttons {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 30px !important;
  position: relative !important;
  z-index: 10 !important;
}

#eurotsi-chat-step-chat:not(.eurotsi-chat__step--hidden) .eurotsi-chat__end {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 28px !important;
  position: relative !important;
}

#eurotsi-chat-step-chat:not(.eurotsi-chat__step--hidden) .eurotsi-chat__quote-btn {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 28px !important;
}

.eurotsi-chat__h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  color: #111827;
}

.eurotsi-chat__intro {
  margin: 8px 0 14px;
  font-size: 13px;
  color: rgba(17,24,39,0.8);
}

.eurotsi-chat__form {
  display: grid;
  gap: 10px;
}

.eurotsi-chat__label {
  font-size: 12px;
  font-weight: 800;
  color: #111827;
  margin-top: 4px;
}

.eurotsi-chat__input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(0,0,0,0.16);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  background: #fff;
}

.eurotsi-chat__error {
  min-height: 18px;
  color: #b91c1c;
  font-size: 12px;
}

.eurotsi-chat__primary {
  margin-top: 6px;
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 12px;
  cursor: pointer;
  font-weight: 900;
  background: #111827;
  color: #fff;
}

.eurotsi-chat__fineprint {
  margin: 6px 0 0;
  font-size: 11px;
  color: rgba(17,24,39,0.60);
  line-height: 1.35;
}

/* ===== Connecting animation ===== */
.eurotsi-chat__connecting {
  height: 100%;
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  padding: 10px;
}

.eurotsi-chat__connect-anim {
  position: relative;
  width: 120px;
  height: 120px;
}

.eurotsi-chat__ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid rgba(17,24,39,0.10);
  animation: eurotsiPulse 1.8s ease-in-out infinite;
}
.eurotsi-chat__ring--2 { inset: 10px; animation-delay: .18s; }
.eurotsi-chat__ring--3 { inset: 20px; animation-delay: .36s; }

@keyframes eurotsiPulse {
  0%   { transform: scale(0.96); opacity: 0.55; }
  50%  { transform: scale(1.03); opacity: 0.90; }
  100% { transform: scale(0.96); opacity: 0.55; }
}

.eurotsi-chat__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(17,24,39,0.75);
  transform: translate(-50%, -50%);
  animation: eurotsiOrbit 1.2s linear infinite;
}
.eurotsi-chat__dot--2 { animation-delay: .2s; opacity: 0.75; }
.eurotsi-chat__dot--3 { animation-delay: .4s; opacity: 0.55; }

@keyframes eurotsiOrbit {
  from { transform: translate(-50%, -50%) rotate(0deg) translateX(38px) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg) translateX(38px) rotate(-360deg); }
}

.eurotsi-chat__connecting-text {
  font-size: 14px;
  font-weight: 900;
  color: #111827;
}
.eurotsi-chat__connecting-sub {
  font-size: 12px;
  color: rgba(17,24,39,0.65);
}

/* ===== Chat controls / End Chat ===== */
.eurotsi-chat__chat-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.eurotsi-chat__quote-btn {
  appearance: none;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.08);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  color: #3b82f6;
  padding: 6px 12px;
  border-radius: 10px;
  transition: all 0.15s ease;
  display: none; /* Hidden by default, shown when connected */
  flex: 1;
  margin-top: 0;
  height: auto !important;
  min-height: 28px !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.eurotsi-chat__quote-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.5);
  color: #2563eb;
}

.eurotsi-chat__quote-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.eurotsi-chat__composer-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eurotsi-chat__bottom-buttons {
  display: flex !important;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 30px !important;
}

.eurotsi-chat__end {
  appearance: none;
  border: 0;
  background: rgba(0,0,0,0.05);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  color: rgba(17,24,39,0.70);
  padding: 6px 10px;
  border-radius: 10px;
  flex-shrink: 0;
  display: block !important; /* Always visible when in chat */
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 28px !important;
  width: auto !important;
}

.eurotsi-chat__end:hover {
  background: rgba(0,0,0,0.08);
  color: #111827;
}

/* ===== Messages ===== */
.eurotsi-chat__messages {
  height: calc(100% - 120px); /* Increased from 54px to account for buttons */
  overflow: auto;
  padding: 10px 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eurotsi-chat__msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.eurotsi-chat__msg--user { justify-content: flex-end; }
.eurotsi-chat__msg--agent { justify-content: flex-start; }

.eurotsi-chat__bubble {
  max-width: 78%;
  min-width: fit-content;
  width: fit-content;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
  /* Only break very long words, keep short words together */
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}

.eurotsi-chat__msg--user .eurotsi-chat__bubble {
  background: #111827;
  color: #fff;
  border-bottom-right-radius: 6px;
}
.eurotsi-chat__msg--user .eurotsi-chat__bubble a {
  color: #60a5fa;
  text-decoration: underline;
}
.eurotsi-chat__msg--user .eurotsi-chat__bubble a:hover {
  color: #93c5fd;
}
.eurotsi-chat__msg--agent .eurotsi-chat__bubble {
  background: #f3f4f6;
  color: #111827;
  border-bottom-left-radius: 6px;
}
.eurotsi-chat__msg--agent .eurotsi-chat__bubble a {
  color: #2563eb;
  text-decoration: underline;
}
.eurotsi-chat__msg--agent .eurotsi-chat__bubble a:hover {
  color: #1d4ed8;
}

.eurotsi-chat__meta {
  font-size: 11px;
  color: rgba(17,24,39,0.55);
  margin-top: 2px;
}

/* ===== Inline Images ===== */
.eurotsi-chat__images {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.eurotsi-chat__image-container {
  display: flex;
  justify-content: flex-start;
}

.eurotsi-chat__inline-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.eurotsi-chat__msg--agent .eurotsi-chat__inline-image {
  max-width: 280px;
}

@media (max-width: 420px) {
  .eurotsi-chat__inline-image {
    max-height: 200px;
  }
  
  .eurotsi-chat__msg--agent .eurotsi-chat__inline-image {
    max-width: 100%;
  }
}

/* ===== Product Recommendations ===== */
.eurotsi-chat__products {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.eurotsi-chat__product-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  max-width: 100%;
  cursor: default; /* Not clickable */
}

.eurotsi-chat__product-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
  background: #f9fafb;
  flex-shrink: 0;
}

.eurotsi-chat__product-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.eurotsi-chat__product-name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.eurotsi-chat__product-model {
  font-size: 12px;
  color: rgba(17, 24, 39, 0.7);
  line-height: 1.4;
}

.eurotsi-chat__product-price {
  font-size: 16px;
  font-weight: 900;
  color: #111827;
  margin-top: 4px;
}

.eurotsi-chat__msg--agent .eurotsi-chat__product-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

@media (max-width: 420px) {
  .eurotsi-chat__product-card {
    padding: 10px;
    gap: 10px;
  }
  
  .eurotsi-chat__product-image {
    width: 60px;
    height: 60px;
  }
  
  .eurotsi-chat__product-name {
    font-size: 13px;
  }
  
  .eurotsi-chat__product-price {
    font-size: 15px;
  }
}

/* Typing */
.eurotsi-chat__typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 8px 8px;
}
.eurotsi-chat__typing--hidden { display: none; }

.eurotsi-chat__typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: rgba(17,24,39,0.35);
  animation: eurotsiDot 1.1s infinite ease-in-out;
}
.eurotsi-chat__typing-dot:nth-child(2) { animation-delay: .15s; }
.eurotsi-chat__typing-dot:nth-child(3) { animation-delay: .30s; }

@keyframes eurotsiDot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-3px); opacity: 0.9; }
}

.eurotsi-chat__typing-label {
  font-size: 12px;
  color: rgba(17,24,39,0.65);
  margin-left: 4px;
}

/* Composer */
.eurotsi-chat__composer {
  height: 44px;
  display: flex;
  gap: 8px;
  border-top: 1px solid rgba(0,0,0,0.08);
  padding: 8px;
  box-sizing: border-box;
  align-items: center;
}

.eurotsi-chat__composer-input {
  flex: 1;
  height: 34px;
  border: 1px solid rgba(0,0,0,0.16);
  border-radius: 12px;
  padding: 0 10px;
  font-size: 14px;
}

.eurotsi-chat__composer-send {
  height: 34px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 900;
  background: #111827;
  color: #fff;
}

.eurotsi-chat__composer-input:disabled,
.eurotsi-chat__composer-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ===== Thank You Screen ===== */
.eurotsi-chat__thankyou {
  height: 100%;
  display: grid;
  place-items: center;
  gap: 16px;
  text-align: center;
  padding: 40px 20px;
}

.eurotsi-chat__thankyou-icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 900;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.25);
}

.eurotsi-chat__thankyou-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(17, 24, 39, 0.8);
  max-width: 320px;
}

.eurotsi-chat__thankyou .eurotsi-chat__primary {
  margin-top: 8px;
}

/* ===== Thread Selection Screen ===== */
.eurotsi-chat__threads-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  max-height: 300px;
  overflow-y: auto;
}

.eurotsi-chat__thread-item {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.eurotsi-chat__thread-item:hover {
  border-color: rgba(0, 0, 0, 0.2);
  background: #f9fafb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.eurotsi-chat__thread-preview {
  font-size: 13px;
  color: #111827;
  line-height: 1.4;
  margin-bottom: 4px;
  pointer-events: none;
}

.eurotsi-chat__thread-meta {
  font-size: 11px;
  color: rgba(17, 24, 39, 0.6);
  pointer-events: none;
}

.eurotsi-chat__secondary {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 12px;
  padding: 12px 12px;
  cursor: pointer;
  font-weight: 900;
  background: #fff;
  color: #111827;
  width: 100%;
  margin-top: 8px;
}

.eurotsi-chat__secondary:hover {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.24);
}

/* ===== Guide Quote Display ===== */
.eurotsi-chat__quote {
  height: 100%;
  overflow-y: auto;
  padding: 16px;
}

.eurotsi-chat__quote-disclaimer {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}

.eurotsi-chat__quote-disclaimer strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.eurotsi-chat__quote-disclaimer ul {
  margin: 8px 0;
  padding-left: 20px;
}

.eurotsi-chat__quote-disclaimer li {
  margin: 4px 0;
}

.eurotsi-chat__quote-disclaimer a {
  color: #92400e;
  text-decoration: underline;
  font-weight: 700;
}

.eurotsi-chat__quote-note {
  font-size: 12px;
  color: rgba(17, 24, 39, 0.7);
  margin: 8px 0 16px;
  font-style: italic;
}

.eurotsi-chat__quote-content {
  margin-bottom: 16px;
}

.eurotsi-chat__quote-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.eurotsi-chat__quote-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.eurotsi-chat__quote-item-name {
  font-weight: 700;
  font-size: 13px;
  color: #111827;
  flex: 1;
  margin-right: 12px;
}

.eurotsi-chat__quote-item-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: rgba(17, 24, 39, 0.6);
  margin-right: 12px;
}

.eurotsi-chat__quote-item-total {
  font-weight: 900;
  font-size: 14px;
  color: #111827;
  white-space: nowrap;
}

.eurotsi-chat__quote-section {
  margin: 16px 0;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.eurotsi-chat__quote-section-title {
  font-weight: 800;
  font-size: 13px;
  color: #111827;
  margin-bottom: 8px;
}

.eurotsi-chat__quote-info {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  color: rgba(17, 24, 39, 0.7);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.eurotsi-chat__quote-info span:first-child {
  font-weight: 700;
  color: rgba(17, 24, 39, 0.8);
}

.eurotsi-chat__quote-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  color: #111827;
}

.eurotsi-chat__quote-line--total {
  font-weight: 900;
  font-size: 16px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 2px solid rgba(0, 0, 0, 0.12);
}

.eurotsi-chat__quote-notes {
  margin-top: 16px;
  padding: 12px;
  background: #fef3c7;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}

.eurotsi-chat__quote-text {
  font-size: 14px;
  line-height: 1.6;
  color: #111827;
}

.eurotsi-chat__quote-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.eurotsi-chat__quote-actions .eurotsi-chat__primary {
  text-decoration: none;
  text-align: center;
  display: block;
}

@media (max-width: 420px) {
  .eurotsi-chat__panel {
    width: calc(100vw - 36px);
    height: min(600px, calc(100vh - 120px));
    right: 18px;
    bottom: 72px;
  }
}

