/* =============================================
   CSS PERSONALIZADO - Chat Yoizen (Joy/Cablevideo)
   Tema: WhatsApp UI — selectores adaptados al HTML real de Yoizen
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');

/* ── Reset base ── */
*, *::before, *::after {
  box-sizing: border-box !important;
}

body, * {
  font-family: 'Lato', sans-serif !important;
}

/* ── Fondo estilo WhatsApp ── */
body {
  background-color: #eae6df !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M0 40 Q20 20 40 40 Q60 60 80 40' stroke='%23c8c0b8' stroke-width='1' fill='none' opacity='.4'/%3E%3Cpath d='M0 20 Q20 0 40 20 Q60 40 80 20' stroke='%23c8c0b8' stroke-width='1' fill='none' opacity='.3'/%3E%3Cpath d='M0 60 Q20 40 40 60 Q60 80 80 60' stroke='%23c8c0b8' stroke-width='1' fill='none' opacity='.3'/%3E%3C/svg%3E") !important;
  background-size: 80px 80px !important;
  background-repeat: repeat !important;
}

/* ── Ocultar barra de botones flotantes ── */
#divButtons {
  display: none !important;
}

/* ════════════════════════════════
   HEADER
════════════════════════════════ */

#divHeader,
nav#divHeader {
  background: linear-gradient(135deg, #075E54 0%, #0a7a6e 100%) !important;
  background-image: linear-gradient(135deg, #075E54 0%, #0a7a6e 100%) !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.28) !important;
  min-height: 62px !important;
  padding: 0 !important;
}

/* Contenedor del navbar como flex */
#divHeader .container-fluid {
  display: flex !important;
  align-items: center !important;
  padding: 8px 12px !important;
  gap: 10px !important;
  min-height: 62px !important;
}

/* ── Avatar / logo circular ── */
#divHeader .navbar-header {
  float: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex: 1 !important;
  padding: 0 !important;
  margin: 0 !important;
}

#divHeader .navbar-brand {
  padding: 0 !important;
  margin: 0 !important;
  height: auto !important;
  line-height: 1 !important;
  background: none !important;
}

/* Logo como avatar circular — NO invertir, mantener colores */
#divHeader .navbar-brand img,
#divHeader img.navbar-brand {
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 2px solid rgba(255,255,255,.3) !important;
  filter: none !important;
  background: #fff !important;
  padding: 2px !important;
  flex-shrink: 0 !important;
}

/* Título y estado "en línea" mediante pseudo-elemento */
#divHeader .navbar-header::after {
  content: 'Soporte Cablevideo\A en línea' !important;
  white-space: pre !important;
  display: flex !important;
  flex-direction: column !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

/* "en línea" (segunda línea del pseudo) */
#divHeader .navbar-header::before {
  display: none !important;
}

/* ── Botón cerrar (sign-out → ×) ── */
#divHeader .navbar-right {
  float: none !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
}

#divHeader .navbar-right li {
  display: flex !important;
  align-items: center !important;
}

#anchorCloseWindow {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,.12) !important;
  color: #fff !important;
  font-size: 0 !important; /* ocultar el fa-sign-out */
  cursor: pointer !important;
  transition: background .15s !important;
  text-decoration: none !important;
}

#anchorCloseWindow::after {
  content: '×' !important;
  font-size: 22px !important;
  font-weight: 300 !important;
  color: #fff !important;
  line-height: 1 !important;
}

#anchorCloseWindow:hover {
  background: rgba(255,255,255,.22) !important;
  text-decoration: none !important;
}

/* Ocultar el ícono interno */
#anchorCloseWindow i {
  display: none !important;
}

/* ════════════════════════════════
   ÁREA DE MENSAJES
════════════════════════════════ */

#divWrap {
  background-color: #eae6df !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M0 40 Q20 20 40 40 Q60 60 80 40' stroke='%23c8c0b8' stroke-width='1' fill='none' opacity='.4'/%3E%3Cpath d='M0 20 Q20 0 40 20 Q60 40 80 20' stroke='%23c8c0b8' stroke-width='1' fill='none' opacity='.3'/%3E%3Cpath d='M0 60 Q20 40 40 60 Q60 80 80 60' stroke='%23c8c0b8' stroke-width='1' fill='none' opacity='.3'/%3E%3C/svg%3E") !important;
  background-size: 80px 80px !important;
  border: none !important;
}

