/* modules/chat-ryokan/chat-ryokan.css */

.ld-chat-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 8800;
  background: linear-gradient(135deg, var(--accent, #2c3a5c) 0%, #d9a95a 100%);
  color: #fff;
  border: none; border-radius: 999px; padding: 18px 28px;
  box-shadow:
    0 14px 32px rgba(217, 169, 90, 0.42),
    0 6px 14px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.20);
  cursor: pointer; font-size: 15.5px; font-weight: 500;
  display: inline-flex; gap: 12px; align-items: center;
  font-family: -apple-system, "Hiragino Mincho ProN", "Noto Serif JP", "Yu Mincho", serif;
  letter-spacing: 0.06em;
  transition: transform .25s ease, box-shadow .25s ease;
}
.ld-chat-fab::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(217, 169, 90, 0.55);
  animation: ld-fab-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes ld-fab-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(217, 169, 90, 0.55); }
  70%  { box-shadow: 0 0 0 18px rgba(217, 169, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 169, 90, 0); }
}
.ld-chat-fab:hover {
  transform: translateY(-3px);
  box-shadow:
    0 18px 38px rgba(217, 169, 90, 0.50),
    0 8px 18px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.ld-chat-fab__icon {
  font-size: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}
.ld-chat-fab__label { white-space: nowrap; }

.ld-chat-fab__hint {
  position: absolute;
  right: calc(100% + 12px); top: 50%;
  transform: translateY(-50%);
  background: #fff; color: #2a2418;
  padding: 8px 14px; border-radius: 8px;
  font-size: 12.5px; letter-spacing: 0.04em; font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  animation: ld-fab-hint 14s ease-in-out 4s 1 forwards;
  font-family: -apple-system, "Hiragino Mincho ProN", "Noto Serif JP", "Yu Mincho", serif;
}
.ld-chat-fab__hint::after {
  content: "";
  position: absolute;
  right: -5px; top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px; height: 10px;
  background: #fff;
}
.ld-chat-fab--hint-dismissed .ld-chat-fab__hint { display: none; }
@keyframes ld-fab-hint {
  0%   { opacity: 0; transform: translate(8px, -50%); }
  10%  { opacity: 1; transform: translate(0, -50%); }
  60%  { opacity: 1; transform: translate(0, -50%); }
  72%  { opacity: 0; transform: translate(0, -50%); }
  100% { opacity: 0; transform: translate(0, -50%); }
}

.ld-chat-panel {
  display: flex; flex-direction: column;
  min-height: 540px;
  flex: 1;
  font-family: -apple-system, "Hiragino Mincho ProN", "Noto Serif JP", "Yu Mincho", serif;
  color: #1a1714;
}
.ld-chat-panel__header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  margin-bottom: 14px;
}
.ld-chat-panel__title {
  font-size: 14px; font-weight: 500; letter-spacing: 0.04em;
}
.ld-chat-panel__lang {
  display: inline-flex; gap: 2px; background: rgba(0,0,0,0.04);
  border-radius: 4px; padding: 2px;
}
.ld-chat-panel__lang button {
  background: none; border: none; padding: 4px 9px;
  font-size: 11px; letter-spacing: 0.06em; cursor: pointer;
  color: #777; border-radius: 3px;
  font-family: "Cormorant Garamond", "EB Garamond", serif;
}
.ld-chat-panel__lang button.is-active {
  background: #1a1714; color: #fff;
}
.ld-chat-panel__demo-note {
  background: rgba(217, 169, 90, 0.10);
  border-left: 3px solid rgba(217, 169, 90, 0.65);
  color: #6b5a3a;
  font-size: 11.5px;
  line-height: 1.55;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}
