/* ===== Base ===== */
.qna-main {
  width: 100%;
  padding: 18px 12px 28px;
}

/* Write page */
.qna-write-wrap {
  width: min(1100px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* top title bar */
.qna-write-topbar {
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 4px 2px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid rgba(148, 163, 209, 0.55);
}

:root[data-theme='dark'] .qna-write-topbar {
  border-bottom-color: rgba(255, 255, 255, 0.16);
}

.qna-write-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
}

.qna-write-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* category + title card */
.qna-write-head {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 209, 0.25);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}

.qna-head-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 12px;
  align-items: center;
}

@media (max-width: 768px) {
  .qna-head-row {
    grid-template-columns: 1fr;
  }
}

/* inputs */
.qna-input {
  border-color: rgba(148, 163, 209, 0.45);
  background: #ffffff;
  color: var(--text-main);
}

/* 제목 */
#qnaTitle::placeholder {
  color: inherit;
  opacity: 0.55;
}

/* editor card */
.qna-editor {
  position: relative;
  border: 1px solid rgba(148, 163, 209, 0.25);
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
}

/* toolbar */
.qna-editor-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 209, 0.25);
  background: #ffffff;
}

.qna-toolbar-spacer {
  flex: 1;
}

.qna-toolbar-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* toolbar buttons */
.qna-tool-btn {
  border: 1px solid rgba(148, 163, 209, 0.35);
  background: #f7f8fb;
  color: var(--text-main);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}

.qna-tool-btn:hover {
  filter: brightness(1.03);
}

.qna-tool-btn:active {
  transform: translateY(1px);
}

/* button variants */
.qna-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  padding: 8px;
}

.qna-sticker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
}

.qna-ico {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* textarea */
#qnaContent.qna-editor-textarea {
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: var(--text-main);
  caret-color: auto;

  height: 360px;
  min-height: 280px;
  max-height: 620px;

  padding: 14px;
  line-height: 1.7;

  resize: none;
  overflow: hidden;
}

@media (max-width: 768px) {
  #qnaContent.qna-editor-textarea {
    height: 300px;
    min-height: 240px;
    max-height: 520px;
  }
}

/* footer */
.qna-editor-footer {
  padding: 10px 12px;
  border-top: 1px solid rgba(148, 163, 209, 0.25);
  background: #ffffff;
}

/* links / placeholder */
.qna-content a {
  color: #2563eb;
  text-decoration: underline;
  word-break: break-all;
}

.qna-editor-textarea::placeholder,
#qnaTags::placeholder {
  color: rgba(120, 130, 150, 0.45);
}

/* ===== Dark mode ===== */
:root[data-theme='dark'] .qna-write-head,
:root[data-theme='dark'] .qna-editor,
:root[data-theme='dark'] .qna-editor-toolbar,
:root[data-theme='dark'] .qna-editor-footer,
:root[data-theme='dark'] #qnaContent.qna-editor-textarea,
:root[data-theme='dark'] .qna-input {
  background: #171c2b !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.92);
}

:root[data-theme='dark'] .qna-editor-toolbar {
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

:root[data-theme='dark'] .qna-editor-footer {
  border-top-color: rgba(255, 255, 255, 0.1) !important;
}

:root[data-theme='dark'] #qnaContent.qna-editor-textarea {
  caret-color: rgba(255, 255, 255, 0.9);
}

:root[data-theme='dark'] #qnaTitle::placeholder {
  color: rgba(255, 255, 255, 0.6);
  opacity: 1;
}

:root[data-theme='dark'] .qna-editor-textarea::placeholder,
:root[data-theme='dark'] #qnaTags::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

:root[data-theme='dark'] .qna-tool-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
}

/* ===== Sticker Overlay Modal ===== */
.qna-sticker-overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
  background: transparent;
  backdrop-filter: none;
}

.qna-sticker-overlay.is-open {
  display: block;
}

.qna-sticker-modal {
  width: min(680px, calc(100vw - 32px));
  height: min(460px, calc(100vh - 180px));
  margin: 150px auto 0;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 209, 0.25);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

.qna-sticker-modal-head {
  display: grid;
  grid-template-columns: 90px 1fr 44px;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(148, 163, 209, 0.18);
  background: #ffffff;
}

.qna-sticker-modal-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-main);
}

.qna-sticker-modal-tabs {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 2px 0;
}

.qna-sticker-tab {
  border: 1px solid rgba(148, 163, 209, 0.22);
  background: #f7f8fb;
  color: var(--text-main);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.qna-sticker-tab.is-active {
  background: #ffffff;
  border-color: rgba(148, 163, 209, 0.45);
  font-weight: 800;
}

.qna-sticker-modal-close {
  width: 44px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 209, 0.22);
  background: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-main);
}

.qna-sticker-modal-body {
  height: calc(100% - 58px);
  overflow: auto;
  padding: 14px;
  background: #ffffff;
}

.qna-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.qna-sticker-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 209, 0.18);
  border-radius: 14px;
  background: #f7f8fb;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    filter 0.15s ease;
}

.qna-sticker-item:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.qna-sticker-item img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
  pointer-events: none;
}

/* modal dark */
:root[data-theme='dark'] .qna-sticker-modal,
:root[data-theme='dark'] .qna-sticker-modal-head,
:root[data-theme='dark'] .qna-sticker-modal-body {
  background: #171c2b;
  border-color: rgba(255, 255, 255, 0.12);
}

:root[data-theme='dark'] .qna-sticker-modal-head {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme='dark'] .qna-sticker-modal-title {
  color: rgba(255, 255, 255, 0.92);
}

:root[data-theme='dark'] .qna-sticker-tab {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
}

:root[data-theme='dark'] .qna-sticker-tab.is-active {
  background: rgba(255, 255, 255, 0.1);
}

:root[data-theme='dark'] .qna-sticker-modal-close {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
}

:root[data-theme='dark'] .qna-sticker-item {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .qna-sticker-modal {
    margin-top: 110px;
    height: min(520px, calc(100vh - 140px));
  }
}

@media (max-width: 576px) {
  .qna-sticker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .qna-sticker-item {
    min-height: 72px;
  }

  .qna-sticker-item img {
    width: 56px;
    height: 56px;
  }
}
.qna-sticker-empty {
  grid-column: 1 / -1;
  padding: 18px 8px;
  text-align: center;
  color: var(--text-sub);
  font-size: 14px;
}
.qna-editor-surface {
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: var(--text-main);
  min-height: 360px;
  max-height: 620px;
  padding: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  outline: none;
  cursor: text;
}

.qna-editor-surface.is-empty::before {
  content: attr(data-placeholder);
  color: rgba(120, 130, 150, 0.45);
  white-space: pre-wrap;
  pointer-events: none;
}

.qna-editor-textarea[hidden] {
  display: none !important;
}

.qna-inline-emoji {
  display: inline-block;
  width: 150px;
  height: 150px;
  object-fit: contain;
  vertical-align: -0.35em;
  margin: 0 2px;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 768px) {
  .qna-editor-surface {
    min-height: 300px;
    max-height: 520px;
  }

  .qna-inline-emoji {
    width: 100px;
    height: 100px;
  }
}

:root[data-theme='dark'] .qna-editor-surface {
  background: #171c2b !important;
  color: rgba(255, 255, 255, 0.92);
}

:root[data-theme='dark'] .qna-editor-surface.is-empty::before {
  color: rgba(255, 255, 255, 0.38);
}
