:root {
  /* Paleta oficial de Ceti */
  --ceti-primary: #2596be;
  --ceti-electric: #1a8cfb;
  --ceti-navy: #1b3a5c;
  --ceti-contorno: #0e2438;
  --ceti-gradient: linear-gradient(135deg, #2596be 0%, #1a8cfb 100%);

  /* Aliases usados por el resto del widget (apuntan a la paleta de Ceti) */
  --tic-navy-deep: #1b3a5c;
  --tic-navy-mid: #23557d;
  --tic-gold: #1a8cfb;
  --tic-gold-light: #2596be;
  --tic-off-white: #f2f7fb;
  --tic-ice: #d6e9f5;
}

/* ===== Página demo (no forma parte del widget) ===== */
.demo {
  max-width: 720px;
  margin: 12vh auto;
  padding: 0 24px;
  font-family: "Open Sans", Arial, sans-serif;
  color: var(--tic-navy-deep);
}
.demo h1 {
  font-family: "Montserrat", Arial, sans-serif;
  color: var(--tic-navy-deep);
}
.demo .hint {
  color: var(--tic-navy-mid);
  background: var(--tic-off-white);
  border-left: 3px solid var(--tic-gold);
  padding: 12px 16px;
  border-radius: 6px;
}

/* ===== Widget ===== */
.ctic-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: "Open Sans", Arial, sans-serif;
}

.ctic-toggle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: transparent;
  padding: 0;
  overflow: visible;
  transition: transform 0.15s ease;
  animation: ceti-pulse 2.8s ease-out infinite;
}
.ctic-toggle:hover {
  transform: scale(1.06);
}
.ctic-toggle-avatar {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  animation: ceti-bob 3s ease-in-out infinite;
}
.ctic-toggle-anim {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 50%;
  pointer-events: none; /* el clic lo maneja el botón */
  background: transparent;
}

/* Reposo: flota suave e invita al clic con un anillo pulsante. */
@keyframes ceti-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}
@keyframes ceti-pulse {
  0% {
    box-shadow: 0 6px 18px rgba(27, 58, 92, 0.4), 0 0 0 0 rgba(37, 150, 190, 0.5);
  }
  70% {
    box-shadow: 0 6px 18px rgba(27, 58, 92, 0.4), 0 0 0 14px rgba(37, 150, 190, 0);
  }
  100% {
    box-shadow: 0 6px 18px rgba(27, 58, 92, 0.4), 0 0 0 0 rgba(37, 150, 190, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ctic-toggle,
  .ctic-toggle-avatar {
    animation: none;
  }
}

/* El atributo hidden debe ocultar el panel pese al display:flex de abajo. */
.ctic-panel[hidden] {
  display: none;
}
/* Globo "¡Hola!" que aparece a los 3 s para invitar al clic. */
.ctic-nudge {
  position: absolute;
  right: 6px;
  bottom: 82px;
  background: #fff;
  color: var(--tic-navy-deep);
  font-weight: 700;
  font-size: 14px;
  padding: 9px 15px;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(27, 58, 92, 0.28);
  cursor: pointer;
  white-space: nowrap;
  z-index: 1;
  animation: ceti-nudge-in 0.35s cubic-bezier(0.18, 0.9, 0.32, 1.4) both;
}
.ctic-nudge::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
}
@keyframes ceti-nudge-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ctic-nudge {
    animation: none;
  }
}

.ctic-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 370px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(11, 30, 61, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ctic-header {
  background: linear-gradient(135deg, #1b3a5c 0%, #2596be 100%);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ctic-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(14, 36, 56, 0.35);
}
.ctic-header-text {
  flex: 1;
  min-width: 0;
}
.ctic-title {
  font-family: "Montserrat", Arial, sans-serif;
  font-weight: 700;
  font-size: 16px;
}
.ctic-subtitle {
  font-size: 12px;
  color: var(--tic-ice);
  margin-top: 2px;
}
.ctic-close,
.ctic-popout {
  background: transparent;
  border: none;
  color: #fff;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  flex-shrink: 0;
}
.ctic-close {
  font-size: 24px;
}
.ctic-popout {
  font-size: 18px;
}
.ctic-close:hover,
.ctic-popout:hover {
  opacity: 1;
}

/* ===== Modo ventana emergente (chat.html) ===== */
.ctic-widget.popup {
  position: static;
}
.ctic-widget.popup .ctic-toggle,
.ctic-widget.popup .ctic-popout {
  display: none;
}
.ctic-widget.popup .ctic-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}

.ctic-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--tic-off-white);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ctic-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ctic-msg.user {
  align-self: flex-end;
  background: var(--tic-navy-mid);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ctic-msg.assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--tic-navy-deep);
  border: 1px solid var(--tic-ice);
  border-bottom-left-radius: 4px;
}
.ctic-msg.typing {
  color: var(--tic-navy-mid);
  font-style: italic;
}
.ctic-msg a {
  color: var(--tic-navy-mid);
  font-weight: 600;
  text-decoration: underline;
  word-break: break-word;
}
.ctic-msg a:hover {
  color: var(--tic-gold);
}
.ctic-msg.user a {
  color: #fff;
}

.ctic-quote {
  align-self: stretch;
  background: #fff;
  border: 2px solid var(--tic-gold);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--tic-navy-deep);
}
.ctic-quote h4 {
  margin: 0 0 8px;
  font-family: "Montserrat", Arial, sans-serif;
  color: var(--tic-navy-deep);
}
.ctic-quote table {
  width: 100%;
  border-collapse: collapse;
}
.ctic-quote td {
  padding: 3px 0;
}
.ctic-quote .total {
  font-weight: 700;
  border-top: 1px solid var(--tic-ice);
  padding-top: 6px;
}

.ctic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: flex-start;
  max-width: 100%;
}
.ctic-chip {
  border: 1px solid var(--tic-gold);
  background: #fff;
  color: var(--tic-navy-deep);
  border-radius: 18px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ctic-chip:hover {
  background: var(--tic-gold);
  color: var(--tic-navy-deep);
}
.ctic-chip.nav {
  border-color: var(--tic-navy-mid);
  background: var(--tic-navy-mid);
  color: #fff;
}
.ctic-chip.nav:hover {
  background: var(--tic-navy-deep);
  color: #fff;
}

.ctic-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--tic-ice);
  background: #fff;
}
.ctic-menu-btn {
  border: 1px solid var(--tic-ice);
  background: #fff;
  color: var(--tic-navy-mid);
  width: 42px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.ctic-menu-btn:hover {
  background: var(--tic-off-white);
  color: var(--tic-navy-deep);
}

.ctic-input {
  flex: 1;
  border: 1px solid var(--tic-ice);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}
.ctic-input:focus {
  border-color: var(--tic-gold);
}
.ctic-send {
  border: none;
  background: var(--tic-gold);
  color: var(--tic-navy-deep);
  width: 42px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}
.ctic-send:hover {
  background: var(--tic-gold-light);
}
.ctic-send:disabled {
  opacity: 0.5;
  cursor: default;
}
