/* ============================================================
   SOPORTE (CHAT EN VIVO) - compartido landing + app
   ============================================================ */

.soporte-widget { position: fixed; right: 22px; bottom: 42px; z-index: 99999; font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif; }
.soporte-widget, .soporte-widget * { box-sizing: border-box; }
.soporte-widget [hidden] { display: none !important; }

.soporte-btn {
  position: relative;
  width: 62px; height: 62px; border-radius: 50%; cursor: pointer;
  background: #0c1613; border: 2px solid #16c784;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(22, 199, 132, .35);
  transition: transform .2s, box-shadow .2s;
}
.soporte-btn:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 16px 40px rgba(22, 199, 132, .55); }
.soporte-btn img { width: 38px; height: 38px; object-fit: contain; }
.soporte-btn::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(22, 199, 132, .45);
  animation: soportePulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes soportePulse {
  0% { transform: scale(.9); opacity: .8; }
  70% { transform: scale(1.3); opacity: 0; }
  100% { opacity: 0; }
}

.soporte-panel {
  position: absolute; right: 0; bottom: 76px; width: 380px; max-width: calc(100vw - 40px);
  height: 620px; max-height: calc(100vh - 110px);
  background: #0b1411; border: 1px solid rgba(255, 255, 255, .1); border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .7); overflow: hidden;
  display: flex; flex-direction: column; animation: soporteIn .22s ease;
}
@keyframes soporteIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.soporte-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(22, 199, 132, .2), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  color: #f1f7f4;
}
.soporte-head-info { display: flex; align-items: center; gap: 11px; }
.soporte-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: contain;
  background: #0c1613; border: 1px solid rgba(22, 199, 132, .5); padding: 5px;
}
.soporte-head b { display: block; color: #f1f7f4; font-size: 15px; line-height: 1.2; }
.soporte-sub { color: #16c784; font-size: 12px; margin-top: 2px; }
.soporte-x { background: none; border: 0; color: #93a8a0; font-size: 28px; cursor: pointer; line-height: 1; }
.soporte-x:hover { color: #f1f7f4; }

.soporte-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.soporte-form { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.soporte-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #93a8a0; }
.soporte-form input, .soporte-form textarea {
  background: #0d1714; border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px;
  color: #f1f7f4; padding: 11px 12px; font-family: inherit; font-size: 16px; width: 100%;
}
.soporte-form input:focus, .soporte-form textarea:focus { outline: none; border-color: #16c784; }
.soporte-iniciar {
  margin-top: 4px; width: 100%; border: 0; cursor: pointer;
  padding: 14px 18px; border-radius: 12px;
  background: linear-gradient(135deg, #16c784, #0e9f68);
  color: #04170c; font-weight: 800; font-size: 15px; letter-spacing: .2px;
  box-shadow: 0 8px 22px rgba(22, 199, 132, .35);
  transition: transform .18s, box-shadow .18s, filter .18s;
}
.soporte-iniciar:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(22, 199, 132, .5); filter: brightness(1.06); }
.soporte-iniciar:active { transform: translateY(0); }

#soporteChat { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

.soporte-mensajes {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.soporte-mensajes.admin { max-height: 460px; min-height: 280px; }

.soporte-msg {
  max-width: 82%; padding: 9px 12px; border-radius: 14px;
  font-size: 14px; line-height: 1.4; word-wrap: break-word;
}
.soporte-msg img { max-width: 100%; border-radius: 10px; display: block; margin-top: 4px; }
.soporte-msg.cliente {
  align-self: flex-end; background: linear-gradient(135deg, #16c784, #0e9f68);
  color: #04170c; border-bottom-right-radius: 4px;
}
.soporte-msg.admin {
  align-self: flex-start; background: #0d1714; border: 1px solid rgba(255, 255, 255, .1);
  color: #f1f7f4; border-bottom-left-radius: 4px;
}
.soporte-hora { font-size: 10px; opacity: .65; margin-top: 4px; text-align: right; }

.soporte-escribir {
  display: flex; align-items: center; gap: 8px; padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08); background: #0b1411;
}
.soporte-escribir input {
  flex: 1 1 auto; width: auto; min-width: 0; margin: 0; font-size: 16px; font-family: inherit;
  background: #0d1714; border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px; color: #f1f7f4; padding: 12px 14px;
}
.soporte-escribir input:focus { outline: none; border-color: #16c784; }
.soporte-adjuntar {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: 0 0 auto; margin: 0;
  cursor: pointer; font-size: 20px; border-radius: 10px; line-height: 1;
}
.soporte-adjuntar:hover { background: #0d1714; }
.soporte-adjuntar input[type="file"],
.soporte-escribir input[type="file"],
.soporte-form input[type="file"] { display: none !important; }
.soporte-enviar {
  width: 46px; height: 46px; border-radius: 50%; border: 0; flex: 0 0 auto;
  background: linear-gradient(135deg, #16c784, #0e9f68); color: #04170c;
  font-size: 19px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(22, 199, 132, .35); transition: transform .18s, box-shadow .18s;
}
.soporte-enviar:hover { transform: translateY(-1px) scale(1.03); box-shadow: 0 10px 22px rgba(22, 199, 132, .5); }
.soporte-enviar:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

.soporte-preview { padding: 6px 16px; font-size: 12px; color: #16c784; border-top: 1px solid rgba(255, 255, 255, .08); }
.soporte-cerrada {
  padding: 10px 16px; font-size: 13px; color: #f59e0b; text-align: center;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.link { background: none; border: 0; color: #16c784; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.badge-nuevo {
  display: inline-block; min-width: 20px; padding: 2px 7px; border-radius: 10px;
  background: #ef4444; color: #fff; font-size: 12px; font-weight: 700; text-align: center;
}
.btn-mini { padding: 6px 12px; font-size: 13px; }
.estado-rechazada { background: rgba(239, 68, 68, .15); color: #ef4444; }

@media (max-width: 768px) {
  .soporte-widget { right: 14px; bottom: 30px; }
  .soporte-panel {
    position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh;
    max-width: none; max-height: none; border-radius: 0; border: 0;
  }
  .soporte-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .soporte-escribir { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .soporte-escribir.admin { position: sticky; bottom: 0; z-index: 5; padding: 8px; }
  .soporte-mensajes.admin { max-height: 50vh; min-height: 180px; }
  .soporte-enviar { width: 48px; height: 48px; }
  .soporte-adjuntar { font-size: 18px; padding: 4px; }
  .chat-card { padding: 8px; }
}
