/* ==================================================
  RECOMMENDER CHAT
  ================================================== */

.reco-chat-root{
  position:fixed;
  right:24px;
  bottom:-50px;
  z-index:9999;
}

.reco-chat-launcher{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:12px;
  border:1px solid rgba(255,255,255,.22);
  background:rgba(20,20,20,.92);
  color:#fff;
  padding:13px 18px;
  border-radius:999px;
  cursor:pointer;
  box-shadow:0 14px 38px rgba(0,0,0,.28);
  backdrop-filter:blur(10px);
}

#recoChatLauncher {
    display: none;
}

.reco-chat-launcher__text{
  font-family:var(--mono);
  text-transform:uppercase;
  letter-spacing:.06em;
  font-size:.84rem;
  display: none;
}

.reco-chat-launcher__pulse{
  position:absolute;
  inset:-5px;
  border-radius:999px;
  border:1px solid rgba(209,15,15,.28);
  animation:recoPulse 2.2s infinite;
  pointer-events:none;
}

@keyframes recoPulse{
  0%{transform:scale(.97); opacity:.75;}
  70%{transform:scale(1.04); opacity:0;}
  100%{transform:scale(1.04); opacity:0;}
}

.reco-chat-panel{
  position:absolute;
  right:0;
  bottom:72px;
  width:min(420px, calc(100vw - 24px));
  height:min(78vh, 760px);
  display:flex;
  flex-direction:column;
  background:rgba(18,18,18,.96);
  border:1px solid rgba(255,255,255,.14);
  border-radius:24px;
  box-shadow:0 24px 70px rgba(0,0,0,.45);
  overflow:hidden;
  transform:translateY(16px) scale(.98);
  opacity:0;
  pointer-events:none;
  transition:all .22s ease;
}

.reco-chat-panel.is-open{
  transform:translateY(0) scale(1);
  opacity:1;
  pointer-events:auto;
}

.reco-chat-panel__header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:16px;
  border-bottom:1px solid rgba(255,255,255,.08);
  background:
    radial-gradient(380px 160px at 0 0, rgba(209,15,15,.12), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0));
}

.reco-chat-panel__titlewrap{
  display:flex;
  gap:12px;
  align-items:flex-start;
}

.reco-chat-panel__icon{
  width:40px;
  height:40px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(209,15,15,.12);
  color:#fff;
  border:1px solid rgba(209,15,15,.20);
}

.reco-chat-panel__title{
  font-family:var(--mono);
  font-size:.94rem;
  color:#fff;
  letter-spacing:.06em;
  text-transform:uppercase;
}

.reco-chat-panel__subtitle{
  margin-top:3px;
  color:#d2ccc3;
  font-size:.88rem;
  line-height:1.3;
  max-width:240px;
}

.reco-chat-panel__actions{
  display:flex;
  gap:8px;
}

.reco-chat-iconbtn{
  width:36px;
  height:36px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04);
  color:#fff;
  cursor:pointer;
}

.reco-chat-iconbtn:hover{
  background:rgba(255,255,255,.08);
}

.reco-chat-messages{
  flex:1;
  overflow:auto;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.01), rgba(255,255,255,0)),
    rgba(10,10,10,.96);
}

.reco-chat-message{
  display:flex;
}

.reco-chat-message--assistant{
  justify-content:flex-start;
}

.reco-chat-message--user{
  justify-content:flex-end;
}

.reco-chat-bubble{
  max-width:88%;
  padding:11px 13px;
  border-radius:18px;
  line-height:1.42;
  font-size:.95rem;
  white-space:pre-wrap;
  word-break:break-word;
}

.reco-chat-message--assistant .reco-chat-bubble{
  background:rgba(255,255,255,.055);
  border:1px solid rgba(255,255,255,.08);
  color:#f5f1ea;
  border-bottom-left-radius:8px;
}

.reco-chat-message--user .reco-chat-bubble{
  background:rgba(209,15,15,.12);
  border:1px solid rgba(209,15,15,.20);
  color:#fff;
  border-bottom-right-radius:8px;
}

.reco-chat-bubble--html{
  padding:0;
  background:transparent !important;
  border:0 !important;
  max-width:100%;
}

.reco-chat-suggestions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding:0 14px 12px;
  background:rgba(12,12,12,.96);
}

