/* Chatbot vitrine — orbe lumineux, plein ecran mobile */

body.na-chat-lock {
  overflow: hidden;
  touch-action: none;
}

.na-chat {
  --na-orb: 64px;
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 9600;
  font-family: var(--font-sans);
}

.na-chat__toggle {
  position: relative;
  width: var(--na-orb);
  height: var(--na-orb);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  isolation: isolate;
}

.na-chat__orb {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  animation: naOrbFloat 4.8s ease-in-out infinite;
}

.na-chat__orb-glow {
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(245, 230, 200, 0.55) 0%, rgba(201, 169, 98, 0.28) 38%, transparent 72%);
  filter: blur(6px);
  animation: naOrbPulse 3.2s ease-in-out infinite;
  pointer-events: none;
}

.na-chat__orb-core {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #1a1408;
  background:
    radial-gradient(circle at 32% 24%, #fff6e4 0%, #f0d9a8 18%, #c9a962 48%, #8d6f32 78%, #5c4718 100%);
  box-shadow:
    inset 0 2px 3px rgba(255, 248, 230, 0.75),
    inset 0 -10px 16px rgba(70, 48, 8, 0.45),
    0 0 0 1px rgba(255, 236, 190, 0.28),
    0 10px 28px rgba(0, 0, 0, 0.45),
    0 0 34px rgba(201, 169, 98, 0.5);
  overflow: hidden;
  animation: naOrbBreathe 4.8s ease-in-out infinite;
}

.na-chat__orb-shine {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: linear-gradient(
    118deg,
    transparent 32%,
    rgba(255, 255, 255, 0.08) 42%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.08) 58%,
    transparent 68%
  );
  animation: naOrbGleam 5.6s ease-in-out infinite;
  pointer-events: none;
}

.na-chat__toggle:hover .na-chat__orb-core,
.na-chat__toggle:focus-visible .na-chat__orb-core {
  box-shadow:
    inset 0 2px 3px rgba(255, 248, 230, 0.85),
    inset 0 -10px 16px rgba(70, 48, 8, 0.4),
    0 0 0 1px rgba(255, 236, 190, 0.45),
    0 12px 32px rgba(0, 0, 0, 0.5),
    0 0 46px rgba(232, 213, 163, 0.7);
}

.na-chat.is-open .na-chat__orb,
.na-chat.is-open .na-chat__orb-core,
.na-chat.is-open .na-chat__orb-shine,
.na-chat.is-open .na-chat__orb-glow {
  animation: none;
}

.na-chat.is-open .na-chat__orb-glow {
  opacity: 0.45;
}

@keyframes naOrbFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes naOrbBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

@keyframes naOrbPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.18); opacity: 1; }
}

@keyframes naOrbGleam {
  0% { transform: translateX(-28%) rotate(18deg); opacity: 0.35; }
  45%, 55% { opacity: 0.95; }
  100% { transform: translateX(28%) rotate(18deg); opacity: 0.35; }
}

.na-chat__panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(var(--na-orb) + 0.85rem);
  width: min(420px, calc(100vw - 2rem));
  height: min(72dvh, 680px);
  max-height: calc(100dvh - var(--na-orb) - 2.5rem);
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(24, 22, 18, 0.98) 0%, rgba(12, 12, 12, 0.98) 100%);
  border: 1px solid rgba(201, 169, 98, 0.32);
  border-radius: 14px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  overflow: hidden;
  backdrop-filter: blur(18px) saturate(1.15);
}

.na-chat.is-open .na-chat__panel {
  display: flex;
}

.na-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.8rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.na-chat__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--gold-light);
}

.na-chat__close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  border-radius: 50%;
}

.na-chat__close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.na-chat__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  -webkit-overflow-scrolling: touch;
}

.na-chat__msg {
  max-width: 88%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  font-size: 1rem;
  line-height: 1.55;
}

.na-chat__msg p { margin: 0; }

.na-chat__msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.na-chat__msg--user {
  align-self: flex-end;
  background: linear-gradient(160deg, rgba(232, 213, 163, 0.18), rgba(201, 169, 98, 0.1));
  border: 1px solid rgba(201, 169, 98, 0.22);
}

.na-chat__msg--error {
  align-self: flex-start;
  color: #ffb4b4;
}

.na-chat__msg--typing {
  align-self: flex-start;
  color: var(--text-dim);
}

.na-chat__msg a {
  color: var(--gold-light);
  text-decoration: underline;
}

.na-chat__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 1.05rem 0.85rem;
  flex-shrink: 0;
}

.na-chat__suggestions.is-hidden {
  display: none;
}

.na-chat__chip {
  font-size: 0.88rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 169, 98, 0.28);
  color: var(--gold-light);
  background: rgba(201, 169, 98, 0.08);
}

.na-chat__chip:hover:not(:disabled) {
  background: rgba(201, 169, 98, 0.16);
}

.na-chat__chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.na-chat__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.05rem calc(0.95rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.18);
}

.na-chat__input {
  flex: 1;
  height: 48px;
  padding: 0 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
}

.na-chat__input:focus {
  outline: none;
  border-color: var(--border-gold);
}

.na-chat__send {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #e8d5a3, #c9a962 55%, #9a8448);
  color: #1a1408;
  flex-shrink: 0;
}

.na-chat__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

@media (prefers-reduced-motion: reduce) {
  .na-chat__orb,
  .na-chat__orb-core,
  .na-chat__orb-shine,
  .na-chat__orb-glow {
    animation: none;
  }
}

@media (max-width: 720px) {
  .na-chat {
    right: 0;
    bottom: 0;
    left: 0;
    top: auto;
  }

  .na-chat__toggle {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .na-chat.is-open .na-chat__toggle {
    display: none;
  }

  .na-chat__panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    right: auto;
    bottom: auto;
    border-radius: 0;
    border: 0;
  }

  .na-chat__header {
    padding-top: max(0.85rem, env(safe-area-inset-top));
  }
}

@media (min-width: 721px) {
  .na-chat.is-open .na-chat__toggle {
    transform: scale(0.92);
  }
}
