/* ===== DanTech Chat Modal ===== */

.dtchat-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dtchat-overlay--open {
  opacity: 1;
  visibility: visible;
}

.dtchat-overlay--open .dtchat-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Modal */
.dtchat-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 85vh;
  max-height: 700px;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(145deg, #0a0e17, #0d1321);
  border: 1px solid rgba(1, 168, 242, 0.15);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(1, 168, 242, 0.08);
  transform: scale(0.95) translateY(20px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
}

/* Header */
.dtchat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 19, 33, 0.8);
}

.dtchat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dtchat-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.dtchat-brand {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #01A8F2, #02B0D5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dtchat-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dtchat-header-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dtchat-header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.dtchat-header-btn svg {
  width: 20px;
  height: 20px;
}

/* Progress bar */
.dtchat-progress {
  flex-shrink: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.dtchat-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #01A8F2, #02B0D5);
  border-radius: 0 2px 2px 0;
  transition: width 0.4s ease-out;
}

/* Messages Area */
.dtchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dtchat-messages::-webkit-scrollbar {
  width: 4px;
}

.dtchat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.dtchat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Message */
.dtchat-msg {
  display: flex;
  gap: 10px;
  animation: dtchat-fadeIn 0.3s ease forwards;
}

.dtchat-msg--user {
  flex-direction: row-reverse;
}

@keyframes dtchat-fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Avatar */
.dtchat-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #01A8F2, #02B0D5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dtchat-avatar svg {
  width: 16px;
  height: 16px;
  color: #fff;
}

/* Bubbles */
.dtchat-bubble {
  max-width: 85%;
  border-radius: 16px;
  padding: 10px 16px;
}

.dtchat-bubble p {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.dtchat-bubble--bot {
  background: rgba(1, 168, 242, 0.15);
  border: 1px solid rgba(1, 168, 242, 0.25);
  color: #fff;
}

.dtchat-bubble--user {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}

/* Typing dots */
.dtchat-dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.dtchat-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  animation: dtchat-bounce 1.2s infinite;
}

.dtchat-dots span:nth-child(2) { animation-delay: 0.2s; }
.dtchat-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dtchat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Interaction area (input / options) */
.dtchat-interaction {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 19, 33, 0.6);
  min-height: 20px;
}

/* Input row */
.dtchat-input-row {
  display: flex;
  gap: 8px;
}

.dtchat-input-row input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-text-size-adjust: 100%;
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.dtchat-input-row input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.dtchat-input-row input:focus {
  border-color: rgba(1, 168, 242, 0.5);
}

.dtchat-input-row button {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #01A8F2, #1760AD);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
}

.dtchat-input-row button:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.dtchat-input-row button svg {
  width: 20px;
  height: 20px;
}

/* Error */
.dtchat-error {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: #f87171;
  margin-top: 6px;
  min-height: 1em;
}

/* Option buttons */
.dtchat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dtchat-option-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.dtchat-option-btn:hover {
  background: rgba(1, 168, 242, 0.15);
  border-color: rgba(1, 168, 242, 0.4);
  transform: translateY(-1px);
}

.dtchat-option-btn:active {
  transform: scale(0.97);
}

/* Confirmation summary */
.dtchat-summary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

.dtchat-summary-row {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  padding: 4px 0;
  line-height: 1.5;
}

.dtchat-summary-row strong {
  color: #fff;
}

/* Confirm button */
.dtchat-confirm-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #01A8F2, #1760AD);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.dtchat-confirm-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.dtchat-confirm-btn:active {
  transform: scale(0.98);
}

.dtchat-confirm-btn svg {
  width: 20px;
  height: 20px;
}

/* WhatsApp button */
.dtchat-whatsapp-btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s, transform 0.15s;
}

.dtchat-whatsapp-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.dtchat-whatsapp-btn:active {
  transform: scale(0.98);
}

.dtchat-whatsapp-btn svg {
  width: 20px;
  height: 20px;
}

/* ===== Responsive ===== */

@media (max-width: 600px) {
  .dtchat-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .dtchat-modal {
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .dtchat-bubble {
    max-width: 90%;
  }

  .dtchat-option-btn {
    padding: 10px 14px;
    font-size: 16px;
  }

  .dtchat-input-row input {
    font-size: 16px;
  }

  .dtchat-bubble p {
    font-size: 14px;
  }

  select, textarea, input {
    font-size: 16px !important;
  }
}

@media (max-width: 380px) {
  .dtchat-brand {
    font-size: 0.95rem;
  }

  .dtchat-logo {
    height: 26px;
  }
}
