/* ===== ANPANI AI — Luxury Dark Glass ===== */

.anpani-ai{
  --lux-bg: rgba(10, 10, 12, 0.82);
  --lux-surface: rgba(255, 255, 255, 0.04);
  --lux-border: rgba(255, 255, 255, 0.08);
  --lux-border-soft: rgba(255, 255, 255, 0.05);
  --lux-highlight: rgba(255, 255, 255, 0.06);
  --lux-text: rgba(255, 255, 255, 0.92);
  --lux-text-muted: rgba(255, 255, 255, 0.42);
  --lux-text-bot: rgba(235, 235, 238, 0.88);
  --lux-shadow: 0 20px 56px rgba(0, 0, 0, 0.38);
  --lux-shadow-float: 0 7px 22px rgba(0, 0, 0, 0.22);
  --lux-radius-panel: 20px;
  --lux-radius-bubble: 20px;
  --lux-radius-cta: 17px;
  --lux-radius-input: 17px;
  --lux-radius-btn: 15px;
  --lux-blur: blur(15px) saturate(1.25);
  --lux-accent: rgba(205, 33, 42, 0.55);
  --lux-accent-ring: rgba(205, 33, 42, 0.35);
  --lux-accent-glow: rgba(205, 33, 42, 0.18);
  --lux-input-h: 47px;

  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 99999;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
}

/* ===== FAB ===== */

.anpani-ai__fab{
  position: relative;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  padding: 12px 18px;
  background: rgba(12, 12, 14, 0.88);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 16px 44px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: var(--lux-blur);
  -webkit-backdrop-filter: var(--lux-blur);
}

.anpani-ai__fab::after{
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0);
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  animation: anpaniLuxPulse 9s ease-in-out infinite;
}

.anpani-ai__fab::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  animation: anpaniLuxPulseInner 9s ease-in-out infinite;
}

@keyframes anpaniLuxPulse{
  0%, 100%{ opacity: 0; border-color: transparent; box-shadow: none; }
  6%{
    opacity: 1;
    border-color: rgba(205, 33, 42, 0.35);
    box-shadow: 0 0 0 1px rgba(205, 33, 42, 0.12);
  }
  12%{ opacity: 0; border-color: transparent; box-shadow: none; }
}

@keyframes anpaniLuxPulseInner{
  0%, 100%{ opacity: 0; box-shadow: none; }
  6%{ opacity: 1; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
  12%{ opacity: 0; box-shadow: none; }
}

.anpani-ai__fab.no-pulse::after,
.anpani-ai__fab.no-pulse::before{
  animation: none !important;
}

.anpani-ai__fab:hover,
.anpani-ai__fab:focus,
.anpani-ai__fab:active{
  background: rgba(14, 14, 16, 0.92) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  transform: none !important;
}

/* ===== PANEL ===== */

.anpani-ai__panel{
  width: 380px;
  margin-bottom: 12px;
  border-radius: var(--lux-radius-panel);
  background: var(--lux-bg);
  border: 1px solid var(--lux-border);
  color: var(--lux-text);
  backdrop-filter: var(--lux-blur);
  -webkit-backdrop-filter: var(--lux-blur);
  box-shadow:
    var(--lux-shadow),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
  will-change: transform, opacity;
  overflow: hidden;
}

.anpani-ai__panel:not([hidden]){
  transform: translateY(0);
  opacity: 1;
}

/* ===== HEADER ===== */

.anpani-ai__header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 15px;
  border-bottom: 1px solid var(--lux-border-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, transparent 100%);
}

.anpani-ai__title{
  font-weight: 800;
  letter-spacing: 0.1em;
  font-size: 13px;
}

.anpani-ai__subtitle{
  font-size: 12px;
  opacity: 0.55;
  margin-top: 5px;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.anpani-ai__actions{
  display: flex;
  gap: 8px;
  align-items: center;
}

.anpani-ai__clear{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.anpani-ai__clear,
.anpani-ai__close{
  height: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 11px;
  border-radius: var(--lux-radius-btn);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  line-height: 1;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 3px 10px rgba(0, 0, 0, 0.14) !important;
  outline: none !important;
  color: rgba(255, 255, 255, 0.88);
}

.anpani-ai__clear::before{
  content: "";
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  line-height: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.88)' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3Cpath d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/%3E%3C/svg%3E");
  background-size: 14px 14px;
  background-repeat: no-repeat;
  background-position: center;
  transform: translateY(2.5px);
}

.anpani-ai__close{
  width: 34px;
  padding: 0;
  font-size: 17px;
}

.anpani-ai__clear:hover,
.anpani-ai__close:hover{
  background: rgba(17, 17, 17, 0.55) !important;
  border-color: var(--lux-accent) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px var(--lux-accent-ring),
    0 6px 18px var(--lux-accent-glow) !important;
  color: #fff !important;
}

.anpani-ai__clear:focus,
.anpani-ai__close:focus{
  outline: none !important;
  border-color: var(--lux-accent) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px var(--lux-accent-ring),
    0 4px 14px var(--lux-accent-glow) !important;
}

/* ===== BODY / TYPOGRAPHY ===== */

.anpani-ai__body{
  padding: 10px 16px 22px;
  max-height: 420px;
  overflow: auto;
  overflow-x: hidden;
  scroll-padding-top: 8px;
  scroll-padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  line-height: 1.58;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.10) transparent;
}

