/**
 * UW Board Common Styles (cm-bbs.css)
 * 
 * 게시판 공통 기능 및 페이지 레이아웃
 * - Pagination, Search, View, Write/Edit, Buttons, Common UI
 * 
 * @package St-works
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
  /* 게시판 커스텀 변수 */
  --board-main-color: #333;
  --board-main-color-dark: #000;
  --board-list-height: 64px;
  --board-list-font-size: 16px;
  --board-list-font-color: #333;
  --board-list-meta-color: #999;
  --board-list-icon-width: 80px;
  --board-view-font-size: 16px;
  --board-border-color: #e5e5e5;
  --board-bg-color: #f8f9fa;
  --board-radius: 0;
  --board-text-muted: #999;
  --board-text-secondary: #666;
  --board-white: #fff;
  --board-transition: 0.2s;
}

/* ==========================================================================
   1. 컨테이너
   ========================================================================== */

@media (max-width: 768px) {
  .sub-page.board {
    padding: 80px 20px;
  }
}

.uw-board-container {
  font-family: var(--uw-font-main, 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif);
  font-size: var(--board-list-font-size);
  color: var(--board-list-font-color);
  line-height: 1.6;
}

.uw-board-error {
  padding: 40px 20px;
  text-align: center;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--board-radius);
  color: #856404;
}

/* ==========================================================================
   2. 헤더 (검색바)
   ========================================================================== */
.uw-board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 30px;
}

.uw-total {
  font-size: var(--board-view-font-size);
  color: var(--board-list-meta-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.uw-total strong {
  color: var(--board-main-color);
  font-weight: 700;
}

.uw-search-form {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--board-border-color);
  border-radius: var(--board-radius);
  overflow: visible;
}

/* 필터 드롭다운 영역 */
.uw-search-filter {
  position: relative;
}

.uw-filter-trigger {
  position: relative;
  display: flex;
  align-items: center;
  height: 50px;
  width: 120px;
  padding: 0 16px;
  padding-right: 36px;
  background: #fff;
  border: none;
  border-right: 1px solid var(--board-border-color);
  font-size: 15px;
  color: #999;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.uw-filter-trigger::after,
.uw-search-btn::before {
  font-family: 'xeicon' !important;
  font-style: normal;
  font-weight: normal;
  display: inline-block;
}

.uw-filter-trigger::after {
  text-decoration: inherit;
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  content: "\e942";
  font-size: 18px;
  color: var(--board-text-muted);
  transition: transform 0.25s ease;
}

.uw-search-btn::before {
  content: "\e97a";
  font-size: 20px;
}

.uw-filter-trigger:hover {
  background: #f8f9fa;
}

.uw-search-filter.is-open .uw-filter-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

/* 드롭다운 메뉴 */
.uw-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--board-border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.25s ease;
  z-index: 100;
}

.uw-search-filter.is-open .uw-filter-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.uw-filter-dropdown li {
  margin: 0;
}

.uw-filter-dropdown button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  font-size: 15px;
  color: #333;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.uw-filter-dropdown button:hover {
  background: #f8f9fa;
}

.uw-filter-dropdown button.active {
  background: var(--board-bg-color);
  font-weight: 600;
}

/* 검색 입력 영역 */
.uw-search-input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
}

.uw-search-input-wrap input[type="text"] {
  flex: 1;
  height: 100%;
  min-width: 250px;
  padding: 0 16px;
  border: none;
  font-size: 15px;
  color: #333;
  background: transparent;
}

.uw-search-input-wrap input[type="text"]:focus {
  outline: none;
}

.uw-search-input-wrap input[type="text"]::placeholder {
  color: #999;
}

/* 검색 버튼 (xeicon) */
.uw-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  transition: color 0.2s;
}

.uw-search-btn:hover {
  color: var(--board-main-color);
}

/* ==========================================================================
   3. Common UI Elements (Badges, Icons, Empty States)
   ========================================================================== */
/* 배지들 */
.uw-notice-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--board-main-color);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 3px;
}

.uw-new-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  border-radius: 3px;
  flex-shrink: 0;
  animation: uwPulse 1.5s ease-in-out infinite;
}

@keyframes uwPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.uw-file-icon {
  margin-left: 5px;
  font-size: 14px;
  color: var(--board-text-muted);
}

.uw-no-posts {
  text-align: center;
  padding: 50px 20px !important;
  color: #999;
}

/* ==========================================================================
   4. 푸터 (페이지네이션 + 글쓰기)
   ========================================================================== */
.uw-board-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding-top: 25px;
}

.uw-pagination {
  display: flex;
  gap: 4px;
}

