/* 은빛날개 홈페이지 상담 챗봇 */

:root {
  --sw-chat-olive: #425414;
  --sw-chat-olive2: #66752f;
  --sw-chat-cream: #faf7ed;
  --sw-chat-line: #ded8c7;
  --sw-chat-ink: #25271f;
  --sw-chat-muted: #67695f;
}

#sw-chatbot-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: Pretendard, "Noto Sans KR", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.sw-chat-support-entry {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  background: #fff;
  color: var(--sw-chat-olive);
  border: 1.5px solid var(--sw-chat-olive);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(51, 61, 24, 0.16);
  white-space: nowrap;
}

.sw-chat-support-entry:hover {
  background: #f3f6e8;
}

.sw-chat-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 64px;
  min-height: 64px;
  padding: 8px 10px;
  border: none;
  border-radius: 18px;
  background: var(--sw-chat-olive);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(51, 61, 24, 0.28);
}

.sw-chat-toggle-icon {
  font-size: 20px;
  line-height: 1;
}

.sw-chat-toggle-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.sw-chat-toggle:hover {
  background: var(--sw-chat-olive2);
}

.sw-chat-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 84px;
  width: min(420px, calc(100vw - 24px));
  height: min(720px, calc(100vh - 100px));
  background: #fff;
  border: 1px solid var(--sw-chat-line);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(51, 61, 24, 0.18);
  overflow: hidden;
  flex-direction: column;
}

.sw-chat-panel.is-open {
  display: flex;
}

.sw-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--sw-chat-olive);
  color: #fff;
}

.sw-chat-header strong {
  display: block;
  font-size: 15px;
}

.sw-chat-header span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.85;
}

.sw-chat-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.sw-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  background: var(--sw-chat-cream);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sw-chat-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.sw-chat-bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--sw-chat-line);
  color: var(--sw-chat-ink);
}

.sw-chat-bubble.user {
  align-self: flex-end;
  background: var(--sw-chat-olive);
  color: #fff;
}

.sw-chat-bubble.system {
  align-self: center;
  background: transparent;
  color: var(--sw-chat-muted);
  font-size: 12px;
}

.sw-chat-faq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.sw-chat-faq-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid var(--sw-chat-line);
  border-radius: 12px;
  background: #fff;
  color: var(--sw-chat-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  word-break: keep-all;
}

.sw-chat-faq-btn:hover {
  border-color: var(--sw-chat-olive2);
  background: #f3f6e8;
  color: var(--sw-chat-olive);
}

.sw-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.sw-chat-action-btn {
  flex: 1 1 calc(33.333% - 6px);
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border: 1px solid var(--sw-chat-olive);
  border-radius: 10px;
  background: var(--sw-chat-olive);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}

.sw-chat-action-btn:nth-child(2) {
  background: #fff;
  color: var(--sw-chat-olive);
}

.sw-chat-action-btn:nth-child(3) {
  background: var(--sw-chat-olive2);
  border-color: var(--sw-chat-olive2);
}

.sw-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--sw-chat-line);
  background: #fff;
  flex: 0 0 auto;
  margin-top: auto;
}

.sw-chat-form input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--sw-chat-line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
}

.sw-chat-form button {
  border: none;
  border-radius: 12px;
  min-width: 72px;
  padding: 0 16px;
  background: var(--sw-chat-olive);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.sw-chat-form button:disabled,
.sw-chat-form input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sw-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sw-chat-header-link {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 8px 20px;
  font: inherit;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  margin-right: 10px;
}

.sw-chat-view,
.sw-chat-support-view {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.sw-chat-view[hidden],
.sw-chat-support-view[hidden] {
  display: none !important;
}

.sw-chat-support-view {
  background: var(--sw-chat-cream);
  overflow: hidden;
}

.sw-chat-support-cta {
  align-self: flex-start;
  margin-top: 2px;
}

.sw-chat-support-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--sw-chat-olive);
  background: #fff;
  color: var(--sw-chat-olive);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.sw-chat-support-btn:hover {
  background: #f3f6e8;
}

.sw-support-toolbar {
  padding: 8px 12px 0;
}

.sw-support-back {
  border: none;
  background: transparent;
  color: var(--sw-chat-olive);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.sw-support-panel {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 14px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.sw-support-help,
.sw-support-meta,
.sw-support-status,
.sw-support-success {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--sw-chat-muted);
}

.sw-support-status {
  color: #b91c1c;
}

.sw-support-success {
  color: #166534;
  font-weight: 700;
}

.sw-support-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sw-chat-ink);
}

.sw-support-field input,
.sw-support-field textarea {
  width: 100%;
  border: 1px solid var(--sw-chat-line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  box-sizing: border-box;
}

.sw-support-primary,
.sw-support-secondary {
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.sw-support-primary {
  background: var(--sw-chat-olive);
  color: #fff;
}

.sw-support-secondary {
  background: #fff;
  color: var(--sw-chat-olive);
  border: 1px solid var(--sw-chat-line);
}

.sw-support-link {
  font-size: 13px;
  color: var(--sw-chat-olive);
}

.sw-support-item {
  display: grid;
  gap: 4px;
  text-align: left;
  width: 100%;
  border: 1px solid var(--sw-chat-line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
}

.sw-support-item strong {
  font-size: 13px;
  color: var(--sw-chat-olive);
}

.sw-support-item span {
  font-size: 12px;
  color: var(--sw-chat-muted);
}

.sw-support-title {
  margin: 0;
  font-size: 16px;
  color: var(--sw-chat-ink);
}

.sw-support-thread {
  display: grid;
  gap: 8px;
}

.sw-support-msg {
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--sw-chat-line);
}

.sw-support-msg.admin {
  background: #f3f6e8;
}

.sw-support-msg strong {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--sw-chat-olive);
}

.sw-support-msg p {
  margin: 0;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.sw-support-msg span {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--sw-chat-muted);
}

.sw-support-history {
  border: 1px solid var(--sw-chat-line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.sw-support-history pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  color: var(--sw-chat-muted);
  max-height: 160px;
  overflow: auto;
}

@media (max-width: 480px) {
  #sw-chatbot-root {
    right: 12px;
    bottom: 12px;
  }

  .sw-chat-panel {
    width: calc(100vw - 16px);
    height: min(82vh, calc(100vh - 96px));
  }

  .sw-chat-faq-btn {
    min-height: 56px;
    font-size: 11.5px;
    padding: 8px;
  }

  .sw-chat-action-btn {
    flex: 1 1 100%;
  }

  .sw-chat-form,
  .sw-support-panel {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}
