/* Licenciada Babeth — CTR. FAB inferior DERECHA, protagonismo alto */
.babeth-ctr-root {
  --babeth-blue: #1a3a5d;
  --babeth-blue-dark: #0f2438;
  --babeth-green: #2d8a70;
  --babeth-accent: #f39c12;
  --babeth-bg: #f8fafc;
  --babeth-panel: #ffffff;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  z-index: 10000;
  position: relative;
}

.babeth-ctr-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  max-width: calc(100vw - 2rem);
  padding: 0.85rem 1.15rem 0.85rem 0.85rem;
  border: 2px solid rgba(243, 156, 18, 0.85);
  border-radius: 1.25rem;
  background: linear-gradient(145deg, #1e4a78 0%, #0f2438 55%, #123048 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow:
    0 0 0 4px rgba(243, 156, 18, 0.22),
    0 12px 36px rgba(15, 36, 56, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 10001;
  text-align: left;
  animation: babeth-ctr-pulse 2.4s ease-in-out infinite;
}

@keyframes babeth-ctr-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(243, 156, 18, 0.2), 0 12px 36px rgba(15, 36, 56, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(243, 156, 18, 0.35), 0 14px 40px rgba(15, 36, 56, 0.5); }
}

.babeth-ctr-fab:hover,
.babeth-ctr-fab:focus-visible {
  transform: translateY(-3px) scale(1.02);
  animation: none;
  box-shadow:
    0 0 0 5px rgba(243, 156, 18, 0.4),
    0 16px 40px rgba(15, 36, 56, 0.55);
  outline: 2px solid #f39c12;
  outline-offset: 3px;
}

.babeth-ctr-fab-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #f39c12 0%, #e67e22 100%);
  color: #0f2438;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 900;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.babeth-ctr-fab-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.babeth-ctr-fab-label {
  white-space: nowrap;
  font-size: 1rem;
}

.babeth-ctr-fab-sub {
  font-weight: 600;
  font-size: 0.72rem;
  color: #fde68a;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .babeth-ctr-fab {
    padding: 0.75rem;
    border-radius: 999px;
  }
  .babeth-ctr-fab-text { display: none; }
  .babeth-ctr-fab-avatar {
    width: 3.1rem;
    height: 3.1rem;
    font-size: 1.35rem;
  }
}

.babeth-ctr-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: min(420px, calc(100vw - 2rem));
  height: min(620px, calc(100vh - 2rem));
  display: none;
  flex-direction: column;
  border-radius: 1.2rem;
  overflow: hidden;
  background: var(--babeth-panel);
  border: 2px solid #1a3a5d;
  box-shadow: 0 28px 56px rgba(15, 36, 56, 0.28);
  z-index: 10002;
}

.babeth-ctr-panel.is-open {
  display: flex;
  animation: babeth-ctr-in 0.22s ease;
}

@keyframes babeth-ctr-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.babeth-ctr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background: linear-gradient(145deg, #1a3a5d 0%, #0f2438 100%);
  color: #fff;
  border-bottom: 3px solid #f39c12;
}

.babeth-ctr-header-id {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.babeth-ctr-header-id strong { display: block; font-size: 0.95rem; }

.babeth-ctr-header-sub {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.9;
  margin-top: 0.12rem;
}

.babeth-ctr-header .babeth-ctr-fab-avatar {
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.05rem;
}

.babeth-ctr-close {
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.babeth-ctr-close:hover,
.babeth-ctr-close:focus-visible {
  background: rgba(243, 156, 18, 0.85);
  outline: none;
}

.babeth-ctr-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  background: var(--babeth-bg);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.babeth-ctr-msg {
  max-width: 94%;
  padding: 0.75rem 0.9rem;
  border-radius: 0.9rem;
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.babeth-ctr-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  border-bottom-left-radius: 0.25rem;
}

.babeth-ctr-msg--user {
  align-self: flex-end;
  background: #1a3a5d;
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.babeth-ctr-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.babeth-ctr-link {
  color: #1a3a5d;
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.babeth-ctr-msg--user .babeth-ctr-link { color: #fde68a; }

.babeth-ctr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  max-height: 8.5rem;
  overflow-y: auto;
}

.babeth-ctr-chip {
  border: 1px solid #c5d0de;
  background: #f1f5f9;
  color: #1a3a5d;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.babeth-ctr-chip:hover,
.babeth-ctr-chip:focus-visible {
  background: #fff7ed;
  border-color: #f39c12;
  outline: none;
}

.babeth-ctr-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem 0.9rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.babeth-ctr-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #c5d0de;
  border-radius: 0.65rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
}

.babeth-ctr-input:focus {
  outline: 2px solid #f39c12;
  outline-offset: 1px;
  border-color: #f39c12;
}

.babeth-ctr-send {
  border: none;
  border-radius: 0.65rem;
  padding: 0.55rem 0.9rem;
  background: #f39c12;
  color: #0f2438;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
}

.babeth-ctr-send:hover,
.babeth-ctr-send:focus-visible {
  background: #e67e22;
  outline: none;
}

@media (max-width: 600px) {
  .babeth-ctr-panel {
    right: 0.5rem;
    bottom: 0.5rem;
    width: calc(100vw - 1rem);
    height: min(75vh, calc(100vh - 4.5rem));
  }
  .babeth-ctr-fab {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}