.reco-chat-suggestion{
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.05);
  color:#fff;
  padding:8px 10px;
  border-radius:999px;
  font-size:.76rem;
  cursor:pointer;
  line-height:1.1;
}

.reco-chat-suggestion:hover{
  background:rgba(255,255,255,.10);
}

.reco-chat-form{
  padding:12px 14px 14px;
  border-top:1px solid rgba(255,255,255,.08);
  background:rgba(12,12,12,.96);
}

.reco-chat-form__inner{
  display:flex;
  align-items: flex-start;
  gap:10px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  border-radius:18px;
  padding:10px 10px 10px 12px;
}

.reco-chat-input{
  flex:1;
  resize:none;
  border:0;
  background:transparent;
  color:#fff;
  outline:none;
  max-height:120px;
  min-height:22px;
  font-family:var(--sans);
}

.reco-chat-input::placeholder{
  color:#a8a197;
}

.reco-chat-send{
  width:40px;
  height:40px;
  flex:0 0 40px;
  border-radius:13px;
  border:1px solid rgba(209,15,15,.24);
  background:rgba(209,15,15,.16);
  color:#fff;
  cursor:pointer;
}

.reco-chat-send:hover{
  background:rgba(209,15,15,.24);
}

.reco-chat-typing{
  display:inline-flex;
  gap:6px;
  align-items:center;
}

.reco-chat-typing span{
  width:6px;
  height:6px;
  border-radius:50%;
  background:#d6d0c6;
  opacity:.5;
  animation:typingDot 1.2s infinite;
}

.reco-chat-typing span:nth-child(2){ animation-delay:.15s; }
.reco-chat-typing span:nth-child(3){ animation-delay:.3s; }

@keyframes typingDot{
  0%, 80%, 100%{ transform:translateY(0); opacity:.35; }
  40%{ transform:translateY(-4px); opacity:1; }
}

/* Card recomendación compacta */
.reco-book-card{
  display:grid;
  grid-template-columns:78px 1fr;
  gap:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  border-radius:18px;
  padding:12px;
  color:#fff;
}

.reco-book-card__media img,
.reco-book-card__placeholder{
  width:78px;
  height:112px;
  object-fit:cover;
  border-radius:12px;
  display:block;
  background:#1a1a1a;
}

.reco-book-card__placeholder{
  display:flex;
  align-items:center;
  justify-content:center;
  color:#8d877e;
}

.reco-book-card__eyebrow{
  color:#ff3b3b;
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.08em;
  margin-bottom:4px;
}

.reco-book-card__title{
  margin:0 0 5px;
  font-size:1rem;
  line-height:1.22;
  color:#fff;
}

.reco-book-card__meta{
  color:#d8d1c8;
  font-size:.84rem;
  margin-bottom:7px;
}

.reco-book-card__tags{
  display:flex;
  flex-wrap:wrap;
  gap:5px;
  margin-bottom:7px;
}

.reco-book-card__tag{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  font-size:.72rem;
  color:#f4f1eb;
}

.reco-book-card__facts{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:7px;
  color:#c7c1b7;
  font-size:.78rem;
}

.reco-book-card__synopsis{
  margin:0 0 9px;
  color:#f1ece5;
  font-size:.84rem;
  line-height:1.38;
}

.reco-book-card__actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.reco-book-card__link{
  display:inline-flex;
  align-items:center;
  gap:8px;
  text-decoration:none;
  color:#fff;
  border:1px solid rgba(255,255,255,.14);
  padding:7px 10px;
  border-radius:999px;
  font-size:.78rem;
}

.reco-book-card__link:hover{
  background:rgba(255,255,255,.06);
}

@media (max-width: 640px){
  .reco-chat-root{
    right:14px;
    bottom:-100px;
    left:14px;
    height: calc(var(--vh) * 100);
  }

  .reco-chat-launcher{
    width:100%;
    justify-content:center;
    display: none;
  }

  .reco-chat-panel{
    width:100%;
    right:0;
    bottom:100px;
    height:100vh; /* min(76vh, 720px); */
    height:100dvh; /* min(76vh, 720px); */
    border-radius: 0;
  }
}

/* ==================================================
   PATCH VISUAL FINAL CHAT RECOMMENDER
   Pegar AL FINAL de public/css/styles.css
   ================================================== */