#divMainContainer {
  background: transparent !important;
}

/* Contenedor de mensajes como columna flex */
.messages .container {
  display: flex !important;
  flex-direction: column !important;
  padding: 10px 10px 6px !important;
  gap: 3px !important;
  background: transparent !important;
}

/* ── Estructura base de cada mensaje ── */
.message {
  position: relative !important;
  max-width: 78% !important;
  margin-bottom: 2px !important;
  clear: both !important;
  word-wrap: break-word !important;
  animation: msgAppear .2s ease both !important;
}

/* Flex solo en mensajes reales, NO en el typing (para que Yoizen pueda ocultarlo con JS) */
.message:not(.typing) {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important; /* evita que el time se estire al ancho completo */
}

/* Mensajes del cliente alineados a la derecha */
.message.client:not(.typing) {
  align-items: flex-end !important;
}

@keyframes msgAppear {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Mensajes del bot / yFlow (izquierda) ── */
.message.yflow {
  align-self: flex-start !important;
  float: left !important;
  clear: both !important;
}

.message.yflow .msgtext {
  order: 2 !important;
  background-color: #ffffff !important;
  color: #111 !important;
  border-radius: 8px !important;
  border-top-left-radius: 2px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.13) !important;
  padding: 7px 10px 8px !important;
  font-size: 14.5px !important;
  line-height: 1.45 !important;
  display: inline-block !important;
  position: relative !important;
  min-width: 80px !important;
}

/* Cola de burbuja izquierda (solo en first) */
.message.yflow.first .msgtext::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: -8px !important;
  border: 8px solid transparent !important;
  border-top-color: #ffffff !important;
  border-right: none !important;
}

/* ── Mensajes del cliente / usuario (derecha) ── */
.message.client {
  align-self: flex-end !important;
  float: right !important;
  clear: both !important;
}

.message.client .msgtext {
  order: 2 !important;
  background-color: #d9fdd3 !important;
  color: #111 !important;
  border-radius: 8px !important;
  border-top-right-radius: 2px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.13) !important;
  padding: 7px 10px 8px !important;
  font-size: 14.5px !important;
  line-height: 1.45 !important;
  display: inline-block !important;
  position: relative !important;
  min-width: 60px !important;
}

/* Cola de burbuja derecha (solo en first) */
.message.client.first .msgtext::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  right: -8px !important;
  border: 8px solid transparent !important;
  border-top-color: #d9fdd3 !important;
  border-left: none !important;
}

/* ── Párrafos dentro del mensaje ── */
.message .msgtext p {
  margin: 0 0 4px !important;
}
.message .msgtext p:last-child {
  margin-bottom: 0 !important;
}
.message .msgtext b {
  font-weight: 700 !important;
}

/* ── Timestamp: oculto ── */
.message .time {
  display: none !important;
}

/* ── Nombre del autor (bot): reemplazar "yFlow" → "Cablevideo" ── */
.message.yflow.first .author {
  order: 1 !important;
  font-size: 0 !important;        /* oculta el texto "yFlow" */
  color: transparent !important;
  margin-bottom: 2px !important;
  display: block !important;
}
.message.yflow.first .author::after {
  content: 'Cablevideo' !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #075E54 !important;
}
.message.yflow:not(.first) .author {
  display: none !important;
}

/* ── Ocultar loading spinner ── */
.message.client .loading-icon {
  display: none !important;
}

/* ── Indicador "escribiendo..." ── */
.message.yflow.typing {
  background-color: #ffffff !important;
  border-radius: 8px !important;
  border-top-left-radius: 2px !important;
  padding: 11px 14px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.13) !important;
  /* NO forzar display aquí — Yoizen lo controla con JS */
  align-items: center !important;
  gap: 5px !important;
}

