/* Depósito Trujillo — storefront assistant FAB + panel (high visibility) */
.dt-assistant {
  --dt-asst-bg: #0f2744;
  --dt-asst-accent: #ffc107;
  --dt-asst-accent-hot: #ffb300;
  --dt-asst-panel: #ffffff;
  --dt-asst-text: #1a1a1a;
  --dt-asst-muted: #5c6670;
  --dt-asst-radius: 14px;
  --dt-asst-shadow: 0 12px 40px rgba(15, 39, 68, 0.32);
  /* Athlete2 sets --ox-bnav-height on :root; mobile rules fall back to 56px */
  --dt-asst-safe: env(safe-area-inset-bottom, 0px);
  font-family: inherit;
  z-index: 10040;
}

@keyframes dt-asst-pulse {
  0%,
  100% {
    box-shadow:
      0 12px 36px rgba(15, 39, 68, 0.55),
      0 0 0 0 rgba(255, 193, 7, 0.55);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 16px 44px rgba(15, 39, 68, 0.6),
      0 0 0 14px rgba(255, 193, 7, 0.15);
    transform: scale(1.03);
  }
}

@keyframes dt-asst-wiggle {
  0%,
  88%,
  100% {
    transform: rotate(0deg);
  }
  90% {
    transform: rotate(-8deg);
  }
  94% {
    transform: rotate(8deg);
  }
  97% {
    transform: rotate(-4deg);
  }
}

.dt-assistant__fab {
  position: fixed;
  right: 1.25rem;
  /* Desktop: modest offset (no ox_bnav). Mobile overrides below. */
  bottom: 1.25rem;
  z-index: 10050;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 56px;
  max-width: calc(100vw - 1.5rem);
  padding: 0.85rem 1.35rem 0.85rem 1rem;
  border: 3px solid #0f2744;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd54f 0%, var(--dt-asst-accent) 55%, var(--dt-asst-accent-hot) 100%);
  color: #0f2744;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
  cursor: pointer;
  box-shadow:
    0 12px 36px rgba(15, 39, 68, 0.55),
    0 0 0 5px rgba(255, 193, 7, 0.4);
  animation:
    dt-asst-pulse 2.2s ease-in-out infinite,
    dt-asst-wiggle 5.5s ease-in-out infinite;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    bottom 0.2s ease;
}

.dt-assistant__fab:hover,
.dt-assistant__fab:focus-visible {
  background: linear-gradient(180deg, #ffe082 0%, #ffca28 50%, #ffb300 100%);
  outline: 3px solid #0f2744;
  outline-offset: 4px;
  animation: none;
  transform: scale(1.05);
  box-shadow:
    0 16px 44px rgba(15, 39, 68, 0.6),
    0 0 0 6px rgba(255, 193, 7, 0.45);
}

.dt-assistant__fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: #0f2744;
  color: #ffc107;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.dt-assistant__fab-label {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.dt-assistant__panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5rem;
  z-index: 10051;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 1.5rem));
  height: min(560px, calc(100vh - 8rem));
  background: var(--dt-asst-panel);
  color: var(--dt-asst-text);
  border-radius: var(--dt-asst-radius);
  border: 2px solid var(--dt-asst-bg);
  box-shadow: var(--dt-asst-shadow);
  overflow: hidden;
}

.dt-assistant__panel[hidden] {
  display: none !important;
}

.dt-assistant__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.95rem 1.1rem;
  background: var(--dt-asst-bg);
  color: #fff;
}

.dt-assistant__title {
  font-size: 1rem;
  font-weight: 700;
}

.dt-assistant__close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
  min-width: 44px;
  min-height: 44px;
}

.dt-assistant__messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.95rem 1.1rem;
  background: #f4f6f8;
  -webkit-overflow-scrolling: touch;
}

.dt-assistant__bubble {
  max-width: 92%;
  margin-bottom: 0.65rem;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.dt-assistant__bubble--bot {
  background: #fff;
  color: var(--dt-asst-text);
  border: 1px solid #e2e6ea;
  border-bottom-left-radius: 4px;
}

.dt-assistant__bubble--user {
  margin-left: auto;
  background: var(--dt-asst-bg);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.dt-assistant__bubble--error {
  background: #fdecea;
  color: #8a1f11;
  border: 1px solid #f5c6cb;
}

.dt-assistant__form {
  display: flex;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid #e2e6ea;
  background: #fff;
  /* Keep composer above iOS home indicator when panel is open */
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
}

.dt-assistant__input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.8rem;
  border: 1px solid #cfd6dd;
  border-radius: 8px;
  font-size: 16px; /* avoid iOS zoom on focus */
}

.dt-assistant__send {
  flex-shrink: 0;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--dt-asst-accent);
  color: #0f2744;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 44px;
}

.dt-assistant__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dt-assistant__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -------------------------------------------------------------------------- */
/* Mobile: clear Athlete2 #ox_bnav / .ox_bnav via --ox-bnav-height            */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .dt-assistant__fab {
    right: 0.75rem;
    bottom: calc(var(--ox-bnav-height, 56px) + 12px + var(--dt-asst-safe));
    min-height: 48px;
    padding: 0.55rem 0.9rem 0.55rem 0.7rem;
    font-size: 0.9rem;
    gap: 0.4rem;
    /* Quieter on small screens — no infinite wiggle/pulse */
    animation: none;
    box-shadow:
      0 8px 24px rgba(15, 39, 68, 0.45),
      0 0 0 3px rgba(255, 193, 7, 0.35);
  }

  .dt-assistant__fab:hover,
  .dt-assistant__fab:focus-visible {
    transform: scale(1.03);
  }

  .dt-assistant__fab-icon {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 1.1rem;
  }

  .dt-assistant__panel {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    bottom: calc(var(--ox-bnav-height, 56px) + 64px + var(--dt-asst-safe));
    /* vh fallback first */
    height: min(70vh, calc(100vh - var(--ox-bnav-height, 56px) - 5.5rem));
    max-height: calc(100vh - var(--ox-bnav-height, 56px) - 5rem);
  }

  @supports (height: 100dvh) {
    .dt-assistant__panel {
      height: min(70dvh, calc(100dvh - var(--ox-bnav-height, 56px) - 5.5rem));
      max-height: calc(100dvh - var(--ox-bnav-height, 56px) - 5rem);
    }
  }
}

/* Very narrow phones: icon-only FAB (label still in title / aria-label) */
@media (max-width: 480px) {
  .dt-assistant__fab {
    min-width: 48px;
    min-height: 48px;
    width: 48px;
    height: 48px;
    padding: 0;
    justify-content: center;
    gap: 0;
    border-radius: 50%;
  }

  .dt-assistant__fab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .dt-assistant__fab-icon {
    width: 1.85rem;
    height: 1.85rem;
    font-size: 1.15rem;
  }

  .dt-assistant__bubble {
    font-size: 0.9rem;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .dt-assistant__fab {
    animation: none;
  }
}
