/* ===== Language Switcher ===== */
.lang-switcher {
  position: relative;
  margin-right: 8px;
}

.lang-btn {
  background: none;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  color: #333;
  letter-spacing: 0.04em;
  transition: border-color 0.2s, background 0.2s;
  white-space: nowrap;
}

.lang-btn:hover {
  border-color: #9B4E20;
  color: #9B4E20;
}

.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  list-style: none;
  min-width: 110px;
  z-index: 200;
  overflow: hidden;
}

.lang-menu.open {
  display: block;
}

.lang-menu li {
  padding: 10px 16px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #444;
  transition: background 0.15s;
  font-family: 'Noto Sans JP', sans-serif;
}

.lang-menu li:hover,
.lang-menu li.lang-active {
  background: #f5ede8;
  color: #9B4E20;
  font-weight: 500;
}

/* Google Translate hidden widget */
#google_translate_element {
  display: none;
}

.goog-te-banner-frame,
.skiptranslate {
  display: none !important;
}

body {
  top: 0 !important;
}

/* ===== Chat Widget ===== */
.chat-widget {
  position: fixed;
  bottom: 88px;
  right: 26px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.chat-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #9B4E20;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(155,78,32,0.35);
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
}

.chat-toggle:hover {
  background: #7d3d18;
  transform: scale(1.08);
}

.chat-toggle svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.chat-box {
  display: none;
  flex-direction: column;
  width: 320px;
  max-height: 480px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  overflow: hidden;
}

.chat-box.open {
  display: flex;
}

.chat-header {
  background: #9B4E20;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-title {
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.chat-header-sub {
  font-size: 0.72rem;
  opacity: 0.8;
  margin-top: 2px;
}

.chat-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chat-close:hover {
  opacity: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
}

.chat-msg {
  max-width: 85%;
  font-size: 0.82rem;
  line-height: 1.7;
}

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
}

.chat-bubble {
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.65;
}

.chat-msg.bot .chat-bubble {
  background: #f4ede8;
  color: #333;
  border-radius: 4px 12px 12px 12px;
}

.chat-msg.user .chat-bubble {
  background: #9B4E20;
  color: #fff;
  border-radius: 12px 4px 12px 12px;
}

.chat-bubble a {
  color: #9B4E20;
  text-decoration: underline;
}

.chat-msg.bot .chat-bubble a {
  color: #9B4E20;
}

.chat-msg.user .chat-bubble a {
  color: #ffd;
}

.chat-quick {
  padding: 0 12px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-quick-btn {
  background: #fff;
  border: 1.5px solid #9B4E20;
  color: #9B4E20;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.76rem;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.chat-quick-btn:hover {
  background: #9B4E20;
  color: #fff;
}

.chat-input-row {
  display: flex;
  border-top: 1px solid #eee;
  padding: 8px 10px;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-family: 'Noto Sans JP', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #9B4E20;
}

.chat-send {
  background: #9B4E20;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.chat-send:hover {
  background: #7d3d18;
}

.chat-send svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.chat-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 8px 13px;
  background: #f4ede8;
  border-radius: 4px 12px 12px 12px;
  width: fit-content;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9B4E20;
  opacity: 0.5;
  animation: typing 1.2s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Notification badge */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e74c3c;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Mobile */
@media (max-width: 600px) {
  .chat-widget {
    bottom: 80px;
    right: 16px;
  }

  .chat-box {
    width: calc(100vw - 32px);
    max-height: 420px;
  }

  .lang-btn {
    font-size: 0.72rem;
    padding: 4px 8px;
  }
}
