/*
 * stickers.css — 콘 등록·목록·상세 화면
 * .sticker-page: 화면 전체
 * .sticker-description: 묶음 소개
 * .sticker-image-grid: 이미지 배치
 * .sticker-preview-image: 개별 콘 표시 크기
 * .sticker-upload-page: 등록 폼·즉시 미리보기·대표 이미지 선택 (파일 아래쪽)
 */

.sticker-page {
  min-width: 0;
}

/* ===== 콘 등록: 이미지 추가·미리보기·대표 이미지 ===== */
.sticker-upload-page { max-width: 820px; margin: 0 auto; }
.sticker-upload-back { font-size: 13px; text-decoration: none; }
.sticker-upload-heading { margin: 24px 0; }
.sticker-upload-heading h1 { margin: 8px 0; font-size: clamp(23px, 4vw, 30px); letter-spacing: -1px; }
.sticker-upload-heading p { color: #687080; font-size: 13px; line-height: 1.7; }
.sticker-upload-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 22px;
  border: 1px solid #dce2ea;
  border-radius: 12px;
  background: rgb(255 255 255 / 94%);
}
.sticker-upload-cover h2,
.sticker-upload-section-heading h2 { margin: 0 0 12px; font-size: 15px; }
.sticker-cover-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #dce2ea;
  border-radius: 10px;
  background: #f4f7fb;
  color: #87909c;
  font-size: 12px;
}
.sticker-cover-preview img { width: 100%; height: 100%; object-fit: contain; }
.sticker-upload-cover > p { margin: 10px 0 0; color: #737b87; font-size: 11px; line-height: 1.6; }
.sticker-upload-details { min-width: 0; }
.sticker-upload-details label { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.sticker-upload-details input[type="text"],
.sticker-upload-details textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0 0 20px;
  padding: 10px 12px;
  border: 1px solid #d5dce6;
  border-radius: 7px;
  background: #fff;
  color: #252932;
  font-size: 16px;
}
.sticker-upload-details textarea { min-height: 120px; resize: vertical; }
.sticker-upload-page .sticker-upload-secondary,
.sticker-upload-page .sticker-upload-pick-cover {
  box-sizing: border-box;
  width: auto;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #cbd6e6;
  border-radius: 6px;
  background: #fff;
  color: #3e5779;
  font-size: 12px;
}
.sticker-upload-cover .sticker-upload-secondary { width: 100%; margin-top: 10px; }
.sticker-upload-page .sticker-upload-text { width: auto; min-height: 30px; padding: 4px 0; background: transparent; color: #687080; font-size: 11px; }
.sticker-upload-images { margin-top: 28px; padding: 16px 0; border: 2px solid transparent; border-radius: 10px; }
.sticker-upload-images.is-dragover { border-color: #0071e3; background: #edf5ff; }
.sticker-upload-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sticker-upload-section-heading h2 { margin: 0; }
#sticker-file-count { margin-left: 6px; color: #0071e3; font-size: 12px; font-weight: 500; }
.sticker-upload-page .sticker-upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 170px;
  margin-top: 16px;
  padding: 20px;
  border: 1px dashed #9cb7d9;
  border-radius: 10px;
  background: rgb(247 250 255 / 94%);
  color: #3e5779;
  cursor: pointer;
}
.sticker-upload-drop > span { color: #0071e3; font-size: 30px; }
.sticker-upload-drop strong { font-size: 14px; }
.sticker-upload-drop small { color: #737b87; font-size: 11px; }
.sticker-upload-status { margin: 12px 0; color: #536b88; font-size: 12px; overflow-wrap: anywhere; }
.sticker-upload-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.sticker-upload-tile { position: relative; min-width: 0; padding: 10px; border: 1px solid #dce2ea; border-radius: 9px; background: #fff; }
.sticker-upload-tile.is-cover { border-color: #0071e3; box-shadow: 0 0 0 1px #0071e3; }
.sticker-upload-tile > img { display: block; width: 100%; height: 100px; object-fit: contain; }
.sticker-upload-filename { display: block; margin: 8px 0; overflow: hidden; color: #737b87; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sticker-upload-page .sticker-upload-pick-cover { width: 100%; padding: 5px 2px; font-size: 11px; }
.sticker-upload-page .sticker-upload-remove { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; min-height: 0; margin: 0; padding: 0; border-radius: 50%; background: #eef1f5; color: #536070; font-size: 18px; line-height: 26px; }
.sticker-upload-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding-top: 18px; border-top: 1px solid #dce2ea; }
.sticker-upload-footer p { margin: 0; color: #737b87; font-size: 12px; }
.sticker-upload-page .sticker-upload-submit { width: auto; min-height: 42px; margin: 0; padding: 10px 22px; border-radius: 8px; background: #0071e3; color: white; font-size: 14px; font-weight: 600; }
.sticker-upload-page button:focus-visible { outline: 2px solid #0071e3; outline-offset: 3px; }
.sticker-upload-page [hidden] { display: none !important; }
.sticker-pack-preview .sticker-pack-main-image { flex: 0 1 112px; width: 112px; max-width: 100%; height: 112px; }
.sticker-detail-cover { width: 112px; height: 112px; object-fit: contain; }
@media (max-width: 580px) {
  .sticker-upload-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 16px; }
  .sticker-upload-cover { width: min(210px, 100%); margin: 0 auto; }
  .sticker-upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.sticker-page h1 {
  margin-top: 16px;
  overflow-wrap: anywhere;
}

.sticker-page input[type="file"] {
  max-width: 100%;
}

.sticker-description {
  margin: 20px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sticker-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  padding: 16px 0;
}

.sticker-preview-image {
  display: block;
  width: 100%;
  max-width: 128px;
  height: 128px;
  object-fit: contain;
}

/*
 * 댓글 콘 선택 기능
 * .sticker-navigation: 전체 콘·내 콘함 이동 메뉴
 * .sticker-picker-toolbar: 콘 선택 버튼과 링크
 * .sticker-picker-panel: 묶음과 이미지 선택 영역
 * .sticker-selected: 등록 전 선택한 콘 미리보기
 * .comment-sticker-image: 댓글에 등록된 콘
 */
.sticker-navigation,
.sticker-picker-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0;
}

.sticker-picker {
  min-width: 0;
  margin-top: 6px;
}

/* 작은 겹침 패널: 본문 높이를 늘리지 않고 버튼 근처에 표시합니다.
 * PC 최대 너비 480px·높이 360px, 휴대폰에서는 화면에 맞춰 줄어듭니다.
 */
.sticker-picker-panel {
  position: fixed;
  inset: auto;
  z-index: 1000;
  box-sizing: border-box;
  width: min(480px, calc(100vw - 16px));
  max-height: min(360px, calc(100dvh - 16px));
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #454b83;
  border-radius: 4px;
  background: #fff;
  color: #252932;
  box-shadow: 0 5px 20px #0003;
}

.sticker-picker-panel::backdrop {
  background: transparent;
}

.sticker-panel-heading,
.sticker-panel-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sticker-panel-heading {
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px solid #dce1e8;
  font-size: 12px;
}

.sticker-panel-heading strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-panel-tools {
  flex-shrink: 0;
}

.sticker-picker-toolbar a,
.sticker-panel-tools a {
  font-size: 12px;
  color: #687080;
  text-decoration: none;
}

/* 묶음 썸네일을 가로로 넘겨서 선택합니다. */
.sticker-pack-strip {
  display: flex;
  gap: 0;
  overflow-x: auto;
  border-bottom: 1px solid #454b83;
  background: #f5f6f8;
  scrollbar-width: thin;
}

.sticker-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  padding: 6px;
}

/* 공통 버튼의 큰 파란색 배경 대신 작은 선택 버튼을 사용합니다. */
.sticker-picker button {
  box-sizing: border-box;
  width: auto;
  min-height: 30px;
  margin: 0;
  padding: 4px 9px;
  border: 1px solid #dce1e8;
  border-radius: 6px;
  background: #fff;
  color: #414956;
  font-size: 13px;
}

.sticker-picker .sticker-pack-tab {
  flex: 0 0 52px;
  height: 52px;
  padding: 4px;
  border: 0;
  border-right: 1px solid #dce1e8;
  border-radius: 0;
  background: transparent;
}

.sticker-pack-tab img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.sticker-picker .sticker-pack-tab[aria-pressed="true"] {
  background: #fff;
  box-shadow: inset 0 -3px #454b83;
}

.sticker-picker [data-sticker-close] {
  border: 0;
  padding: 0 5px;
  font-size: 20px;
  line-height: 1;
}

.sticker-picker .sticker-choice {
  width: 100%;
  min-width: 0;
  padding: 2px;
  border-color: transparent;
  background: transparent;
}

.sticker-choice img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.sticker-choice:hover {
  border-color: #0071e3;
  background: #eef6ff;
}

.sticker-picker button:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 2px;
}

.sticker-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.sticker-selected img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.comment-sticker {
  display: block;
  margin-top: 6px;
  white-space: normal;
}

.comment-sticker-image {
  display: block;
  width: 120px;
  max-width: 100%;
  height: 120px;
  object-fit: contain;
}

.sticker-picker-help,
.sticker-unavailable {
  color: #737b87;
  font-size: 12px;
}

.sticker-picker-panel [data-sticker-status],
.sticker-picker-panel .sticker-picker-help {
  margin: 0;
  padding: 8px 10px;
  font-size: 12px;
}

.sticker-picker-panel [data-sticker-status]:empty {
  display: none;
}

@media (max-width: 400px) {
  .sticker-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* display:flex가 지정된 미리보기도 hidden일 때 숨깁니다. */
.sticker-picker [hidden] {
  display: none;
}

/* 콘 목록 상단: 제목 왼쪽, 등록 버튼 오른쪽 */
.sticker-store-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.sticker-store-label {
  color: #0071e3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
}

.sticker-store .sticker-store-heading h1 {
  margin: 6px 0 0;
  font-size: 26px;
}

.sticker-store .sticker-upload-link {
  padding: 10px 15px;
  border-radius: 7px;
  background: #0071e3;
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* 전체 콘·내 콘함 탭 */
.sticker-store-tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  border-bottom: 1px solid #cdd5df;
}

.sticker-store-tab {
  padding: 12px 0;
  border-bottom: 3px solid transparent;
  color: #737b87;
  font-size: 14px;
  text-decoration: none;
}

.sticker-store-tab.is-active {
  border-bottom-color: #0071e3;
  color: #0071e3;
  font-weight: 700;
}

/* 콘 카드를 한 줄에 3개 배치 */
.sticker-store-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* 카드 바탕은 선명하게 해서 배경 사진과 구분 */
.sticker-store .sticker-pack-card {
  display: block;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dce2ea;
  border-radius: 10px;
  background: #fff;
  color: #252932;
  text-decoration: none;
}

.sticker-pack-card:hover {
  border-color: #7eade8;
  box-shadow: 0 4px 14px #00000012;
}

.sticker-pack-card:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 3px;
}

/* 콘 이미지 미리보기 */
.sticker-pack-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 140px;
  padding: 12px;
  background: #f4f6fa;
}

.sticker-pack-preview img {
  display: block;
  min-width: 0;
  width: 30%;
  max-width: 96px;
  height: 96px;
  margin: 0;
  object-fit: contain;
}

/* 제목·설명·등록자 */
.sticker-pack-info {
  padding: 14px;
}

.sticker-pack-title-line,
.sticker-pack-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sticker-pack-title-line strong {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-pack-count {
  flex-shrink: 0;
  padding: 3px 7px;
  border-radius: 4px;
  background: #edf4ff;
  color: #2471cd;
  font-size: 11px;
}

.sticker-pack-caption {
  margin: 10px 0 16px;
  overflow: hidden;
  color: #737b87;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-pack-footer {
  padding-top: 10px;
  border-top: 1px solid #edf0f4;
  color: #737b87;
  font-size: 11px;
}

.sticker-pack-footer > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-pack-open {
  flex-shrink: 0;
  color: #0071e3;
}

@media (max-width: 760px) {
  .sticker-store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .sticker-store-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* 글쓰기 도구 모음: 이미지 아이콘 옆의 작은 콘 버튼 */
/* 이미지 아이콘 옆 Stockcon 버튼 */
.ql-toolbar.ql-snow button.ql-stockcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  float: none;

  width: auto;
  min-width: 86px;
  height: 28px;
  min-height: 0;

  margin: 0 0 0 6px;
  padding: 0 8px;

  white-space: nowrap;
  word-break: normal;

  border: 1px solid #b8c1ce;
  border-radius: 4px;
  background: transparent;
  color: #444;

  font-size: 12px;
  line-height: 1;
}

/* 이미지 아이콘과 버튼을 같은 높이로 정렬 */
.ql-toolbar.ql-snow .ql-formats {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}


.ql-toolbar.ql-snow button.ql-stockcon:hover {
  border-color: #0071e3;
  color: #0071e3;
}

/* 글쓰기용 패널의 묶음 이름 버튼 */
#post-con-panel .sticker-pack-tab {
  flex-basis: auto;
  min-width: 60px;
  max-width: 120px;
  padding: 6px 10px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 선택 패널의 로딩·오류 안내 */
#post-con-status {
  margin: 0;
  padding: 8px 10px;
  font-size: 12px;
}

#post-con-status:empty {
  display: none;
}

/* 본문에 들어가는 콘은 일반 사진과 달리 작게 표시 */
#editor .ql-editor img[src^="/stockcon_images/"],
.post-body img[src^="/stockcon_images/"] {
  width: 120px;
  max-width: 100%;
  height: 120px;
  object-fit: contain;
}
