/* EnCorto (1-nov-2026): chat de soporte de encorto.app. Todo con prefijo .ecs- para no chocar con la página. */
#encorto-support-chat {
  --ecs-orange: #ff8200;
  --ecs-ember: #ff4d1f;
  --ecs-grad: linear-gradient(120deg, #ffb547 0%, #ff8200 45%, #ff4d1f 100%);
  --ecs-ink: #1a120c;
  --ecs-muted: #6b5f55;
  --ecs-line: #ece5de;
  --ecs-bg: #faf7f4;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ecs-ink);
  -webkit-font-smoothing: antialiased;
}
#encorto-support-chat *, #encorto-support-chat *::before, #encorto-support-chat *::after { box-sizing: border-box; }
#encorto-support-chat button { font: inherit; cursor: pointer; }
.ecs-hidden { display: none !important; }

/* Botón flotante */
.ecs-launcher {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
  height: 56px; padding: 0 20px 0 16px;
  border: 0; border-radius: 28px;
  background: var(--ecs-grad); color: #fff;
  font-weight: 600; letter-spacing: .1px;
  box-shadow: 0 10px 30px rgba(255, 77, 31, .35), 0 2px 6px rgba(0,0,0,.18);
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
}
.ecs-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(255, 77, 31, .45), 0 2px 6px rgba(0,0,0,.2); }
.ecs-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.ecs-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; border: 2px solid #fff;
  background: #e0002a; color: #fff; font-size: 12px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.ecs-has-unread .ecs-badge { display: flex; }
.ecs-open .ecs-launcher { display: none; }

/* Panel */
.ecs-panel {
  position: absolute; right: 0; bottom: 0;
  width: 370px; height: min(600px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: #fff; border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.15);
  opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none; visibility: hidden;
  transition: opacity .2s ease, transform .22s ease, visibility 0s linear .22s;
}
.ecs-open .ecs-panel { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity .2s ease, transform .22s ease; }

.ecs-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--ecs-grad); color: #fff; }
.ecs-avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden; }
.ecs-avatar img { width: 28px; height: 28px; object-fit: contain; }
.ecs-head__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ecs-head__text strong { font-size: 16px; }
.ecs-head__sub { font-size: 12.5px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ecs-head__btn { border: 0; background: rgba(255,255,255,.2); color: #fff; border-radius: 14px; height: 30px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.ecs-head__btn:hover { background: rgba(255,255,255,.32); }
.ecs-close { width: 32px; padding: 0; font-size: 22px; line-height: 30px; }

.ecs-body { flex: 1; overflow-y: auto; padding: 16px 14px 10px; background: var(--ecs-bg); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.ecs-row { display: flex; margin: 0 0 8px; }
.ecs-row--me { justify-content: flex-end; }
.ecs-bubble { max-width: 82%; padding: 9px 12px 6px; border-radius: 16px; background: #fff; border: 1px solid var(--ecs-line); box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.ecs-row--them .ecs-bubble { border-bottom-left-radius: 5px; }
.ecs-row--me .ecs-bubble { background: var(--ecs-orange); border-color: var(--ecs-orange); color: #fff; border-bottom-right-radius: 5px; }
.ecs-row--pending .ecs-bubble { opacity: .6; }
.ecs-text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.ecs-time { display: block; text-align: right; font-size: 11px; opacity: .65; margin-top: 2px; }
.ecs-file { display: block; margin-top: 6px; color: inherit; font-weight: 600; }
.ecs-file img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; }
.ecs-system { text-align: center; font-size: 12.5px; color: var(--ecs-muted); margin: 10px 8px 12px; }

.ecs-options { display: grid; gap: 8px; margin: 6px 0 10px; }
.ecs-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--ecs-line); background: #fff; color: var(--ecs-ink); font-weight: 600;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.ecs-option:hover, .ecs-option:focus-visible { border-color: var(--ecs-orange); box-shadow: 0 4px 14px rgba(255,130,0,.15); transform: translateY(-1px); outline: none; }
.ecs-option__icon { font-size: 20px; width: 26px; text-align: center; }
.ecs-alt { font-size: 13px; color: var(--ecs-muted); text-align: center; margin: 6px 0 4px; }
.ecs-alt a { color: var(--ecs-ember); font-weight: 600; }

.ecs-form { display: grid; gap: 10px; background: #fff; border: 1px solid var(--ecs-line); border-radius: 16px; padding: 14px; margin: 4px 0 8px; }
.ecs-field { display: grid; gap: 4px; margin: 0; }
.ecs-field__label { font-size: 12.5px; font-weight: 600; color: var(--ecs-muted); }
.ecs-form input, .ecs-form textarea, .ecs-input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ecs-ink);
  border: 1px solid #ddd3ca; border-radius: 12px; padding: 10px 12px; background: #fff;
  outline: none; resize: none; margin: 0; box-shadow: none;
}
.ecs-form input:focus, .ecs-form textarea:focus, .ecs-input:focus { border-color: var(--ecs-orange); box-shadow: 0 0 0 3px rgba(255,130,0,.15); }
.ecs-form textarea::placeholder, .ecs-input::placeholder, .ecs-form input::placeholder { color: #a99d93; }
.ecs-error { margin: 0; color: #c4001f; font-size: 13px; font-weight: 600; }
.ecs-primary { border: 0; border-radius: 14px; height: 46px; width: 100%; background: var(--ecs-grad); color: #fff; font-weight: 700; margin-top: 4px; }
.ecs-primary:hover { filter: brightness(1.04); }
.ecs-link { border: 0; background: none; color: var(--ecs-muted); font-size: 13px; padding: 4px; }

.ecs-connecting { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 10px; color: var(--ecs-muted); font-weight: 600; }
.ecs-dots { display: inline-flex; gap: 6px; }
.ecs-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--ecs-orange); animation: ecs-bounce 1s infinite ease-in-out; }
.ecs-dots i:nth-child(2) { animation-delay: .15s; }
.ecs-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ecs-bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

.ecs-foot { border-top: 1px solid var(--ecs-line); background: #fff; padding: 10px; }
.ecs-compose { display: flex; align-items: flex-end; gap: 8px; margin: 0; }
.ecs-input { min-height: 44px; max-height: 110px; }
.ecs-send { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--ecs-orange); color: #fff; display: flex; align-items: center; justify-content: center; }
.ecs-send:disabled { opacity: .5; }

@media (max-width: 560px) {
  #encorto-support-chat { right: 14px; bottom: 14px; }
  .ecs-launcher { height: 54px; width: 54px; padding: 0; justify-content: center; }
  .ecs-launcher__label { display: none; }
  #encorto-support-chat.ecs-open { left: 0; right: 0; top: 0; bottom: 0; }
  .ecs-open .ecs-panel { width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
  .ecs-panel { width: calc(100vw - 28px); }
}
@media (prefers-reduced-motion: reduce) {
  .ecs-panel, .ecs-launcher, .ecs-option { transition: none; }
  .ecs-dots i { animation: none; opacity: 1; }
}
