﻿﻿﻿﻿﻿/* ===========================
   BRANDTY CHAT WIDGET STYLES
   Branding: Jordana · #72BACD · #3C3C3C · #FE8675 · #FFFFFF
   =========================== */

/* === FUENTE JORDANA ===
   Si dispones de los archivos de fuente, colócalos en /public/fonts/ y
   descomenta este bloque. Sin los archivos, el widget usa Montserrat como fallback.

@font-face {
  font-family: 'Jordana';
  src: url('fonts/Jordana-Light.woff2') format('woff2'),
       url('fonts/Jordana-Light.woff')  format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Jordana';
  src: url('fonts/Jordana-Bold.woff2') format('woff2'),
       url('fonts/Jordana-Bold.woff')  format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
*/

:root {
  /* Paleta corporativa */
  --b-blue:         #72BACD;
  --b-blue-dark:    #5aa3b8;
  --b-blue-light:   #e8f5f9;
  --b-grey:         #3C3C3C;
  --b-grey-muted:   #8a8a8a;
  --b-grey-border:  #e4e4e4;
  --b-coral:        #FE8675;
  --b-coral-hover:  #fd6f5b;
  --b-white:        #FFFFFF;
  --b-bg:           #f7fafb;

  /* Tipografía: Jordana con fallback a Montserrat */
  --b-font: 'Jordana', 'Montserrat', sans-serif;

  /* Sombras y radios */
  --b-shadow: 0 16px 56px rgba(114, 186, 205, 0.18), 0 4px 16px rgba(0,0,0,0.08);
  --b-radius: 18px;
}

/* === ANIMACIONES DEL BOTÓN === */
@keyframes b-bounceIn {
  0%   { opacity: 0; transform: scale(0.3) translateY(60px); }
  60%  { opacity: 1; transform: scale(1.15) translateY(-8px); }
  80%  { transform: scale(0.95) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes b-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(254, 134, 117, 0.6); }
  50%       { box-shadow: 0 0 0 14px rgba(254, 134, 117, 0); }
}

/* === TOGGLE BUTTON === */
#brandty-toggle {
  position: fixed;
  bottom: 35px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #FE8675 !important;
  border: 3px solid rgba(255, 255, 255, 0.85) !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  animation:
    b-bounceIn 0.9s cubic-bezier(0.36, 0.07, 0.19, 0.97) both,
    b-pulse 2.2s ease-in-out 1.2s infinite;
  transition: transform 0.25s ease, filter 0.25s ease;
}

#brandty-toggle:hover {
  transform: scale(1.1);
  filter: brightness(1.08);
}

#brandty-toggle svg {
  width: 28px;
  height: 28px;
  fill: #FFFFFF !important;
  transition: opacity 0.2s;
}

#brandty-toggle .icon-close { display: none; }
#brandty-toggle.open .icon-chat { display: none; }
#brandty-toggle.open .icon-close { display: block; }

/* Detener pulse cuando el chat está abierto */
#brandty-toggle.open {
  animation: none;
}

/* === CHAT WINDOW === */
#brandty-chat {
  position: fixed !important;
  bottom: 105px !important;
  right: 30px !important;
  width: 375px !important;
  max-width: calc(100vw - 32px) !important;
  height: 560px !important;
  max-height: calc(100vh - 120px) !important;
  background: #FFFFFF !important;
  border-radius: 18px !important;
  box-shadow: 0 16px 56px rgba(114,186,205,0.18), 0 4px 16px rgba(0,0,0,0.08) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 999998 !important;
  transform: translateY(18px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
  font-family: 'Montserrat', sans-serif !important;
}

#brandty-chat.visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* === HEADER === */
#brandty-header {
  background: #72BACD !important;
  padding: 16px 20px !important;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brandty-avatar {
  display: none;
}

.brandty-header-info { flex: 1; }

/* Botón cerrar (X) en el header */
#brandty-close {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.2s;
  padding: 0;
}

#brandty-close:hover {
  background: rgba(255,255,255,0.2);
}

#brandty-close svg {
  width: 18px;
  height: 18px;
  fill: rgba(255,255,255,0.85);
}

.brandty-header-name {
  color: var(--b-white);
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
  font-family: var(--b-font);
  letter-spacing: 0.2px;
}

.brandty-header-status {
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-weight: 300;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}

.brandty-status-dot {
  width: 7px;
  height: 7px;
  background: #a8f0c6;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(168, 240, 198, 0.3);
}

/* === MESSAGES === */
#brandty-messages {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 18px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  background: #f7fafb !important;
  scroll-behavior: smooth;
}

