/* chatbot.css */
/* Modern, Premium Chatbot Widget for ETP */

:root {
  --chat-primary: #2c3e50;
  --chat-primary-light: #34495e;
  --chat-secondary: #d64646;
  --chat-secondary-light: #e74c3c;
  --chat-bg: #ffffff;
  --chat-text: #333333;
  --chat-text-muted: #777777;
  --chat-bubble-user: #e8ecef;
  --chat-bubble-agent: rgba(44, 62, 80, 0.08);
  --chat-border: #e0e6ed;
  --chat-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  --chat-radius: 16px;
  --chat-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Floating Chat Toggle Button */
#etp-chat-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-secondary) 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 5px 20px rgba(214, 70, 70, 0.4);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: var(--chat-transition);
}

#etp-chat-toggle:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 25px rgba(214, 70, 70, 0.6);
}

#etp-chat-toggle:active {
  transform: scale(0.95);
}

/* Notification badge on toggle button */
#etp-chat-toggle .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background-color: var(--chat-secondary);
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: none;
}

#etp-chat-toggle.has-unread .badge {
  display: block;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(214, 70, 70, 0.7); }
  70% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(214, 70, 70, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(214, 70, 70, 0); }
}

/* Chat Widget Container */
#etp-chat-widget {
  position: fixed;
  bottom: 105px;
  right: 30px;
  width: 380px;
  height: 580px;
  background-color: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--chat-border);
  transform: translateY(30px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: var(--chat-transition);
  font-family: 'Montserrat', sans-serif;
}

#etp-chat-widget.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Chat Header */
.etp-chat-header {
  background: linear-gradient(135deg, var(--chat-primary) 0%, #1e2b37 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.etp-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.etp-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.etp-chat-title-group {
  display: flex;
  flex-direction: column;
}

.etp-chat-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
}

.etp-chat-status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 5px;
}

.etp-chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #95a5a6; /* Offline gray */
}

.etp-chat-status-dot.online {
  background-color: #2ecc71; /* Online green */
  box-shadow: 0 0 8px #2ecc71;
}

.etp-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.etp-chat-close:hover {
  color: #ffffff;
}

/* Chat Body (Messages Pane) */
.etp-chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: #fafbfc;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat Body */
.etp-chat-body::-webkit-scrollbar {
  width: 6px;
}
.etp-chat-body::-webkit-scrollbar-track {
  background: transparent;
}
.etp-chat-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}
.etp-chat-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* Chat Messages */
.etp-msg-row {
  display: flex;
  width: 100%;
  margin-bottom: 2px;
}

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

.etp-msg-row.bot, .etp-msg-row.agent {
  justify-content: flex-start;
}

.etp-msg-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}

.etp-msg-row.user .etp-msg-bubble {
  background-color: var(--chat-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 5px rgba(44, 62, 80, 0.15);
}

.etp-msg-row.bot .etp-msg-bubble, .etp-msg-row.agent .etp-msg-bubble {
  background-color: #ffffff;
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--chat-border);
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.etp-msg-meta {
  font-size: 10px;
  color: var(--chat-text-muted);
  margin-top: 4px;
  display: block;
}

.etp-msg-row.user .etp-msg-meta {
  text-align: right;
}

/* Sequential Buttons (Options inside the chat) */
.etp-chat-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
  width: 85%;
  align-self: flex-start;
}

.etp-option-btn {
  background-color: #ffffff;
  color: var(--chat-primary);
  border: 1px solid var(--chat-primary);
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: var(--chat-transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.etp-option-btn:hover {
  background-color: var(--chat-primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(44, 62, 80, 0.15);
}

.etp-option-btn:active {
  transform: translateY(0);
}

/* Typing Indicator Styling */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
  background-color: #ffffff;
  border: 1px solid var(--chat-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--chat-primary);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Chat Footer (Input Area) */
.etp-chat-footer {
  padding: 15px;
  background-color: #ffffff;
  border-top: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.etp-chat-input-wrapper {
  display: flex;
  align-items: center;
  background-color: #f1f3f5;
  border-radius: 24px;
  padding: 5px 15px;
  border: 1px solid transparent;
  transition: var(--chat-transition);
}

.etp-chat-input-wrapper:focus-within {
  border-color: var(--chat-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

#etp-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--chat-text);
  outline: none;
  font-family: inherit;
}

#etp-chat-send {
  background: none;
  border: none;
  color: var(--chat-primary);
  cursor: pointer;
  font-size: 16px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--chat-transition);
  border-radius: 50%;
}

#etp-chat-send:hover {
  color: var(--chat-secondary);
  background-color: rgba(214, 70, 70, 0.05);
}

#etp-chat-send:disabled {
  color: #adb5bd;
  cursor: not-allowed;
  background: transparent;
}

/* Chat Form inputs inside Chat body (for Booking Consultations) */
.etp-chat-form {
  background-color: #ffffff;
  border: 1px solid var(--chat-border);
  padding: 15px;
  border-radius: 12px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.etp-chat-form h4 {
  margin: 0 0 5px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--chat-primary);
}

.etp-chat-form label {
  font-size: 11px;
  font-weight: 600;
  color: var(--chat-text-muted);
  display: block;
  margin-bottom: 3px;
}

.etp-chat-form input, .etp-chat-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 12.5px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.etp-chat-form input:focus, .etp-chat-form textarea:focus {
  border-color: var(--chat-primary);
}

.etp-chat-form button {
  background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-secondary) 100%);
  color: #ffffff;
  border: none;
  padding: 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 5px;
  transition: opacity 0.2s;
}

.etp-chat-form button:hover {
  opacity: 0.95;
}

/* Utilities */
.chat-feedback-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chat-feedback-btn {
  padding: 6px 12px;
  border-radius: 15px;
  border: 1px solid var(--chat-border);
  background-color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-feedback-btn:hover {
  background-color: var(--chat-primary);
  color: #ffffff;
  border-color: var(--chat-primary);
}

.chat-feedback-btn.secondary:hover {
  background-color: var(--chat-secondary);
  border-color: var(--chat-secondary);
}

.chat-system-status {
  text-align: center;
  font-size: 11px;
  color: var(--chat-text-muted);
  margin: 5px 0;
  font-style: italic;
  width: 100%;
}

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

.chat-transcript-download {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.chat-transcript-download:hover {
  color: #ffffff;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #etp-chat-widget {
    bottom: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
  }
  #etp-chat-toggle {
    bottom: 15px;
    right: 15px;
  }
}