.uw-pagination a,
.uw-pagination span.disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: var(--board-white);
  border: 1px solid var(--board-border-color);
  border-radius: var(--board-radius);
  color: var(--board-list-font-color);
  text-decoration: none;
  font-size: 14px;
  transition: all var(--board-transition);
}

.uw-pagination a:hover {
  border-color: var(--board-main-color);
  color: var(--board-main-color);
}

.uw-pagination a.current {
  background: var(--board-main-color);
  border-color: var(--board-main-color);
  color: var(--board-white);
  font-weight: 600;
}

/* 글쓰기 버튼 */
.uw-board-footer .uw-btn {
  position: absolute;
  right: 0;
}

/* ==========================================================================
   5. 버튼
   ========================================================================== */
.uw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 24px;
  background: #fff;
  border: 1px solid var(--board-border-color);
  border-radius: var(--board-radius);
  color: var(--board-list-font-color);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.uw-btn:hover {
  border-color: #333;
  color: #333;
}

.uw-btn-primary {
  background: #333;
  border-color: #333;
  color: #fff;
}

.uw-btn-primary:hover {
  background: #333;
  border-color: #333;
  color: #fff;
}


/* ==========================================================================
   6. 상세 페이지
   ========================================================================== */

.uw-single-post {
  background: #fff;
  /* border: 1px solid var(--board-border-color); KBoard 스타일: 테두리 없음 */
  /* border-radius: var(--board-radius); */
  overflow: hidden;
}

.uw-post-header {
  padding: 20px 0;
  background: #fff;
  border-top: 2px solid #000;
  border-bottom: 1px solid #e5e5e5;
}

.uw-post-title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin: 10px 0 15px 0;
  line-height: 1.4;
}

.uw-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 14px;
  color: #888;
}

.uw-post-meta span {
  display: inline-flex;
  align-items: center;
}

.uw-post-content {
  padding: 40px 10px;
  min-height: 300px;
  line-height: 1.8;
  font-size: 18px;
  color: #333;
}
.uw-post-content p,
.uw-post-content li,
.uw-post-content td,
.uw-post-content th,
.uw-post-content span,
.uw-post-content div {
  font-size: inherit;
}

/* 첨부파일 */
.uw-post-attachments {
  padding: 20px;
  background: #f8f8f8;
  border: 1px solid #e5e5e5;
  margin-bottom: 30px;
}

.uw-post-attachments ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.uw-post-attachments li {
  margin-bottom: 8px;
  font-size: 14px;
  color: #666;
  display: flex;
  align-items: center;
}

.uw-post-attachments li:last-child {
  margin-bottom: 0;
}

.uw-att-label {
  font-weight: 700;
  color: #333;
  margin-right: 15px;
  min-width: 80px;
}

.uw-post-attachments a {
  display: inline-block;
  color: #666;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 0;
}

.uw-post-attachments a:hover {
  color: #333;
  text-decoration: underline;
  border: none;
}

/* 이전/다음 글 */
.uw-post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--board-border-color);
}

.uw-nav-prev,
.uw-nav-next {
  display: flex;
  flex-direction: column;
  padding: 20px 30px;
  text-decoration: none;
  transition: background 0.2s;
}

.uw-nav-prev {
  border-right: 1px solid var(--board-border-color);
}

.uw-nav-prev:hover,
.uw-nav-next:hover {
  background: var(--board-bg-color);
}

.uw-nav-prev span,
.uw-nav-next span {
  font-size: 12px;
  color: var(--board-list-meta-color);
  margin-bottom: 5px;
}

.uw-nav-prev strong,
.uw-nav-next strong {
  font-size: 16px;
  color: var(--board-list-font-color);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uw-nav-next {
  text-align: right;
}

/* 이전/다음 글 없을 때 스타일 */
.uw-nav-empty {
  cursor: default;
}

.uw-nav-empty:hover {
  background: transparent;
}

.uw-nav-empty strong {
  color: var(--board-list-meta-color);
  font-weight: 400;
}

/* 액션 버튼 (KBoard Style) */
.uw-post-actions {
  display: flex;
  justify-content: flex-end;
  /* 우측 정렬 */
  gap: 10px;
  padding: 30px 0;
  border-top: 1px solid #e5e5e5;
}

.uw-post-actions .uw-btn {
  background: #333;
  color: #fff;
  border: 1px solid #333;
  border-radius: 30px;
  /* 둥근 버튼 */
  padding: 0 30px;
  height: 45px;
  font-size: 15px;
  font-weight: 600;
}

.uw-post-actions .uw-btn:hover {
  background: #000;
  border-color: #000;
}

/* ==========================================================================
   7. 글쓰기 폼
   ========================================================================== */
.uw-write-form {
  background: #fff;
  border: 1px solid var(--board-border-color);
  border-radius: var(--board-radius);
  padding: 30px;
}

.uw-form-field {
  margin-bottom: 25px;
}

.uw-form-field>label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--board-list-font-color);
}