.ld-chat-panel__body {
  display: flex; gap: 18px; padding: 4px 0;
  flex: 1; min-height: 0;
}
.ld-chat-panel__avatar {
  flex: 0 0 200px;
  display: flex; align-items: flex-start; justify-content: center;
}
.ld-chat-panel__log {
  flex: 1; overflow-y: auto; padding-right: 8px;
}
.ld-chat-bubble {
  padding: 11px 15px; border-radius: 14px; margin-bottom: 10px;
  max-width: 90%; line-height: 1.65; font-size: 14px;
  white-space: pre-wrap; word-break: break-word;
}
.ld-chat-bubble--assistant {
  background: #f4eee2; color: #2a2418;
  border-bottom-left-radius: 4px;
}
.ld-chat-bubble--user {
  background: var(--accent, #2c3a5c); color: #fff;
  margin-left: auto; border-bottom-right-radius: 4px;
}
.ld-chat-bubble--loading {
  opacity: 0.6; font-style: italic;
}
.ld-chat-panel__form {
  display: flex; gap: 8px;
  padding-top: 12px; margin-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.ld-chat-panel__input {
  flex: 1; padding: 11px 14px;
  border: 1px solid rgba(0,0,0,0.16); border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.ld-chat-panel__input:focus {
  outline: none; border-color: var(--accent, #2c3a5c);
}
.ld-chat-panel__send {
  padding: 11px 22px;
  background: var(--accent, #2c3a5c); color: #fff;
  border: none; border-radius: 6px; cursor: pointer;
  font-family: inherit; font-size: 14px; letter-spacing: 0.04em;
}
.ld-chat-panel__send:disabled {
  opacity: 0.5; cursor: wait;
}

/* Avatar */
.ld-avatar {
  position: relative;
  width: 200px; aspect-ratio: 1 / 1;
  border-radius: 12px; overflow: hidden;
  background: linear-gradient(160deg, #f4ede0 0%, #e7ddc9 100%);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  display: flex; align-items: center; justify-content: center;
}
.ld-avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  transition: opacity .35s ease;
  z-index: 2;
}
.ld-avatar__fallback {
  font-family: "Hiragino Mincho ProN","Noto Serif JP",serif;
  font-size: 56px; letter-spacing: 0.18em;
  color: #2c3a5c; opacity: 0.42;
  z-index: 1;
}
.ld-avatar--fallback { background: linear-gradient(160deg, #f4ede0 0%, #d8caa9 100%); }
.ld-avatar--fallback .ld-avatar__fallback { opacity: 0.92; }
.ld-avatar[data-mood="bow"] {
  animation: ld-bow 1.4s ease-in-out;
  transform-origin: bottom center;
}
@keyframes ld-bow {
  0% { transform: rotate(0); }
  40% { transform: rotate(6deg) translateY(3px); }
  100% { transform: rotate(0); }
}
.ld-avatar[data-mood="thinking"] {
  animation: ld-sway 2.2s ease-in-out infinite;
}
@keyframes ld-sway {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-2px); }
}

@media (max-width: 760px) {
  /* sticky-cta (約 64px 高、z-index 50) が画面下を占めるので FAB を上に逃がす */
  .ld-chat-fab { right: 14px; bottom: 88px; padding: 12px 18px; font-size: 14px; }
  .ld-chat-fab__icon { width: 26px; height: 26px; font-size: 19px; }
  .ld-chat-fab__hint { font-size: 11.5px; padding: 6px 11px; right: calc(100% + 9px); }
  .ld-chat-panel { min-height: 480px; }
  .ld-chat-panel__body { flex-direction: column; gap: 14px; }
  .ld-chat-panel__avatar { flex: 0 0 auto; }
  .ld-avatar { width: 140px; height: 140px; margin: 0 auto; }
  .ld-chat-panel__lang button { font-size: 10px; padding: 3px 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .ld-avatar[data-mood="bow"], .ld-avatar[data-mood="thinking"] {
    animation: none;
  }
  .ld-chat-fab:hover { transform: none; }
  .ld-chat-fab::after { animation: none; box-shadow: none; }
  .ld-chat-fab__hint { animation: none; opacity: 0; }
}