/* Panel general: un poco más claro y más limpio */
.reco-chat-panel{
  background: rgba(28, 28, 30, .97) !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  box-shadow: 0 24px 64px rgba(0,0,0,.36) !important;
}

.reco-chat-panel__header{
  background:
    radial-gradient(340px 150px at 0 0, rgba(209,15,15,.10), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01)) !important;
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
  padding: 14px 16px !important;
}

.reco-chat-panel__icon{
  background: rgba(209,15,15,.14) !important;
  border: 1px solid rgba(209,15,15,.18) !important;
}

.reco-chat-panel__subtitle{
  color: #ddd6cd !important;
}

/* Botones header */
.reco-chat-iconbtn{
  width: 38px !important;
  height: 38px !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,.05) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.reco-chat-iconbtn i{
  font-size: .95rem !important;
  line-height: 1 !important;
}

.reco-chat-iconbtn:hover{
  background: rgba(255,255,255,.09) !important;
}

/* Zona mensajes */
.reco-chat-messages{
  background: #1b1b1d !important;
  padding: 14px !important;
  gap: 10px !important;
}

/* Bubbles normales */
.reco-chat-bubble{
  max-width: 84% !important;
  padding: 12px 14px !important;
  border-radius: 16px !important;
  font-size: .95rem !important;
  line-height: 1.42 !important;
  white-space: normal !important;
  word-break: break-word !important;
}

.reco-chat-message--assistant .reco-chat-bubble{
  background: #242427 !important;
  border: 1px solid rgba(255,255,255,.09) !important;
  color: #f4efe8 !important;
}

.reco-chat-message--user .reco-chat-bubble{
  background: rgba(209,15,15,.16) !important;
  border: 1px solid rgba(209,15,15,.22) !important;
  color: #ffffff !important;
}

/* ==================================================
   ARREGLO CLAVE:
   el bubble HTML NO debe heredar white-space/paddings raros
   ================================================== */
.reco-chat-bubble--html{
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  max-width: 100% !important;
  white-space: normal !important;
  line-height: normal !important;
  display: block !important;
}

.reco-chat-bubble--html *{
  white-space: normal !important;
}

/* Loading / typing mucho más compacto */
.reco-chat-message--typing .reco-chat-bubble{
  min-width: 60px !important;
  max-width: 72px !important;
  padding: 10px 12px !important;
  border-radius: 14px !important;
}

.reco-chat-typing{
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
}

.reco-chat-typing span{
  width: 6px !important;
  height: 6px !important;
  background: #d9d2c8 !important;
  opacity: .8 !important;
}

/* Sugerencias */
.reco-chat-suggestions{
  background: #1b1b1d !important;
  padding: 0 14px 12px !important;
  gap: 8px !important;
}

.reco-chat-suggestion{
  background: rgba(255,255,255,.05) !important;
  border: 1px solid rgba(255,255,255,.11) !important;
  color: #f3eee8 !important;
  padding: 8px 11px !important;
  font-size: .76rem !important;
  border-radius: 999px !important;
  line-height: 1.1 !important;
}

.reco-chat-suggestion:hover{
  background: rgba(255,255,255,.10) !important;
}

/* Formulario abajo */
.reco-chat-form{
  background: #1b1b1d !important;
  padding: 12px 14px 14px !important;
  border-top: 1px solid rgba(255,255,255,.08) !important;
}

.reco-chat-form__inner{
  background: #252528 !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  border-radius: 16px !important;
  padding: 10px 10px 10px 12px !important;
}

.reco-chat-input{
  color: #fff !important;
}

.reco-chat-input::placeholder{
  color: #b8afa4 !important;
}

.reco-chat-send{
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
  background: rgba(209,15,15,.18) !important;
  border: 1px solid rgba(209,15,15,.24) !important;
}

.reco-chat-send:hover{
  background: rgba(209,15,15,.26) !important;
}

/* ==================================================
   CARD DEL LIBRO: COMPACTA Y PROFESIONAL
   ================================================== */
.reco-book-card{
  display: grid !important;
  grid-template-columns: 76px minmax(0,1fr) !important;
  align-items: start !important;
  gap: 12px !important;
  padding: 12px !important;
  margin: 0 !important;
  border-radius: 18px !important;
  background: #242427 !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  box-shadow: none !important;
}

.reco-book-card__content{
  min-width: 0 !important;
  display: block !important;
}

