body.chat-page {
  overflow: hidden;
  height: 100vh;
}

.chat-app {
  display: flex;
  height: 100vh;
  background: var(--black);
}

/* SIDEBAR */
.chat-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--dark);
  border-right: 1px solid rgba(78,236,216,0.08);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 50;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 1.2rem 1rem 0.8rem;
  border-bottom: 1px solid rgba(78,236,216,0.08);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.btn-new-chat {
  background: var(--cyan-dim);
  border: 1px solid rgba(78,236,216,0.3);
  color: var(--cyan);
  font-family: 'Nunito', sans-serif;
  font-size: 0.83rem;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.btn-new-chat:hover { background: var(--cyan-glow); }

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray2);
  padding: 1rem 1rem 0.4rem;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.3rem 0.5rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 8px;
}
.sidebar-item:hover { background: var(--dark2); }
.sidebar-item.active { background: var(--dark3); border: 1px solid rgba(78,236,216,0.15); }

.sidebar-item-text {
  font-size: 0.82rem;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.sidebar-item.active .sidebar-item-text { color: var(--white); }

.sidebar-item-del {
  background: none;
  border: none;
  color: var(--gray2);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 5px;
  border-radius: 5px;
  opacity: 0;
  transition: all 0.15s;
}
.sidebar-item:hover .sidebar-item-del { opacity: 1; }
.sidebar-item-del:hover { color: #ff6b6b; background: rgba(255,107,107,0.1); }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(78,236,216,0.08);
}

.sidebar-back {
  color: var(--gray);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: color 0.2s;
}
.sidebar-back:hover { color: var(--cyan); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 40;
}

/* MAIN */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.chat-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(78,236,216,0.08);
  flex-shrink: 0;
}

.topbar-menu {
  background: none;
  border: none;
  color: var(--gray);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  display: none;
}

.topbar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.chat-avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid rgba(78,236,216,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 800; color: var(--cyan);
}

.topbar-name { font-size: 0.9rem; font-weight: 700; }
.topbar-status { font-size: 0.7rem; color: #25d366; }

.topbar-new {
  background: var(--dark2);
  border: 1px solid rgba(78,236,216,0.2);
  color: var(--cyan);
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.topbar-new:hover { background: var(--cyan-dim); }

/* MESSAGES AREA */
.chat-messages-full {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  align-self: stretch;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 1rem;
  padding: 2rem;
}

.empty-logo {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid rgba(78,236,216,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 900; color: var(--cyan);
  margin-bottom: 0.5rem;
}

.chat-empty h2 { font-size: 1.4rem; font-weight: 800; }
.chat-empty p { color: var(--gray); font-size: 0.9rem; }

.empty-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 0.5rem;
  width: 100%;
  max-width: 480px;
}

.empty-suggestions button {
  background: var(--dark2);
  border: 1px solid rgba(78,236,216,0.1);
  border-radius: 12px;
  color: var(--gray);
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  line-height: 1.4;
}
.empty-suggestions button:hover { border-color: rgba(78,236,216,0.3); color: var(--white); }

/* MENSAJES */
.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.msg-row.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid rgba(78,236,216,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 800; color: var(--cyan);
  flex-shrink: 0;
}
.msg-row.user .msg-avatar {
  background: var(--dark3);
  color: var(--gray);
  border-color: var(--gray2);
}

.msg-bubble {
  max-width: 72%;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
}
.msg-row.bot .msg-bubble {
  background: var(--dark2);
  color: var(--white);
  border-bottom-left-radius: 4px;
}
.msg-row.user .msg-bubble {
  background: var(--cyan);
  color: var(--black);
  font-weight: 600;
  border-bottom-right-radius: 4px;
}
.msg-row.bot.typing .msg-bubble { color: var(--gray); font-style: italic; }

/* PRODUCT CARDS */
.product-search-result {
  background: var(--dark2);
  border: 1px solid rgba(78,236,216,0.15);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  max-width: 72%;
}
.product-search-result .search-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.8rem;
}
.product-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.product-card-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--dark3);
  border: 1px solid rgba(78,236,216,0.1);
  border-radius: 12px;
  padding: 0.9rem;
  text-decoration: none;
  transition: all 0.2s;
}
.product-card-link:hover { border-color: rgba(78,236,216,0.35); transform: translateY(-2px); }