.uw-form-field input[type="text"],
.uw-form-field input[type="password"] {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--board-border-color);
  border-radius: var(--board-radius);
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.uw-form-field input:focus {
  outline: none;
  border-color: #333;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.uw-field-desc {
  margin-top: 5px;
  font-size: 13px;
  color: var(--board-list-meta-color);
}

/* 파일 업로드 */
.uw-file-upload {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.uw-file-slot {
  display: flex;
  align-items: center;
  gap: 10px;
}

.uw-file-slot input[type="file"] {
  flex: 1;
  padding: 10px;
  border: 1px dashed var(--board-border-color);
  border-radius: var(--board-radius);
  cursor: pointer;
}

.uw-existing-file {
  padding: 5px 10px;
  background: var(--board-bg-color);
  border-radius: 3px;
  font-size: 13px;
  color: var(--board-list-meta-color);
}

/* 개인정보 동의 */
.uw-privacy-field {
  padding: 15px;
  background: var(--board-bg-color);
  border-radius: var(--board-radius);
}

.uw-privacy-field label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400 !important;
  cursor: pointer;
}

/* 폼 액션 */
.uw-form-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
  padding-top: 25px;
  border-top: 1px solid var(--board-border-color);
}

/* Summernote 스타일 오버라이드 */
.uw-form-field .note-editor {
  border: 1px solid var(--board-border-color) !important;
  border-radius: var(--board-radius) !important;
}

.uw-form-field .note-editor.note-frame .note-editing-area .note-editable {
  min-height: 300px;
  padding: 15px;
}

/* ==========================================================================
   8. 반응형 (Common)
   ========================================================================== */
@media (max-width: 768px) {
  /* Header & Search */
  .uw-board-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .uw-search-form {
    width: 100%;
    flex-wrap: wrap;
  }

  .uw-search-form select {
    width: 100%;
  }

  .uw-search-form input[type="text"] {
    flex: 1;
    min-width: 0;
  }

  /* Footer */
  .uw-board-footer {
    flex-direction: column;
    gap: 20px;
    padding-top: 20px;
  }

  .uw-pagination {
    order: 1;
  }

  .uw-board-footer .uw-btn {
    position: static;
    width: 100%;
    order: 2;
  }

  /* 상세 페이지 */
  .uw-post-header {
    padding: 20px 0;
  }

  .uw-post-title {
    font-size: 18px;
  }

  .uw-post-meta {
    gap: 10px;
  }

  .uw-post-content {
    padding: 20px 0;
    font-size: 16px;
  }

  .uw-post-navigation {
    grid-template-columns: 1fr;
  }

  .uw-nav-prev {
    border-right: none;
    border-bottom: 1px solid var(--board-border-color);
    padding: 20px 0;
  }

  .uw-nav-next {
    text-align: left;
    padding: 20px 0;
  }

  /* 글쓰기 */
  .uw-write-form {
    padding: 20px;
  }

  .uw-form-actions {
    flex-direction: column;
  }

  .uw-form-actions .uw-btn {
    width: 100%;
  }
}

/* ==========================================================================
   Style 01 전용: 툴바 + 검색바 + 페이지네이션 오버라이드
   (SBT Global Press 레퍼런스)
   ========================================================================== */

/* ── 툴바 ── */
.uw-board-style01-toolbar {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  font-size: 16px;
  padding-bottom: calc(30 / 16 * 1em);
  letter-spacing: -0.045em;
  border-bottom: 1px solid #222;
  margin-bottom: 0;
}

.uw-board-style01-toolbar--nordinary {
  border-bottom: none;
}

.uw-board-style01-toolbar .uw-total {
  display: flex;
  align-items: center;
  font-family: 'Poppins', 'Pretendard', sans-serif;
  letter-spacing: -0.03em;
  color: #060000;
  font-size: inherit;
}

.uw-board-style01-toolbar .uw-total span {
  padding: 0 calc(10 / 16 * 1em);
}

.uw-board-style01-toolbar .uw-total b {
  font-weight: 600;
  color: #D4A800;
}

/* ── 검색바 (pill) ── */
.uw-board-style01-toolbar .uw-search-form {
  display: flex;
  align-items: center;
  border-radius: 9999px;
  background: #f3f3f3;
  font-size: inherit;
  letter-spacing: -0.03em;
  color: #222;
  padding: calc(10 / 16 * 1em);
  border: none;
  overflow: hidden;
}