.message.yflow.typing .msgtext {
  display: none !important;
}

.message.yflow.typing span {
  display: inline-block !important;
  width: 8px !important;
  height: 8px !important;
  background-color: #90a4ae !important;
  border-radius: 50% !important;
  animation: typingBounce 1.2s infinite ease-in-out !important;
}
.message.yflow.typing span:nth-child(2) { animation-delay: .2s !important; }
.message.yflow.typing span:nth-child(3) { animation-delay: .4s !important; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Emojis ── */
.message .msgtext img.emoji {
  width: 20px !important;
  height: 20px !important;
  vertical-align: middle !important;
  display: inline !important;
}

/* ── Imágenes en mensajes ── */
.message .msgtext img:not(.emoji) {
  max-width: 100% !important;
  border-radius: 6px !important;
}

/* ── Botones de opciones rápidas ── */
.message.yflow .msgtext a,
.message.yflow .msgtext button,
.message.yflow .msgtext .btn {
  display: block !important;
  width: 100% !important;
  background-color: #ffffff !important;
  border: 1.5px solid #009de2 !important;
  border-radius: 20px !important;
  padding: 8px 16px !important;
  font-size: 13.5px !important;
  color: #009de2 !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  text-align: center !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.1) !important;
  margin: 4px 0 0 !important;
  transition: background .15s, transform .1s !important;
  text-decoration: none !important;
}

.message.yflow .msgtext a:hover,
.message.yflow .msgtext button:hover,
.message.yflow .msgtext .btn:hover {
  background-color: #e8f6ff !important;
  color: #007ab8 !important;
  text-decoration: none !important;
  transform: scale(1.01) !important;
}

/* ════════════════════════════════
   BARRA DE COMPOSICIÓN (INPUT)
════════════════════════════════ */

.compose {
  background-color: #f0f2f5 !important;
  border-top: 1px solid #e0e0e0 !important;
  padding: 8px 10px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-height: 64px !important;
}

/* Ocultar menú hamburguesa (Cerrar Chat) */
.compose .pm {
  display: none !important;
}

/* Botón menú hamburgesa */
.compose .pm .btn,
.compose .pm button {
  background: transparent !important;
  border: none !important;
  color: #54656f !important;
  font-size: 18px !important;
  padding: 8px !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  width: 38px !important;
  height: 38px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.compose .pm .btn:hover,
.compose .pm button:hover {
  background: rgba(0,0,0,.06) !important;
}

/* Botón adjuntar */
.compose .attach .btn,
.compose .attach button {
  background: transparent !important;
  border: none !important;
  color: #54656f !important;
  font-size: 18px !important;
  padding: 8px !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  width: 38px !important;
  height: 38px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Área composer (input + send) */
.compose .composer {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.compose .composer .form-group {
  flex: 1 !important;
  margin-bottom: 0 !important;
}

/* Input de texto */
.compose .composer .form-group input.form-control,
.compose .composer input[type="text"].form-control {
  background-color: #fff !important;
  border: none !important;
  border-radius: 24px !important;
  padding: 10px 18px !important;
  font-size: 15px !important;
  color: #111 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.08) !important;
  outline: none !important;
  height: auto !important;
  width: 100% !important;
  transition: box-shadow .15s !important;
}

.compose .composer .form-group input.form-control:focus,
.compose .composer input[type="text"].form-control:focus {
  box-shadow: 0 1px 4px rgba(0,0,0,.15) !important;
}

.compose .composer .form-group input.form-control::placeholder {
  color: #8696a0 !important;
}

/* Botón enviar */
.compose .composer .send button,
.compose .composer .send .btn {
  background-color: #00a884 !important;
  border-radius: 50% !important;
  border: none !important;
  width: 46px !important;
  height: 46px !important;
  color: #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 6px rgba(0,168,132,.4) !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  transition: background .15s, transform .1s !important;
}

.compose .composer .send button:hover,
.compose .composer .send .btn:hover {
  background-color: #00967a !important;
  transform: scale(1.06) !important;
}

/* SVG del botón enviar en blanco */
.compose .composer .send button svg path,
.compose .composer .send .btn svg path {
  fill: #ffffff !important;
  fill-opacity: 1 !important;
}

/* Botón emoji */
.compose .composer .emoji .btn,
.compose .composer .emoji button {
  background: transparent !important;
  border: none !important;
  color: #54656f !important;
  font-size: 20px !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  padding: 8px !important;
  width: 38px !important;
  height: 38px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Dropdown menú */
.compose .pm .dropdown-menu {
  border-radius: 10px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.18) !important;
  border: none !important;
  padding: 6px 0 !important;
  min-width: 160px !important;
}
.compose .pm .dropdown-menu li a {
  font-size: 14px !important;
  color: #111 !important;
  padding: 9px 18px !important;
}
.compose .pm .dropdown-menu li a:hover {
  background-color: #f5f5f5 !important;
}

/* ── Barra de progreso (ocultar) ── */
.progress.progress-bar-striped {
  display: none !important;
}

/* ── Mensaje de sistema (derivación, etc.) ── */
.systemmessage {
  clear: both !important;
  width: 100% !important;
  text-align: center !important;
  padding: 8px 16px !important;
  background: transparent !important;
  font-size: 12px !important;
  color: #54656f !important;
  box-sizing: border-box !important;
}

.systemmessage:not(:empty) {
  background: rgba(255,255,255,.85) !important;
  border-radius: 10px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.1) !important;
  width: fit-content !important;
  max-width: 75% !important;
  margin: 6px auto !important;
  padding: 6px 14px !important;
  display: block !important;
}

/* ════════════════════════════════
   FOOTER (Powered by Yoizen) — oculto
════════════════════════════════ */

#divFooter,
nav#divFooter {
  display: none !important;
}

/* ════════════════════════════════
   PANTALLAS DE LOGIN / BIENVENIDA
════════════════════════════════ */

#divLogin .page-header h1,
#divCouldntConnect .page-header h1,
#divWaitingForAgent .page-header h1,
#divChatFinished .page-header h1 {
  color: #075E54 !important;
  font-size: 22px !important;
  font-weight: 700 !important;
}

#divLogin input.form-control,
#divLogin select.form-control {
  border-radius: 10px !important;
  border: 1.5px solid #d9d9d9 !important;
  padding: 10px 14px !important;
  font-size: 14px !important;
  transition: border-color .15s, box-shadow .15s !important;
}

