/* KIRIHARA Online Academy — chat support widget */
.chat-widget {
  --chat-primary: #06807d;
  --chat-primary-dark: #056662;
  --chat-bg: #ffffff;
  --chat-text: #1a1a1a;
  --chat-muted: #5c6670;
  --chat-border: #e2e8f0;
  --chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
  --chat-panel-width: 400px;
  --chat-panel-height: 560px;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10050;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.chat-widget--mypage {
  bottom: 24px;
}

.chat-widget__launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: var(--chat-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--chat-shadow);
  transition: background 0.25s ease, transform 0.2s ease;
}

.chat-widget__launcher:hover,
.chat-widget__launcher:focus {
  background: var(--chat-primary-dark);
  outline: none;
}

.chat-widget__launcher:active {
  transform: scale(0.98);
}

.chat-widget__launcher-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.chat-widget.is-open .chat-widget__launcher {
  display: none;
}

.chat-widget__panel {
  display: none;
  flex-direction: column;
  width: var(--chat-panel-width);
  max-width: calc(100vw - 32px);
  height: var(--chat-panel-height);
  max-height: calc(100vh - 40px);
  background: var(--chat-bg);
  border-radius: 16px;
  box-shadow: var(--chat-shadow);
  overflow: hidden;
  border: 1px solid var(--chat-border);
}

.chat-widget.is-open .chat-widget__panel {
  display: flex;
}

.chat-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--chat-primary);
  color: #fff;
}

.chat-widget__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.chat-widget__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chat-widget__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.chat-widget__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafb;
}

.chat-widget__msg {
  max-width: 92%;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  word-break: break-word;
}

.chat-widget__msg--bot {
  background: #fff;
  border: 1px solid var(--chat-border);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}

.chat-widget__msg--user {
  margin-left: auto;
  background: var(--chat-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-widget__msg--loading {
  color: var(--chat-muted);
  font-style: italic;
}

.chat-widget__msg p {
  margin: 0 0 8px;
}

.chat-widget__msg p:last-child {
  margin-bottom: 0;
}

.chat-widget__links {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--chat-border);
}

.chat-widget__links a {
  display: block;
  margin-top: 4px;
  color: var(--chat-primary);
  text-decoration: none;
  font-size: 13px;
}

.chat-widget__links a:hover {
  text-decoration: underline;
}

.chat-widget__cta {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--chat-primary);
  color: #fff !important;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
}

.chat-widget__cta:hover {
  background: var(--chat-primary-dark);
}

.chat-widget__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
  background: #f8fafb;
}

.chat-widget__chip {
  padding: 6px 12px;
  border: 1px solid var(--chat-border);
  border-radius: 999px;
  background: #fff;
  color: var(--chat-text);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.chat-widget__chip:hover {
  border-color: var(--chat-primary);
  color: var(--chat-primary);
}

.chat-widget__footer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--chat-border);
  background: #fff;
}

.chat-widget__form {
  display: flex;
  gap: 8px;
}

.chat-widget__input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--chat-border);
  border-radius: 10px;
  font-size: 14px;
  resize: none;
  line-height: 1.4;
  max-height: 80px;
}

.chat-widget__input:focus {
  outline: none;
  border-color: var(--chat-primary);
  box-shadow: 0 0 0 2px rgba(6, 128, 125, 0.15);
}

.chat-widget__send {
  flex-shrink: 0;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: var(--chat-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chat-widget__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-widget__send:not(:disabled):hover {
  background: var(--chat-primary-dark);
}

.chat-widget__site-bar {
  padding: 8px 12px;
  background: #eef7f7;
  border-top: 1px solid var(--chat-border);
  text-align: center;
}

.chat-widget__site-bar a {
  color: var(--chat-primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.chat-widget__site-bar a:hover {
  text-decoration: underline;
}

.chat-widget--legacy-site {
  left: 20px;
  right: auto;
}

.chat-widget--legacy-site .chat-widget__panel {
  left: 0;
  right: auto;
}

.chat-widget__note {
  margin: 0;
  padding: 0 16px 8px;
  font-size: 11px;
  color: var(--chat-muted);
  background: #f8fafb;
}

/* Bootstrap / drawer より優先して Noto Sans JP を適用 */
.chat-widget,
.chat-widget * {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif !important;
}

@media (max-width: 767px) {
  .chat-widget {
    right: 12px;
    bottom: 12px;
  }

  .chat-widget--legacy-site {
    left: 12px;
    right: auto;
    bottom: 80px;
  }

  .chat-widget__panel {
    width: calc(100vw - 24px);
    height: min(80vh, 600px);
  }

  .chat-widget__launcher-label {
    display: none;
  }

  .chat-widget__launcher {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}