.pc-platform {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.pc-platform.ali { color: #ff6a00; }
.pc-platform.baba { color: #ff8c00; }

.pc-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
}
.pc-desc {
  font-size: 0.75rem;
  color: var(--gray);
  line-height: 1.4;
}
.pc-cta {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan);
  margin-top: 2px;
}

/* INPUT */
.chat-input-full {
  padding: 1rem 1.5rem 1.2rem;
  background: var(--black);
  border-top: 1px solid rgba(78,236,216,0.08);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--dark2);
  border: 1px solid rgba(78,236,216,0.2);
  border-radius: 16px;
  padding: 0.75rem 0.75rem 0.75rem 1.2rem;
  max-width: 780px;
  margin: 0 auto;
  transition: border-color 0.2s;
}
.input-wrapper:focus-within { border-color: rgba(78,236,216,0.5); }

#chat-input-full {
  flex: 1;
  background: none;
  border: none;
  color: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 0.92rem;
  resize: none;
  outline: none;
  max-height: 140px;
  line-height: 1.5;
}
#chat-input-full::placeholder { color: var(--gray2); }

#send-btn-full {
  background: var(--cyan);
  border: none;
  border-radius: 10px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--black);
  transition: all 0.2s;
  flex-shrink: 0;
}
#send-btn-full:hover { background: var(--cyan2); transform: scale(1.05); }
#send-btn-full:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.input-hint {
  text-align: center;
  font-size: 0.68rem;
  color: var(--gray2);
  margin-top: 0.5rem;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .chat-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
  }
  .chat-sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .topbar-menu { display: block; }
  .empty-suggestions { grid-template-columns: 1fr; }
  .product-cards-grid { grid-template-columns: 1fr; }
  .msg-bubble, .product-search-result { max-width: 90%; }
}
/* ─── FULL CHAT — PRODUCT RESULTS (sin marca, sin precio, sin links externos) ─── */
.rpc-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 85%;
}

.rpc-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.rpc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rpc-card {
  display: flex;
  flex-direction: column;
  background: var(--dark2);
  border: 1px solid rgba(78,236,216,0.1);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
}
.rpc-card:hover {
  border-color: rgba(78,236,216,0.4);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(78,236,216,0.08);
}