.anpani-ai__body p{
  margin: 0 0 8px;
}

.anpani-ai__body p:last-child{
  margin-bottom: 0;
}

.anpani-ai__body br{
  line-height: 1.58;
}

.anpani-ai__answertext{
  opacity: 1;
  white-space: pre-wrap;
  margin: 0;
  color: var(--lux-text-bot);
  line-height: 1.58;
  font-weight: 400;
  letter-spacing: 0.005em;
}

/* ===== MESSAGE BUBBLES — shared glass shell ===== */

.anpani-ai__msg{
  width: fit-content;
  max-width: 86%;
  box-sizing: border-box;
  opacity: 0;
  transform: translateY(5px);
  animation: anpaniMsgIn 0.26s ease forwards;
  position: relative;
  overflow: visible;
  border-radius: var(--lux-radius-bubble);
  padding: 11px 14px;
  border: 1px solid var(--lux-border-soft);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.02) 100%),
    var(--lux-surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    var(--lux-shadow-float),
    inset 0 1px 0 var(--lux-highlight),
    inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

@keyframes anpaniMsgIn{
  to{
    opacity: 1;
    transform: translateY(0);
  }
}

.anpani-ai__msg--bot{
  align-self: flex-start;
  max-width: 86%;
  color: var(--lux-text-bot);
  font-weight: 400;
  line-height: 1.58;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.032) 0%, rgba(255, 255, 255, 0.006) 42%, rgba(0, 0, 0, 0.06) 100%),
    rgba(6, 6, 8, 0.52);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.anpani-ai__msg--bot:has(.anpani-ai-linkcard){
  padding-bottom: 10px;
}

.anpani-ai__msg--bot .anpani-ai__answertext{
  color: var(--lux-text-bot);
}

.anpani-ai__msg--user{
  align-self: flex-end;
  max-width: 72%;
  margin-top: 9px;
  color: rgba(255, 255, 255, 0.94);
  font-weight: 400;
  line-height: 1.56;
  letter-spacing: 0.005em;
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

/* hide leaf / avatar icons on bot messages */
.anpani-ai__msg--bot img,
.anpani-ai__msg--bot svg,
.anpani-ai__msg--bot .anpani-ai__avatar,
.anpani-ai__msg--bot .anpani-ai__icon,
.anpani-ai__msg--bot [class*="leaf"],
.anpani-ai__msg--bot [class*="avatar"]{
  display: none !important;
}

/* ===== CTA LINK CARDS ===== */

.anpani-ai__msg--bot .anpani-ai-linkcard{
  margin: 10px 0 4px 0;
}

.anpani-ai-linkcard{
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 11px 0 0 0;
  padding: 9px 14px;
  border-radius: var(--lux-radius-cta);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: rgba(255, 255, 255, 0.92) !important;
  text-decoration: none !important;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.015em;
  line-height: 1.45;
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 3px 12px rgba(0, 0, 0, 0.12);
}

.anpani-ai-linkcard:hover,
.anpani-ai-linkcard:focus{
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--lux-accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px var(--lux-accent-ring),
    0 6px 18px var(--lux-accent-glow);
  transform: translateY(-1px);
  color: #fff !important;
}

/* ===== FOOTER / INPUT ===== */

.anpani-ai__footer{
  display: flex;
  gap: 9px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--lux-border-soft);
  align-items: center;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0%, transparent 100%);
}