#brandty-messages::-webkit-scrollbar { width: 3px; }
#brandty-messages::-webkit-scrollbar-track { background: transparent; }
#brandty-messages::-webkit-scrollbar-thumb {
  background: var(--b-grey-border);
  border-radius: 3px;
}

.brandty-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: b-fadeIn 0.28s ease;
}

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

.brandty-message.user { flex-direction: row-reverse; }

.brandty-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--b-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--b-white);
  flex-shrink: 0;
  font-family: var(--b-font);
}

.brandty-message.user .brandty-msg-avatar {
  background: var(--b-coral);
}

.brandty-bubble {
  max-width: 76%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px !important;
  font-weight: 300;
  line-height: 1.7;
  color: var(--b-grey);
  background: var(--b-white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--b-font);
}

.brandty-bubble strong {
  font-weight: 700;
}

/* Bot bubble: fondo gris oscuro corporativo con texto blanco */
.brandty-message.bot .brandty-bubble {
  background: #3C3C3C !important;
  border-bottom-left-radius: 4px;
  border-left: 3px solid var(--b-blue);
  color: #FFFFFF !important;
  box-shadow: 0 2px 8px rgba(60,60,60,0.18);
}

/* Texto blanco en todos los elementos hijos */
#brandty-messages .brandty-message.bot .brandty-bubble,
#brandty-messages .brandty-message.bot .brandty-bubble p,
#brandty-messages .brandty-message.bot .brandty-bubble span,
#brandty-messages .brandty-message.bot .brandty-bubble strong,
#brandty-messages .brandty-message.bot .brandty-bubble em,
#brandty-messages .brandty-message.bot .brandty-bubble * {
  color: #FFFFFF !important;
}

/* Links dentro de burbuja bot: azul claro para visibilidad sobre fondo oscuro */
#brandty-messages .brandty-message.bot .brandty-bubble a,
#brandty-messages .brandty-message.bot .brandty-bubble a:visited {
  color: var(--b-blue) !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
  font-weight: 700;
}

#brandty-messages .brandty-message.bot .brandty-bubble a:hover {
  color: #9dcfde !important;
}

/* User bubble: coral corporativo */
.brandty-message.user .brandty-bubble {
  background: var(--b-coral);
  color: var(--b-white);
  border-bottom-right-radius: 4px;
  border-left: none;
}

/* === TYPING INDICATOR === */
.brandty-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
  background: var(--b-white);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  border-left: 3px solid var(--b-blue);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  width: fit-content;
}

.brandty-dot {
  width: 7px;
  height: 7px;
  background: var(--b-blue);
  border-radius: 50%;
  animation: b-bounce 1.2s infinite;
}

.brandty-dot:nth-child(2) { animation-delay: 0.18s; }
.brandty-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes b-bounce {
  0%, 80%, 100% { transform: translateY(0);   opacity: 0.35; }
  40%            { transform: translateY(-5px); opacity: 1;    }
}

/* === INPUT AREA === */
#brandty-footer {
  padding: 13px 14px 12px !important;
  border-top: 1px solid #e4e4e4 !important;
  background: #FFFFFF !important;
  flex-shrink: 0 !important;
}

#brandty-form {
  display: flex;
  gap: 9px;
  align-items: flex-end;
}

#brandty-input {
  flex: 1;
  border: 1.5px solid #e4e4e4 !important;
  border-radius: 12px !important;
  padding: 10px 13px;
  font-size: 15px !important;
  background: #f7fafb !important;
  font-weight: 300;
  font-family: var(--b-font);
  color: var(--b-grey);
  outline: none;
  resize: none;
  min-height: 42px;
  max-height: 110px;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--b-bg);
}

#brandty-input:focus {
  border-color: var(--b-blue);
  box-shadow: 0 0 0 3px rgba(114, 186, 205, 0.15);
  background: var(--b-white);
}

#brandty-input::placeholder {
  color: var(--b-grey-muted);
  font-weight: 300;
}

#brandty-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--b-coral);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.18s, transform 0.1s;
}

#brandty-send:hover  { background: var(--b-coral-hover); }
#brandty-send:active { transform: scale(0.92); }

#brandty-send:disabled {
  background: var(--b-grey-border);
  cursor: not-allowed;
  transform: none;
}

#brandty-send svg {
  width: 17px;
  height: 17px;
  fill: var(--b-white);
}

.brandty-footer-note {
  text-align: center;
  font-size: 11px;
  font-weight: 300;
  color: var(--b-grey-muted);
  margin-top: 7px;
  font-family: var(--b-font);
  letter-spacing: 0.2px;
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
  #brandty-chat {
    bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    height: 100dvh; max-height: 100dvh;
    border-radius: 0;
  }
  #brandty-toggle { bottom: 20px; right: 20px; }
}
