/* ==========================================================================
   Easy Platers - Driver Pre-Screen Chatbot Floating Widget
   Matches UI & logic from easyplater.html
   ========================================================================== */

/* ----- Floating Launcher Button ----- */
.ep-chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e6fd9 0%, #155bb5 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(30, 111, 217, 0.4), 0 2px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background 0.25s ease;
  outline: none;
}

.ep-chatbot-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(30, 111, 217, 0.5);
}

.ep-chatbot-launcher:active {
  transform: scale(0.96);
}

.ep-chatbot-launcher .launcher-icon-chat,
.ep-chatbot-launcher .launcher-icon-close {
  position: absolute;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.ep-chatbot-launcher .launcher-icon-chat {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.ep-chatbot-launcher .launcher-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.ep-chatbot-launcher.active .launcher-icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.ep-chatbot-launcher.active .launcher-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Launcher Pill Tooltip */
.ep-chatbot-pill {
  position: fixed;
  bottom: 34px;
  right: 96px;
  background: #ffffff;
  color: #0a2e4e;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 50, 120, 0.12), 0 0 0 1px rgba(30, 111, 217, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 99998;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  animation: epPillFloat 3s ease-in-out infinite;
  white-space: nowrap;
}

.ep-chatbot-pill span.dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: epPulseDot 2s infinite;
}

.ep-chatbot-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 50, 120, 0.18);
}

.ep-chatbot-pill.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px);
}

@keyframes epPulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

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

/* ----- Chatbot Modal Container ----- */
.ep-chatbot-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 440px;
  max-width: calc(100vw - 32px);
  height: 650px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 20px 60px -10px rgba(0, 60, 160, 0.22), 0 0 0 1px rgba(30, 111, 217, 0.1);
  border: 1px solid #d9e8ff;
  display: flex;
  flex-direction: column;
  z-index: 99998;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ep-chatbot-widget.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ----- Widget Header ----- */
.ep-chat-header {
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e0edff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.ep-chat-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ep-chat-header-brand .ep-chat-logo {
  height: 34px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  display: block;
}

.ep-chat-header-brand .brand-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.ep-chat-header-brand .brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0a2e4e;
  letter-spacing: -0.3px;
}

.ep-chat-header-brand .brand-name span {
  color: #1e6fd9;
}

.ep-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ep-chat-counter {
  font-size: 0.8rem;
  color: #4a6f9c;
  background: #e8f0fe;
  padding: 4px 12px;
  border-radius: 40px;
  font-weight: 600;
}

.ep-chat-btn-reset {
  background: #ffffff;
  border: 1px solid #d0e2fc;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.75rem;
  color: #0a2e4e;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
}

.ep-chat-btn-reset:hover {
  background: #f0f7ff;
  border-color: #1e6fd9;
  color: #1e6fd9;
}

.ep-chat-btn-close {
  background: transparent;
  border: none;
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.15s;
  padding: 0;
}

.ep-chat-btn-close:hover {
  background: #f1f5f9;
  color: #0a2e4e;
}

/* Sub-title banner */
.ep-chat-subbar {
  padding: 8px 20px;
  background: #f4f9ff;
  border-bottom: 1px solid #e0edff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #2c3e5c;
  font-weight: 500;
  flex-shrink: 0;
}

.ep-chat-subbar span.sub-title {
  font-weight: 600;
  color: #0a2e4e;
}

/* ----- Messages Area ----- */
.ep-chat-window {
  flex: 1;
  background: #f9fcff;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.ep-chat-window::-webkit-scrollbar {
  width: 5px;
}
.ep-chat-window::-webkit-scrollbar-track {
  background: transparent;
}
.ep-chat-window::-webkit-scrollbar-thumb {
  background: #b8d0ee;
  border-radius: 12px;
}

/* ----- Message Bubbles ----- */
.ep-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: epFadeSlide 0.25s ease;
}

.ep-msg.bot {
  justify-content: flex-start;
}

.ep-msg.user {
  justify-content: flex-end;
}

.ep-msg .bubble {
  max-width: 84%;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0, 80, 200, 0.03);
}

.ep-msg.bot .bubble {
  background: #ffffff;
  color: #0a2e4e;
  border: 1px solid #cfe0f5;
  border-bottom-left-radius: 6px;
  border-left: 3.5px solid #1e6fd9;
}