.anpani-ai__footer input{
  flex: 1;
  height: var(--lux-input-h);
  border-radius: var(--lux-radius-input);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 3px 12px rgba(0, 0, 0, 0.10);
  color: rgba(255, 255, 255, 0.92);
  padding: 0 16px;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.anpani-ai__footer input::placeholder{
  color: var(--lux-text-muted);
  opacity: 1;
}

.anpani-ai__footer input:focus{
  border-color: var(--lux-accent);
  background: rgba(255, 255, 255, 0.045);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px var(--lux-accent-ring),
    0 6px 18px var(--lux-accent-glow);
  outline: none;
}

/* ===== SEND BUTTON (icon only) ===== */

.anpani-ai__footer button{
  height: var(--lux-input-h);
  border-radius: var(--lux-radius-input);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 3px 12px rgba(0, 0, 0, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.anpani-ai__footer button:hover{
  background: rgba(17, 17, 17, 0.55);
  border-color: var(--lux-accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px var(--lux-accent-ring),
    0 6px 18px var(--lux-accent-glow);
  color: #fff;
}

#anpani-ai-send{
  width: var(--lux-input-h);
  min-width: var(--lux-input-h);
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
  text-indent: -9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

#anpani-ai-send::before{
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  text-indent: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.92)' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2L15 22L11 13L2 9L22 2Z'/%3E%3C/svg%3E");
  background-size: 18px 18px;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  transition: transform 0.22s ease;
}

#anpani-ai-send:hover::before{
  transform: translate(1px, -1px);
}

/* ===== PANEL OPEN STATE ===== */

.anpani-ai[data-panel-open] .anpani-ai__fab,
.anpani-ai__fab[hidden]{
  display: none !important;
}

/* ===== MOBILE ===== */

@media (max-width: 760px){
  .anpani-ai__fab{
    box-shadow:
      0 14px 40px rgba(0, 0, 0, 0.30),
      inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
  }

  .anpani-ai__panel{
    width: calc(100vw - 28px) !important;
    max-width: 420px;
    margin-left: auto;
    margin-right: 0;
  }

  .anpani-ai__body{
    max-height: 52vh;
    padding: 10px 14px 20px;
    scroll-padding-top: 8px;
    scroll-padding-bottom: 14px;
    gap: 11px;
  }

  .anpani-ai__footer{
    padding: 12px 14px 14px;
    gap: 8px;
  }

  .anpani-ai__footer input{
    min-width: 0;
    font-size: 16px;
  }

  .anpani-ai__footer button{
    flex: 0 0 auto;
    padding: 0;
  }

  .anpani-ai__msg{
    font-size: 15px;
    line-height: 1.56;
    max-width: 90%;
  }

  .anpani-ai__msg--bot{
    max-width: 90%;
  }

  .anpani-ai__msg--user{
    max-width: 78%;
    margin-top: 8px;
  }

  .anpani-ai-linkcard{
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 10px 0 0 0;
    padding: 8px 12px;
    border-radius: var(--lux-radius-cta);
    font-size: 14px;
    line-height: 1.44;
  }
}

/* ===== FINAL OVERRIDES v1.0.5 — wins cascade / theme conflicts ===== */

.anpani-ai .anpani-ai__body .anpani-ai__msg.anpani-ai__msg--bot{
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.026) 0%, rgba(255, 255, 255, 0.004) 38%, rgba(0, 0, 0, 0.12) 100%),
    rgba(4, 4, 6, 0.60) !important;
  backdrop-filter: blur(12px) saturate(1.12) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.065) !important;
  box-shadow:
    0 3px 12px rgba(0, 0, 0, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.034),
    inset 0 0 0 1px rgba(255, 255, 255, 0.016) !important;
  line-height: 1.58;
  font-weight: 400;
}

.anpani-ai .anpani-ai__body .anpani-ai__msg.anpani-ai__msg--bot:has(.anpani-ai-linkcard){
  padding-bottom: 10px;
}

.anpani-ai .anpani-ai__body .anpani-ai__msg.anpani-ai__msg--user{
  align-self: flex-end;
  width: fit-content;
  max-width: 72%;
  margin-top: 9px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.036) 0%, rgba(255, 255, 255, 0.010) 100%),
    rgba(255, 255, 255, 0.034) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.034),
    inset 0 0 0 1px rgba(255, 255, 255, 0.016) !important;
  line-height: 1.56;
  font-weight: 400;
}

.anpani-ai .anpani-ai__body .anpani-ai__answertext{
  line-height: 1.58;
  font-weight: 400;
}

.anpani-ai .anpani-ai-linkcard,
.anpani-ai .anpani-ai__msg--bot .anpani-ai-linkcard{
  padding: 9px 14px !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
}

.anpani-ai .anpani-ai__msg--bot .anpani-ai-linkcard{
  margin: 10px 0 4px 0 !important;
}

.anpani-ai .anpani-ai__clear{
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.anpani-ai .anpani-ai__clear::before{
  content: "" !important;
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  line-height: 1 !important;
  transform: translateY(2.5px) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.88)' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3Cpath d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/%3E%3C/svg%3E") !important;
  background-size: 14px 14px !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

@media (max-width: 760px){
  .anpani-ai .anpani-ai__body .anpani-ai__msg.anpani-ai__msg--user{
    max-width: 78%;
    margin-top: 8px;
  }

  .anpani-ai .anpani-ai-linkcard,
  .anpani-ai .anpani-ai__msg--bot .anpani-ai-linkcard{
    padding: 8px 12px !important;
  }
}
