/* ============================================================================
   PUNTO VERDE — ASISTENTE VIRTUAL IA (GEMINI)
   Hereda paleta, tipografía y radios de styles.css
   ============================================================================ */

.pv-chat-root {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 940;
  font-family: var(--font-body, 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif);
  color: var(--text-main, #1E3128);
}

/* Botón flotante del asistente (ubicado encima del botón de WhatsApp) */
.pv-chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  height: 50px;
  padding: 0 1.1rem 0 0.9rem;
  background: var(--primary, #14452F);
  color: var(--btn-primary-text, #FFFFFF);
  border: 1px solid var(--primary-dark, #0D3121);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow: var(--shadow-md, 0 8px 24px -6px rgba(16, 35, 27, 0.16));
  transition: background-color 0.2s ease, transform 0.2s var(--ease-out, ease), box-shadow 0.2s ease;
}

.pv-chat-launcher:hover {
  background: var(--primary-dark, #0D3121);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg, 0 20px 44px -12px rgba(16, 35, 27, 0.2));
}

.pv-chat-launcher:focus-visible {
  outline: 2px solid var(--primary, #14452F);
  outline-offset: 3px;
}

.pv-chat-launcher[aria-expanded="true"] {
  display: none;
}

.pv-chat-launcher-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Ventana principal del chat */
.pv-chat-panel {
  width: 392px;
  max-width: calc(100vw - 28px);
  height: min(560px, calc(100dvh - 120px));
  background: var(--bg-surface, #FFFFFF);
  border: 1px solid var(--border-color, #DCE3DE);
  border-radius: var(--radius-lg, 20px);
  box-shadow: var(--shadow-lg, 0 20px 44px -12px rgba(16, 35, 27, 0.18));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: pvChatEnter 0.22s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

@keyframes pvChatEnter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Encabezado */
.pv-chat-header {
  background: var(--primary-dark, #0D3121);
  color: #FFFFFF;
  padding: 0.95rem 1rem 0.95rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.pv-chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.pv-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm, 10px);
  background: rgba(255, 255, 255, 0.12);
  color: #E6EFE9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pv-chat-title {
  font-family: var(--font-heading, 'Newsreader', Georgia, serif);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.15;
  color: #FFFFFF;
  letter-spacing: -0.015em;
}

.pv-chat-subtitle {
  display: block;
  font-size: 0.76rem;
  color: #D8E8DF;
  margin-top: 2px;
  line-height: 1.25;
}

.pv-chat-close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs, 6px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.16s ease;
}

.pv-chat-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Área de mensajes */
.pv-chat-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 1rem 0.75rem;
  background: var(--bg-page, #F9FBF9);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.pv-chat-msg {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 92%;
}

.pv-chat-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.pv-chat-msg--bot {
  align-self: flex-start;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
}

.pv-chat-bubble {
  padding: 0.78rem 0.95rem;
  border-radius: var(--radius-md, 14px);
  font-size: 0.89rem;
  line-height: 1.52;
  word-wrap: break-word;
}

.pv-chat-msg--user .pv-chat-bubble {
  background: var(--primary, #14452F);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.pv-chat-msg--bot .pv-chat-bubble {
  background: var(--bg-surface, #FFFFFF);
  color: var(--text-main, #1E3128);
  border: 1px solid var(--border-color, #DCE3DE);
  border-bottom-left-radius: 4px;
  max-width: 94%;
}

.pv-chat-msg--error .pv-chat-bubble {
  background: #FFF7F5;
  border-color: #E7C4BC;
  color: #6E2417;
}

/* Sugerencias iniciales rápidas */
.pv-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-top: 0.15rem;
}

.pv-chat-chip {
  background: var(--bg-surface, #FFFFFF);
  color: var(--primary-dark, #0D3121);
  border: 1px solid var(--border-green, #BDD1C5);
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  font-family: inherit;
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.pv-chat-chip:hover {
  background: var(--bg-soft-green, #F2F6F3);
  border-color: var(--primary, #14452F);
}

/* Indicador de carga ("Revisando catálogo...") */
.pv-chat-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.68rem 0.95rem;
  background: var(--bg-surface, #FFFFFF);
  border: 1px solid var(--border-color, #DCE3DE);
  border-radius: var(--radius-md, 14px);
  border-bottom-left-radius: 4px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary, #42554C);
}

.pv-chat-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border-green, #BDD1C5);
  border-top-color: var(--primary, #14452F);
  border-radius: 50%;
  animation: pvChatSpin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes pvChatSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Tarjetas visuales de productos recomendados */
.pv-chat-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.pv-chat-card {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 0.72rem;
  padding: 0.6rem 0.75rem 0.6rem 0.6rem;
  background: var(--bg-surface, #FFFFFF);
  border: 1px solid var(--border-color, #DCE3DE);
  border-radius: var(--radius-sm, 10px);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.pv-chat-card:hover {
  border-color: var(--primary, #14452F);
  background: var(--bg-soft-green, #F2F6F3);
  transform: translateY(-1px);
}

.pv-chat-card-thumb {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-xs, 6px);
  background: var(--bg-soft-green, #F2F6F3);
  border: 1px solid var(--border-color, #DCE3DE);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.pv-chat-card-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.pv-chat-card-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.pv-chat-card-name {
  font-family: var(--font-heading, 'Newsreader', Georgia, serif);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.24;
  color: var(--text-heading, #10231B);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pv-chat-card-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark, #0D3121);
  font-variant-numeric: tabular-nums;
}

.pv-chat-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary, #14452F);
  white-space: nowrap;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-xs, 6px);
  background: var(--bg-soft-green, #F2F6F3);
  border: 1px solid var(--border-green, #BDD1C5);
}

.pv-chat-card:hover .pv-chat-card-cta {
  background: var(--primary, #14452F);
  border-color: var(--primary, #14452F);
  color: #FFFFFF;
}

/* Barra inferior de entrada */
.pv-chat-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-surface, #FFFFFF);
  border-top: 1px solid var(--border-color, #DCE3DE);
  flex-shrink: 0;
}

.pv-chat-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 0.85rem;
  font-family: inherit;
  font-size: 0.89rem;
  color: var(--text-main, #1E3128);
  background: var(--bg-page, #F9FBF9);
  border: 1px solid var(--border-color, #DCE3DE);
  border-radius: var(--radius-xs, 6px);
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.pv-chat-input:focus {
  outline: none;
  border-color: var(--primary, #14452F);
  background: var(--bg-surface, #FFFFFF);
}

.pv-chat-input::placeholder {
  color: var(--text-muted, #56675F);
}

.pv-chat-send {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-xs, 6px);
  border: 1px solid var(--primary, #14452F);
  background: var(--primary, #14452F);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.16s ease, opacity 0.16s ease;
}

.pv-chat-send:hover:not(:disabled) {
  background: var(--primary-dark, #0D3121);
  border-color: var(--primary-dark, #0D3121);
}

.pv-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Responsive móvil */
@media (max-width: 640px) {
  .pv-chat-root {
    right: 16px;
    bottom: 84px;
  }

  .pv-chat-launcher {
    height: 46px;
    padding: 0 0.95rem 0 0.82rem;
    font-size: 0.84rem;
  }

  .pv-chat-root.pv-chat-root--open {
    left: 12px;
    right: 12px;
    bottom: 14px;
    z-index: 980;
  }

  .pv-chat-panel {
    width: 100%;
    max-width: 100%;
    height: min(78dvh, 560px);
  }
}
