/* Bahthy Chat App — messenger-style UI */

.modal-box.chat-box .modal-head {
  display: none !important;
}

.modal.show:has(.modal-box.chat-box) {
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
}

.modal-box.chat-box {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: var(--bg-primary) !important;
}

.modal-box.chat-box #modalBody {
  flex: 1 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.chat-pro-shell--solo,
.chat-container-advanced.chat-pro-shell--solo {
  flex: 1 !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
}

.chat-pro-sidebar--hidden,
.chat-pro-sidebar {
  display: none !important;
}

.chat-pro-main {
  flex: 1 !important;
  min-height: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  border: none !important;
  border-radius: 0 !important;
  background:
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(233, 69, 96, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 0% 100%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    var(--bg-primary) !important;
}

.chat-main-topbar {
  display: none !important;
}

.chat-app-header {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top, 0px)) 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 12, 20, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 5;
}

.chat-app-close {
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.chat-app-close--text {
  width: auto;
}
.chat-app-close svg {
  stroke: #f87171;
}
.chat-app-close:active {
  transform: scale(0.96);
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(248, 113, 113, 0.65);
}

.chat-app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-content: center;
}

.chat-app-avatar {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(233, 69, 96, 0.22), rgba(99, 102, 241, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.chat-app-avatar svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
}

.chat-app-brand-text {
  min-width: 0;
  text-align: start;
}

.chat-app-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.chat-app-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.chat-app-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.chat-app-header-end {
  width: 44px;
  height: 44px;
}

.chat-pro-messages {
  flex: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px 8px !important;
  gap: 14px !important;
}

.chat-empty-state {
  display: none !important;
}

.chat-pro-typing {
  position: static !important;
  bottom: auto !important;
  right: auto !important;
  align-self: flex-end;
  margin: 0 14px 6px;
  flex-shrink: 0;
}

.chat-typing-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chat-pro-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 10, 18, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.chat-escalate-pill {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.38);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(234, 88, 12, 0.1));
  color: #fcd34d;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.chat-escalate-pill:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(234, 88, 12, 0.14));
  border-color: rgba(251, 191, 36, 0.5);
}
.chat-escalate-pill:disabled {
  opacity: 0.6;
  cursor: wait;
}
.chat-escalate-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-escalate-pill-icon svg {
  width: 18px;
  height: 18px;
  stroke: #fbbf24;
}
.chat-escalate-pill-text {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-avatar-icon {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
  flex-shrink: 0;
}

.chat-pro-compose {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.chat-pro-compose .chat-pro-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  padding: 0 12px !important;
  margin: 0 !important;
  line-height: 40px;
  border: none !important;
  border-radius: 999px !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 15px;
  box-sizing: border-box;
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #f8fafc;
}

.chat-pro-compose .chat-pro-input::placeholder {
  color: rgba(248, 250, 252, 0.45) !important;
  -webkit-text-fill-color: rgba(248, 250, 252, 0.45) !important;
  opacity: 1;
}

.modal-box.chat-box .chat-pro-input {
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #f8fafc;
}

.chat-pro-compose .chat-pro-input:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.chat-escalate-btn--mini {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 999px;
  flex-shrink: 0;
}

.chat-pro-compose .chat-pro-voice,
.chat-pro-compose .chat-pro-send {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  flex-shrink: 0;
}

.chat-pro-compose .chat-pro-voice.recording {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: rgba(248, 113, 113, 0.55) !important;
  color: #f87171 !important;
  animation: chatMicPulse 1.4s ease-in-out infinite;
}

.chat-pro-compose .chat-pro-voice.speaking {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: rgba(74, 222, 128, 0.45) !important;
  color: #4ade80 !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

@keyframes chatMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.chat-pro-compose .chat-pro-send {
  box-shadow: 0 6px 18px rgba(233, 69, 96, 0.28) !important;
}

.chat-bubble-row {
  max-width: min(92%, 480px);
}

@media (min-width: 769px) {
  .modal.show:has(.modal-box.chat-box) {
    padding: 16px !important;
    align-items: center !important;
  }

  .modal-box.chat-box {
    width: min(100vw, 480px) !important;
    max-width: 480px !important;
    height: min(92vh, 760px) !important;
    max-height: min(92vh, 760px) !important;
    border-radius: 22px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45) !important;
    overflow: hidden !important;
  }

  .chat-pro-main {
    border-radius: 0 0 22px 22px;
  }
}

@media (max-width: 768px) {
  .chat-escalate-pill {
    font-size: 0.72rem;
    padding: 8px 10px;
    gap: 6px;
  }

  .chat-pro-compose .chat-pro-input {
    font-size: 16px;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    line-height: 42px;
  }

  .chat-escalate-btn--mini,
  .chat-pro-compose .chat-pro-voice,
  .chat-pro-compose .chat-pro-send {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
  }
}
