/* ─────────────────────────────────────────────────────────────
   Chat Widget Styles - Modern Minimalist Design
   ───────────────────────────────────────────────────────────── */

:root {
  --primary-blue: #0066cc;
  --light-blue: #3898ff;
  --white: #ffffff;
  --text-dark: #1a1a1a;
  --text-light: #666666;
}

.chat-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

/* ─── Chat Button - Minimalist Circle ────────────────────────── */
.chat-widget-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--light-blue);
  border: none;
  color: var(--white);
  font-size: 32px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chat-widget-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 102, 204, 0.25);
  background: #0052a3;
}

.chat-widget-button:active {
  transform: translateY(0);
}

/* Notification badge */
.chat-widget-button.has-unread::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 16px;
  height: 16px;
  background: #ff3b30;
  border-radius: 50%;
  border: 2px solid white;
}

/* ─── Quick Questions Panel ──────────────────────────────────── */
.quick-questions-panel {
  position: fixed;
  bottom: 120px;
  right: 24px;
  width: auto;
  max-height: 500px;
  background: transparent;
  border-radius: 12px;
  box-shadow: none;
  overflow: visible;
  opacity: 1;
  visibility: visible;
  transition: all 0.3s ease;
  z-index: 9998;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.quick-questions-header {
  display: none;
}

.quick-questions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  align-items: flex-end;
}

.quick-question-btn {
  padding: 12px 14px;
  border: none;
  background: var(--light-blue);
  cursor: pointer;
  transition: all 0.2s;
  text-align: right;
  font-family: inherit;
  color: var(--white);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  border-radius: 6px;
  width: fit-content;
  text-shadow: none;
}

.quick-question-btn:hover {
  background: #cce0ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.quick-question-btn:active {
  background: #b3d9ff;
  transform: translateY(0);
}

.quick-question-btn i {
  display: none;
}

/* Hide questions panel when chat is open */
.chat-widget-window.open + #quickQuestionsPanel,
.chat-widget-container .chat-widget-window.open ~ #quickQuestionsPanel {
  display: none;
}

/* ─── Chat Window - Card-Based Design ───────────────────────── */
.chat-widget-window {
  position: absolute;
  bottom: 120px;
  right: 0;
  width: 420px;
  height: 680px;
  background: var(--white);
  border-radius: 15px;
  box-shadow: 0 5px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-widget-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .chat-widget-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 140px);
    bottom: 120px;
    left: 8px;
    right: auto;
  }

  .quick-questions-panel {
    width: calc(100vw - 16px);
    bottom: 120px;
    left: 8px;
    right: auto;
  }

  .chat-widget-container {
    bottom: 16px;
    right: 8px;
  }
}

/* ─── Chat Header - Blue Background with Avatar ──────────────── */
.chat-widget-header {
  background: var(--primary-blue);
  color: var(--white);
  padding: 20px;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.chat-widget-header::before {
  content: '';
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.chat-widget-header > div {
  flex: 1;
}

.chat-widget-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.chat-widget-header p {
  margin: 4px 0 0 0;
  font-size: 12px;
  opacity: 0.85;
  font-weight: 400;
}

.chat-widget-close-btn {
  background: none;
  border: none;
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  border-radius: 6px;
}

.chat-widget-close-btn:hover {
  opacity: 0.7;
  background: rgba(255, 255, 255, 0.1);
}

/* ─── Chat Messages - Clean Spacing ──────────────────────────── */
.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: flex;
  gap: 8px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 4px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.visitor {
  justify-content: flex-end;
}

.chat-message > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.chat-message.visitor > div {
  align-items: flex-end;
}

.chat-message-content {
  max-width: 70%;
  padding: 12px 14px;
  border-radius: 10px;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 14px;
  line-height: 1.42;
  white-space: pre-wrap;
}

.chat-message.staff .chat-message-content {
  background: var(--light-blue);
  color: var(--text-dark);
  border: none;
}

.chat-message.visitor .chat-message-content {
  background: var(--primary-blue);
  color: var(--white);
  border-radius: 10px;
}

.chat-message-time {
  font-size: 11px;
  color: var(--text-light);
  align-self: flex-end;
  margin-top: 2px;
}

/* ─── System Messages ────────────────────────────────────────── */
.chat-message.system {
  justify-content: center;
  margin: 0;
}

.chat-message.system .chat-message-content {
  background: transparent;
  color: var(--text-dark);
  font-size: 14px;
  padding: 0;
  text-align: center;
  font-weight: 500;
}

.chat-message.system .chat-message-content p {
  margin: 0;
  line-height: 1.5;
}

.chat-message.system .chat-message-content p:first-child {
  font-size: 24px;
  margin-bottom: 8px;
}

/* ─── Chat Input Area ─────────────────────────────────────────── */
.chat-widget-input-area {
  border-top: 1px solid #e8e8e8;
  padding: 16px;
  background: var(--white);
  min-height: 70px;
  display: flex;
  flex-direction: column;
}

/* ─── First Message Modal - Card Design ──────────────────────── */
.chat-widget-first-message {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 24px;
}

.first-message-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.first-message-form h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: var(--text-dark);
  font-weight: 600;
  letter-spacing: -0.2px;
}

.first-message-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  background: var(--white);
}

.first-message-form input::placeholder {
  color: #999;
}

.first-message-form input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.08);
}

.btn-continue {
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 4px;
}

.btn-continue:hover {
  background: #0052a3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.btn-continue:active {
  transform: translateY(0);
}

/* ─── Email Validation Modal ─────────────────────────────────── */
.chat-widget-email-validation {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 24px;
}

.email-validation-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.email-validation-form h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: var(--text-dark);
  font-weight: 600;
  letter-spacing: -0.2px;
}

.email-validation-form p {
  margin: 0;
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.4;
}

.email-validation-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  background: var(--white);
}

.email-validation-form input::placeholder {
  color: #999;
}

.email-validation-form input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.08);
}
}

.btn-continue:hover {
  background: #0052a3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.btn-continue:active {
  transform: translateY(0);
}

/* ─── Message Input Form ──────────────────────────────────────── */
.chat-widget-input-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  width: 100%;
}

.chat-widget-input-form textarea {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  min-height: 44px;
  max-height: 44px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  background: var(--white);
  line-height: 1.4;
}

.chat-widget-input-form textarea::placeholder {
  color: #999;
}

.chat-widget-input-form textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.08);
}

.chat-widget-send-btn {
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-widget-send-btn:hover:not(:disabled) {
  background: #0052a3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.chat-widget-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Scrollbar - Custom ────────────────────────────────────── */
.chat-widget-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-widget-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 102, 204, 0.2);
  border-radius: 3px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 102, 204, 0.4);
}
/* ─── Loading Indicator ──────────────────────────────────────────────────── */
.typing-indicator {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #4a4a4a;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.5;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-8px);
  }
}