.ep-msg.user .bubble {
  background: #e8f0fe;
  color: #0a2e4e;
  border-bottom-right-radius: 6px;
  border-right: 3.5px solid #1e6fd9;
}

.ep-msg .dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e8f0fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  color: #1e6fd9;
}

.ep-msg.user .dot {
  background: #d4e4ff;
  order: 1;
}

/* ----- Option Chips ----- */
.ep-options-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 4px;
  animation: epFadeSlide 0.25s ease;
}

.ep-option-chip {
  background: #ffffff;
  border: 1.5px solid #d0e2fc;
  border-radius: 40px;
  padding: 10px 16px;
  color: #0a2e4e;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 4px rgba(0, 80, 200, 0.02);
  width: 100%;
  text-align: left;
}

.ep-option-chip:hover:not(.disabled) {
  border-color: #1e6fd9;
  background: #f0f7ff;
  transform: translateX(2px);
  box-shadow: 0 4px 10px rgba(30, 111, 217, 0.08);
}

.ep-option-chip .marker {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #a0c0e8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: 0.1s;
  font-size: 11px;
  color: transparent;
}

.ep-option-chip.selected .marker {
  border-color: #1e6fd9;
  background: #1e6fd9;
  color: white;
}

.ep-option-chip.selected .marker::after {
  content: "✓";
  color: white;
  font-weight: 700;
}

.ep-option-chip.disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* Free Text Postcode Input */
.ep-freetext-wrapper {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 6px;
  animation: epFadeSlide 0.25s ease;
}

.ep-freetext-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 30px;
  border: 1.5px solid #d0e2fc;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
  background: #ffffff;
  color: #0a2e4e;
  transition: border-color 0.15s;
}

.ep-freetext-input:focus {
  border-color: #1e6fd9;
  box-shadow: 0 0 0 3px rgba(30, 111, 217, 0.15);
}

.ep-freetext-btn {
  background: #1e6fd9;
  color: #ffffff;
  border: none;
  border-radius: 30px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.15s;
}

.ep-freetext-btn:hover {
  background: #155bb5;
}

/* Typing Indicator */
.ep-typing-indicator {
  display: flex;
  gap: 5px;
  padding: 10px 16px;
  background: #ffffff;
  border-radius: 30px;
  width: fit-content;
  border: 1px solid #d0e2fc;
  border-left: 3.5px solid #1e6fd9;
  margin-top: 4px;
}

.ep-typing-indicator span {
  width: 8px;
  height: 8px;
  background: #8ab2e8;
  border-radius: 50%;
  display: inline-block;
  animation: epTypingPulse 1.2s infinite;
}

.ep-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ep-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes epTypingPulse {
  0%, 60%, 100% { opacity: 0.25; transform: scale(0.9); }
  30% { opacity: 1; transform: scale(1.2); }
}

@keyframes epFadeSlide {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ----- Widget Footer Bar ----- */
.ep-chat-footer {
  padding: 12px 18px;
  background: #ffffff;
  border-top: 1px solid #e0edff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.ep-chat-footer-contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #4a6f9c;
}

.ep-chat-footer-contact a {
  color: #1e3a6b;
  text-decoration: none;
  font-weight: 500;
}

.ep-chat-footer-contact a:hover {
  color: #1e6fd9;
}

.ep-chat-btn-apply {
  background: #1e6fd9;
  color: #ffffff !important;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.3px;
  border: none;
  cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 3px 8px rgba(30, 111, 217, 0.25);
  display: inline-block;
  white-space: nowrap;
}

.ep-chat-btn-apply:hover {
  background: #155bb5;
  transform: translateY(-1px);
}

/* Review score and buttons */
.ep-review-register-btn {
  background: #1e6fd9;
  color: #ffffff !important;
  border: none;
  padding: 12px 32px;
  border-radius: 40px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(30, 111, 217, 0.3);
  transition: 0.15s;
  display: inline-block;
  text-decoration: none;
  margin-top: 6px;
}

.ep-review-register-btn:hover {
  background: #155bb5;
  transform: translateY(-1px);
}

/* Mobile responsive */
@media (max-width: 600px) {
  .ep-chatbot-widget {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .ep-chatbot-launcher {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .ep-chatbot-pill {
    bottom: 24px;
    right: 84px;
  }
}