.uw-board-style01-toolbar .uw-search-form .uw-search-filter,
.uw-board-style01-toolbar .uw-search-form .uw-filter-trigger {
  display: none;
}

.uw-board-style01-toolbar .uw-search-form .uw-search-input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
}

.uw-board-style01-toolbar .uw-search-form .uw-search-input-wrap input[type="text"] {
  width: calc(300 / 16 * 1em);
  min-width: auto;
  border: none;
  outline: none;
  background: transparent;
  padding: 0 0 0 calc(25 / 16 * 1em);
  font-size: 16px;
  letter-spacing: -0.045em;
  color: inherit;
  height: auto;
}

.uw-board-style01-toolbar .uw-search-form .uw-search-input-wrap input[type="text"]::placeholder {
  color: inherit;
  opacity: 0.5;
}

.uw-board-style01-toolbar .uw-search-form .uw-search-btn {
  flex-shrink: 0;
  width: calc(40 / 16 * 1em);
  height: calc(40 / 16 * 1em);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #D4A800;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.4s;
}

.uw-board-style01-toolbar .uw-search-form .uw-search-btn::before {
  content: none;
}

.uw-board-style01-toolbar .uw-search-form .uw-search-btn::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.uw-board-style01-toolbar .uw-search-form .uw-search-btn:hover {
  background: #b89000;
}

/* ── 페이지네이션 ── */
.uw-board-style01 ~ .uw-board-footer {
  padding-top: 85px;
}

.uw-board-style01 ~ .uw-board-footer .uw-pagination {
  gap: calc(15 / 18 * 1em);
}

.uw-board-style01 ~ .uw-board-footer .uw-pagination a,
.uw-board-style01 ~ .uw-board-footer .uw-pagination span.disabled {
  width: calc(35 / 18 * 1em);
  height: calc(35 / 18 * 1em);
  min-width: auto;
  padding: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.03em;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #060000;
  transition: all 0.3s;
}

.uw-board-style01 ~ .uw-board-footer .uw-pagination a:hover {
  color: #D4A800;
}

.uw-board-style01 ~ .uw-board-footer .uw-pagination a.current {
  background: #D4A800;
  color: #fff;
}

.uw-board-style01 ~ .uw-board-footer .uw-pagination a.current:hover {
  color: #fff;
}

/* ── 반응형: Style 01 툴바 ── */
@media screen and (max-width: 1280px) {
  .uw-board-style01-toolbar {
    font-size: clamp(15px, 16 / 1280 * 100vw, 16px);
  }
}

@media screen and (max-width: 820px) {
  .uw-board-style01-toolbar {
    font-size: clamp(14px, 16 / 820 * 100vw, 16px);
    padding-bottom: calc(20 / 16 * 1em);
  }
  .uw-board-style01-toolbar .uw-search-form .uw-search-btn {
    width: calc(30 / 16 * 1em);
    height: calc(30 / 16 * 1em);
  }
  .uw-board-style01-toolbar .uw-search-form .uw-search-input-wrap input[type="text"] {
    width: calc(170 / 16 * 1em);
    padding-left: calc(20 / 16 * 1em);
  }
  .uw-board-style01 ~ .uw-board-footer {
    padding-top: 50px;
  }
  .uw-board-style01 ~ .uw-board-footer .uw-pagination a,
  .uw-board-style01 ~ .uw-board-footer .uw-pagination span.disabled {
    font-size: clamp(16px, 18 / 820 * 100vw, 18px);
  }
}

@media screen and (max-width: 500px) {
  .uw-board-style01-toolbar {
    font-size: clamp(13px, 14 / 500 * 100vw, 14px);
    padding-bottom: calc(20 / 14 * 1em);
    flex-direction: column-reverse;
    align-items: center;
    gap: calc(10 / 14 * 1em);
  }
  .uw-board-style01-toolbar .uw-search-form {
    width: 100%;
  }
  .uw-board-style01-toolbar .uw-search-form .uw-search-input-wrap input[type="text"] {
    width: 100%;
    font-size: 14px;
    padding-left: 15px;
  }
  .uw-board-style01 ~ .uw-board-footer .uw-pagination {
    gap: 5px;
  }
  .uw-board-style01 ~ .uw-board-footer .uw-pagination a,
  .uw-board-style01 ~ .uw-board-footer .uw-pagination span.disabled {
    font-size: clamp(14px, 16 / 500 * 100vw, 16px);
  }
}
