/* TaxiDriver chat — alineado a piel Veracruz (gris frío + rojo), no beige WhatsApp */
.td-wa {
  --td-wa-bg: #f4f6f8;
  --td-wa-pattern:
    radial-gradient(circle at 12% 18%, rgba(200, 16, 46, 0.05) 0 1.5px, transparent 2px),
    radial-gradient(circle at 72% 64%, rgba(15, 23, 42, 0.04) 0 1.2px, transparent 2px),
    linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
  --td-wa-mine: #ffe4e8;
  --td-wa-theirs: #ffffff;
  --td-wa-head: linear-gradient(180deg, #9f1239, #7f1d1d);
  --td-wa-send: linear-gradient(135deg, #e11d48, #be123c);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.td-wa-head {
  height: 52px;
  padding: 8px 12px;
  background: var(--td-wa-head);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.td-wa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fecaca;
  color: #7f1d1d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  font-size: 14px;
}

.td-wa-title {
  flex: 1;
  min-width: 0;
}

.td-wa-title b {
  display: block;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.td-wa-title span {
  display: block;
  font-size: 11px;
  opacity: 0.85;
}

.td-wa .chat-messages,
.td-wa-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: auto;
  padding: 12px 10px 14px;
  max-height: none;
  min-height: 180px;
  background-color: var(--td-wa-bg);
  background-image: var(--td-wa-pattern);
}

.operator-chat-thread.td-wa .chat-messages,
.td-wa .chat-messages {
  max-height: 360px;
}

.passenger-support-chat.td-wa .chat-messages,
.passenger-hub-trip-chat.td-wa .chat-messages,
.driver-hub-trip-chat.td-wa .chat-messages {
  max-height: 260px;
  min-height: 160px;
}

.td-wa .chat-empty,
.td-wa-note {
  align-self: center;
  max-width: 90%;
  margin: 18px auto;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #64748b;
  font-size: 12px;
  text-align: center;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.td-wa-row {
  display: flex;
  margin: 0 0 4px;
  width: 100%;
}

.td-wa-row.me {
  justify-content: flex-end;
}

.td-wa-row.them {
  justify-content: flex-start;
}

.td-wa-row.system {
  justify-content: center;
}

.td-wa-bubble {
  max-width: 82%;
  padding: 6px 8px 4px;
  border-radius: 8px;
  background: var(--td-wa-theirs);
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
  color: #111b21;
  position: relative;
}

.td-wa-row.me .td-wa-bubble {
  background: var(--td-wa-mine);
  border-top-right-radius: 2px;
}

.td-wa-row.them .td-wa-bubble {
  border-top-left-radius: 2px;
}

.td-wa-row.system .td-wa-bubble {
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  text-align: center;
  max-width: 92%;
  box-shadow: none;
  border: 1px solid #e2e8f0;
}

.td-wa-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #be123c;
  margin-bottom: 2px;
}

.td-wa-row.me .td-wa-name {
  color: #9f1239;
}

.td-wa-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.td-wa-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 10px;
  color: #94a3b8;
  line-height: 1;
}

.td-wa-row.me .td-wa-meta {
  color: #9f1239;
}

.td-wa-ticks {
  font-size: 12px;
  letter-spacing: -1px;
  color: #e11d48;
}

.td-wa .chat-composer,
.td-wa-compose {
  padding: 8px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-top: 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
}

.td-wa .chat-composer input,
.td-wa-compose input,
.td-wa-compose textarea {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 22px;
  padding: 10px 14px;
  outline: none;
  font-size: 16px;
  background: #fff;
  color: #111b21;
  box-shadow: none;
}

.td-wa .chat-composer button,
.td-wa-send {
  width: 42px;
  height: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: var(--td-wa-send);
  color: #fff;
  font-size: 0;
  flex-shrink: 0;
  padding: 0;
  position: relative;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.35);
}

.td-wa .chat-composer button::before,
.td-wa-send::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/%3E%3C/svg%3E");
}

.td-wa .chat-composer button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.td-wa .chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  margin: 0;
  border-top: 1px solid #e2e8f0;
}

.td-wa .chat-quick-replies button {
  border: 1px solid #fecdd3;
  border-radius: 16px;
  padding: 6px 10px;
  background: #fff;
  color: #9f1239;
  font-size: 12px;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Paneles que ya tenían heading propio: ocultar duplicado si usamos td-wa-head */
.td-wa > .panel-heading {
  display: none;
}

.operator-chat-thread.td-wa {
  min-height: 420px;
  border-radius: 14px;
}

.map-chat-dock.td-wa {
  background: transparent;
  border: 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.map-chat-dock.td-wa > header {
  display: none;
}

.td-wa .sound-toggle {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
  padding: 0;
  flex-shrink: 0;
}

.passenger-support-chat.td-wa,
.driver-support-chat.td-wa {
  padding: 0;
  border: 0;
  background: transparent;
}

body:not(.login-active) #passengerView .map-chat-dock.td-wa,
#driverView .map-chat-dock.td-wa {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 0;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
}

body:not(.login-active) #passengerView .map-chat-dock.td-wa .chat-messages,
#driverView .map-chat-dock.td-wa .chat-messages {
  max-height: 180px;
  min-height: 120px;
}

.td-wa .chat-composer {
  display: flex !important;
  grid-template-columns: none !important;
}

.td-wa .chat-composer button {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 0 !important;
  background: var(--td-wa-send) !important;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.35) !important;
}

.td-wa .chat-composer input {
  border: 0 !important;
  border-radius: 22px !important;
  min-height: 42px !important;
  box-shadow: none !important;
}