#divLogin input.form-control:focus,
#divLogin select.form-control:focus {
  border-color: #075E54 !important;
  box-shadow: 0 0 0 3px rgba(7,94,84,.12) !important;
}

/* Botón primario (Start to chat, etc.) */
.btn.btn-primary {
  background-color: #075E54 !important;
  border-color: #075E54 !important;
  color: #fff !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  padding: 10px 20px !important;
  transition: background .15s !important;
}
.btn.btn-primary:hover,
.btn.btn-primary:focus {
  background-color: #054d44 !important;
  border-color: #054d44 !important;
}

/* ── Bienvenida YFlow ── */
#divYFlowWelcome .welcome {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: #075E54 !important;
  margin-bottom: 10px !important;
}

/* ── Paneles (rating, encuesta) ── */
.panel.panel-default {
  border-radius: 10px !important;
  border: none !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.12) !important;
  overflow: hidden !important;
}
.panel-heading {
  background-color: #f5f5f5 !important;
  font-weight: 600 !important;
  color: #111 !important;
  border: none !important;
}

/* ── Separador de fecha ── */
.date-sep, div[class*="date-sep"] {
  text-align: center !important;
  margin: 8px 0 !important;
}
.date-sep span {
  background: rgba(255,255,255,.85) !important;
  color: #54656f !important;
  font-size: 11.5px !important;
  padding: 3px 10px !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.1) !important;
}

/* ════════════════════════════════
   SCROLLBAR
════════════════════════════════ */

::-webkit-scrollbar { width: 4px !important; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15) !important; border-radius: 2px !important; }
::-webkit-scrollbar-track { background: transparent !important; }