.reco-book-card__media{
  margin: 0 !important;
}

.reco-book-card__media img,
.reco-book-card__placeholder{
  width: 76px !important;
  height: 110px !important;
  border-radius: 12px !important;
  object-fit: cover !important;
  display: block !important;
}

.reco-book-card__eyebrow{
  margin: 0 0 5px 0 !important;
  color: #ff4b4b !important;
  font-size: .72rem !important;
  letter-spacing: .08em !important;
}

.reco-book-card__title{
  margin: 0 0 6px 0 !important;
  font-size: 1rem !important;
  line-height: 1.24 !important;
  color: #fff !important;
}

.reco-book-card__meta{
  margin: 0 0 8px 0 !important;
  color: #d8d1c8 !important;
  font-size: .84rem !important;
  line-height: 1.3 !important;
}

.reco-book-card__tags{
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  margin: 0 0 8px 0 !important;
}

.reco-book-card__tag{
  margin: 0 !important;
  padding: 4px 8px !important;
  border-radius: 999px !important;
  font-size: .72rem !important;
  background: rgba(255,255,255,.05) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  color: #f3eee8 !important;
}

.reco-book-card__facts{
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin: 0 0 8px 0 !important;
  color: #c7c1b7 !important;
  font-size: .78rem !important;
  line-height: 1.2 !important;
}

.reco-book-card__facts span{
  margin: 0 !important;
}

.reco-book-card__synopsis{
  margin: 0 0 10px 0 !important;
  color: #f3eee8 !important;
  font-size: .84rem !important;
  line-height: 1.38 !important;
}

.reco-book-card__actions{
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.reco-book-card__link{
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 7px 10px !important;
  border-radius: 999px !important;
  font-size: .78rem !important;
  background: rgba(255,255,255,.03) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  color: #fff !important;
  text-decoration: none !important;
}

.reco-book-card__link:hover{
  background: rgba(255,255,255,.08) !important;
}

/* Scroll más fino */
.reco-chat-messages::-webkit-scrollbar{
  width: 10px;
}

.reco-chat-messages::-webkit-scrollbar-track{
  background: transparent;
}

.reco-chat-messages::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ==========================================
   AUTHOR SIGNATURES
   ========================================== */

.reco-signature-card{
  border:1px solid rgba(255,255,255,.10);
  background:#242427;
  border-radius:18px;
  padding:14px;
  color:#fff;
}

.reco-signature-card__eyebrow{
  color:#ff4b4b;
  font-size:.72rem;
  letter-spacing:.08em;
  text-transform:uppercase;
  margin-bottom:8px;
}

.reco-signature-card__group + .reco-signature-card__group{
  margin-top:16px;
  padding-top:14px;
  border-top:1px solid rgba(255,255,255,.08);
}

.reco-signature-card__author{
  margin:0 0 10px 0;
  font-size:1rem;
  line-height:1.2;
  color:#fff;
}

.reco-signature-card__list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.reco-signature-card__item{
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  border-radius:14px;
  padding:10px 12px;
}

.reco-signature-card__date{
  font-family:var(--mono);
  font-size:.84rem;
  color:#fff;
  margin-bottom:6px;
}

.reco-signature-card__meta{
  font-size:.84rem;
  color:#ddd6cd;
  line-height:1.45;
  display:flex;
  flex-direction:column;
  gap:4px;
}

/* Dentro de la ficha del libro */
.reco-book-card__signings{
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid rgba(255,255,255,.08);
}

.reco-book-card__signings-title{
  font-size:.78rem;
  color:#ff4b4b;
  text-transform:uppercase;
  letter-spacing:.08em;
  margin-bottom:8px;
}

.reco-book-card__signings-group + .reco-book-card__signings-group{
  margin-top:10px;
}

.reco-book-card__signings-author{
  font-size:.84rem;
  color:#fff;
  margin-bottom:6px;
}

.reco-book-card__signing-item{
  font-size:.78rem;
  color:#ddd6cd;
  line-height:1.4;
  padding:8px 10px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  border-radius:12px;
}

.reco-book-card__signing-item + .reco-book-card__signing-item{
  margin-top:6px;
}

.reco-book-card__signing-date{
  color:#fff;
  margin-bottom:3px;
}

.reco-book-card__signing-place,
.reco-book-card__signing-stall{
  color:#cfc8be;
}