.rpc-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  background: var(--dark3);
  display: block;
}
.rpc-img-ph {
  width: 100%;
  aspect-ratio: 1/1;
  background: var(--dark3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.rpc-info {
  padding: 0.7rem 0.8rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.rpc-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.4;
}

.rpc-btn {
  background: var(--cyan);
  color: var(--black);
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s;
  text-align: center;
  margin-top: auto;
}
.rpc-btn:hover { background: var(--cyan2); }

@media (max-width: 768px) {
  .rpc-grid { grid-template-columns: repeat(2, 1fr); }
  .rpc-wrapper { max-width: 95%; }
}

/* Botón secundario personalizar */
.rpc-btn-secondary {
  display: block;
  background: var(--dark3);
  color: var(--cyan);
  border: 1px solid rgba(78,236,216,0.3);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  text-decoration: none;
}
.rpc-btn-secondary:hover { background: var(--cyan-dim); border-color: var(--cyan); }

/* ══════════════════════════════════════════════════════════════
   LOGO UPLOAD
══════════════════════════════════════════════════════════════ */

.logo-upload-label {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           34px;
  height:          34px;
  flex-shrink:     0;
  color:           var(--gray2);
  cursor:          pointer;
  border-radius:   8px;
  transition:      color .2s, background .2s;
}
.logo-upload-label:hover {
  color:       var(--cyan);
  background:  var(--cyan-dim);
}

.logo-indicator {
  display:       flex;
  align-items:   center;
  gap:           8px;
  background:    rgba(78,236,216,.07);
  border:        1px solid rgba(78,236,216,.22);
  border-radius: 9px;
  padding:       0.28rem 0.7rem 0.28rem 0.5rem;
  margin-bottom: 6px;
  max-width:     780px;
  margin-left:   auto;
  margin-right:  auto;
  font-size:     0.78rem;
  font-weight:   700;
}
.logo-remove-btn {
  background:  none;
  border:      none;
  color:       var(--gray2);
  cursor:      pointer;
  font-size:   0.8rem;
  padding:     0;
  margin-left: auto;
  line-height: 1;
  transition:  color .15s;
}
.logo-remove-btn:hover { color: #ff6b6b; }

/* ══════════════════════════════════════════════════════════════
   PRODUCT VISUAL CARD
══════════════════════════════════════════════════════════════ */

.pv-card {
  background:    var(--dark2);
  border:        1px solid rgba(78,236,216,.18);
  border-radius: 18px;
  overflow:      hidden;
  max-width:     400px;
  display:       flex;
  flex-direction:column;
  transition:    border-color .2s;
}
.pv-card:hover { border-color: rgba(78,236,216,.38); }

.pv-label {
  font-size:      0.72rem;
  font-weight:    700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color:          var(--cyan);
  padding:        .75rem 1rem .4rem;
}

.pv-img-wrap {
  position:    relative;
  width:       100%;
  aspect-ratio: 1 / 1;
  background:  var(--dark3);
  overflow:    hidden;
}

.pv-canvas {
  display:    none;
  width:      100%;
  height:     100%;
  object-fit: cover;
}

.pv-spinner {
  position:        absolute;
  inset:           0;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             12px;
  background:      var(--dark3);
}
.pv-spin-ring {
  width:        36px;
  height:       36px;
  border-radius:50%;
  border:       3px solid rgba(78,236,216,.15);
  border-top-color: var(--cyan);
  animation:    pvSpin .8s linear infinite;
}
@keyframes pvSpin { to { transform: rotate(360deg); } }
.pv-spinner span {
  font-size:  .78rem;
  color:      var(--gray);
  text-align: center;
  padding:    0 1rem;
}

.pv-logo-row {
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     .42rem 1rem;
  background:  rgba(78,236,216,.05);
  border-top:  1px solid rgba(78,236,216,.1);
}
.pv-logo-badge {
  font-size:   .72rem;
  font-weight: 700;
  color:       var(--cyan);
}

.pv-actions {
  display:    flex;
  flex-wrap:  wrap;
  gap:        7px;
  padding:    .7rem 1rem .9rem;
}

.pv-btn-primary {
  flex:           1;
  background:     var(--cyan);
  color:          var(--black);
  border:         none;
  border-radius:  9px;
  padding:        .5rem .9rem;
  font-family:    'Nunito', sans-serif;
  font-size:      .8rem;
  font-weight:    800;
  cursor:         pointer;
  transition:     background .2s;
  white-space:    nowrap;
}
.pv-btn-primary:hover { background: var(--cyan2); }

.pv-btn-secondary {
  background:    var(--dark3);
  color:         var(--white);
  border:        1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  padding:       .5rem .85rem;
  font-family:   'Nunito', sans-serif;
  font-size:     .78rem;
  font-weight:   700;
  cursor:        pointer;
  transition:    all .2s;
  white-space:   nowrap;
}
.pv-btn-secondary:hover { border-color: rgba(78,236,216,.3); color: var(--cyan); }

.pv-btn-ghost {
  background:    none;
  color:         var(--gray);
  border:        1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  padding:       .5rem .75rem;
  font-family:   'Nunito', sans-serif;
  font-size:     .75rem;
  font-weight:   600;
  cursor:        pointer;
  transition:    all .2s;
  white-space:   nowrap;
}
.pv-btn-ghost:hover { color: var(--white); border-color: rgba(255,255,255,.22); }

@media (max-width: 768px) {
  .pv-card       { max-width: 96%; }
  .pv-btn-primary { flex: 1 1 100%; }
}

/* ── Hint Modal ── */
.hint-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeInOverlay 0.3s ease;
}

.hint-modal {
  background: rgba(10, 10, 10, 0.82);
  border: 1px solid rgba(78, 236, 216, 0.15);
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  animation: slideUpModal 0.3s ease;
}

.hint-modal-icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 10px;
}

.hint-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  margin: 0 0 10px;
}

.hint-modal-text {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  margin: 0 0 10px;
  line-height: 1.6;
}

.hint-modal-example {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.3);
  margin: 0 0 20px;
  line-height: 1.6;
  font-style: normal;
}

.hint-modal-example strong {
  color: rgba(78, 236, 216, 0.7);
}

.hint-modal-btn {
  background: rgba(78, 236, 216, 0.12);
  border: 1px solid rgba(78, 236, 216, 0.35);
  color: #4eECD8;
  border-radius: 8px;
  padding: 9px 28px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.hint-modal-btn:hover {
  background: rgba(78, 236, 216, 0.22);
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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