/* Aeromec chat — marca y contenedor; layout y chat los gestiona DTK */

.aeromec-chat-shell {
  --aeromec-blue: #100e4f;
  --aeromec-blue-dark: #005960;
  --aeromec-cyan: #31c8a2;
  --aeromec-ink: #0f172a;
  --aeromec-line-dark: rgba(15, 23, 42, 0.08);
  --aeromec-radius-md: 18px;
  --aeromec-chat-edge: 0.75rem;

  color: var(--aeromec-ink);
  height: 0;
  margin: 0;
  overflow: visible;
  pointer-events: none;
}

.aeromec-chat-shell .dtk-collapsible {
  pointer-events: auto;
}

.aeromec-chat-shell .dtk-collapsible.position-bottom-right {
  right: var(--aeromec-chat-edge);
  bottom: 1rem;
}

/* Panel flotante — solo envoltorio visual */
.aeromec-chat-shell .dtk-collapsible--fit-content .collapsible-panel {
  width: min(400px, calc(100vw - 32px));
  margin: 0 0 0.75rem;
  border: 1px solid rgba(16, 14, 79, 0.12);
  border-radius: var(--aeromec-radius-md);
  box-shadow: 0 20px 48px rgba(16, 14, 79, 0.18);
  overflow: hidden;
  background: #fff;
}

.aeromec-chat-shell .collapsible-header {
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid var(--aeromec-line-dark);
}

.aeromec-chat-shell .collapsible-title {
  margin: 0;
  font-family: 'Raleway', ui-sans-serif, system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--aeromec-ink);
  letter-spacing: -0.01em;
}

.aeromec-chat-shell .collapsible-close {
  border-radius: 10px;
}

/* FAB — glassmorphism */
.aeromec-chat-shell .collapsible-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: auto;
  max-width: calc(100vw - 2rem);
  min-height: 3.5rem;
  margin: 0;
  padding: 0.75rem 1.15rem 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(16, 14, 79, 0.72);
  backdrop-filter: blur(var(--aeromec-glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--aeromec-glass-blur)) saturate(180%);
  box-shadow:
    0 8px 32px rgba(16, 14, 79, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.aeromec-chat-shell .collapsible-launcher:hover {
  transform: translateY(-2px);
  background: rgba(16, 14, 79, 0.88);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow:
    0 12px 40px rgba(16, 14, 79, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.aeromec-chat-shell .collapsible-launcher:active {
  transform: translateY(0);
}

.aeromec-chat-shell .collapsible-launcher:focus-visible {
  outline: 2px solid var(--aeromec-cyan);
  outline-offset: 3px;
}

.aeromec-chat-shell .aeromec-chat-fab__icon {
  margin: 0 !important;
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.aeromec-chat-shell .aeromec-chat-fab__label {
  margin: 0 !important;
  font-family: 'Raleway', ui-sans-serif, system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
}

/* Tokens de marca del widget (DTK los consume vía --dtk-*) */
.aeromec-chat-shell .dtk-ai-chat-widget {
  --dtk-assistant-msg-bg: #f5f5f7;
  --dtk-assistant-msg-color: var(--aeromec-ink);
  --dtk-input-border: rgba(16, 14, 79, 0.18);
}

@media (max-width: 781px) {
  .aeromec-chat-shell .dtk-collapsible--fit-content .collapsible-panel {
    width: min(360px, calc(100vw - 24px));
  }

  .aeromec-chat-shell .collapsible-launcher {
    min-height: 3rem;
    padding: 0.65rem 1rem 0.65rem 0.85rem;
  }

  .aeromec-chat-shell .aeromec-chat-fab__label {
    font-size: 0.8125rem;
  }

  /* Evitar solapamiento con el overlay del menú móvil */
  body.aeromec-site:has(.aeromec-header__nav .wp-block-navigation__responsive-container.is-menu-open)
    .aeromec-chat-shell .dtk-collapsible {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(0.75rem);
    transition:
      opacity 0.2s ease,
      visibility 0.2s ease,
      transform 0.2s ease;
  }
}
