/* =====================================================================
   MindWiki Post Page Styles
   포스트 상세 페이지(post.php) 전용 스타일
   ===================================================================== */

/* === 목차(TOC) 스타일 === */
.toc-box {
  margin-bottom: 24px;
}

.toc-header {
  cursor: pointer;
  user-select: none;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s ease;
}

.toc-header:hover {
  background: #f1f5f9;
}

.toc-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.toc-toggle {
  transition: transform 0.3s ease;
  font-size: 14px;
}

.toc-toggle.open {
  transform: rotate(180deg);
}

.toc-content {
  display: none;
  padding: 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-top: 8px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin: 8px 0;
}

.toc-list a {
  color: #64748b;
  text-decoration: none;
  transition: color 0.3s ease;
  display: block;
  padding: 4px 0;
}

.toc-list a:hover {
  color: #1bb2d3;
}

.toc-list a.h1 {
  font-weight: 600;
  font-size: 16px;
  padding-left: 0;
}

.toc-list a.h2 {
  font-size: 15px;
  padding-left: 16px;
}

.toc-list a.h3 {
  font-size: 14px;
  padding-left: 32px;
}

/* === 비공개 문서 스타일 === */
.blocked-notice {
  background: red;
  color: white;
  padding: 20px;
  margin: 20px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
}

.blocked {
  background: #fef2f2;
  border: 2px solid #fecaca;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
}

.admin-notice {
  margin-top: 24px;
  padding: 20px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}

.btn-publish {
  padding: 12px 24px;
  background: #1bb2d3;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}

.btn-publish:hover {
  background: #1595b3;
}

/* === 용어 링크 스타일 === */
.term-link {
  color: #0066cc;
  text-decoration: underline;
  cursor: pointer;
  border-bottom: 1px dotted #0066cc;
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
}

.term-link:hover {
  color: #0052a3;
  border-bottom-color: #0052a3;
}

/* 돋보기 아이콘 스타일 */
.term-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-left: 0.15em;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.term-link-icon svg {
  width: 0.85em;
  height: 0.85em;
  stroke: currentColor;
}

.term-link:hover .term-link-icon {
  opacity: 1;
}

/* 용어 설명 툴팁 스타일 */
.term-tooltip {
  position: fixed;
  z-index: 10000;
  background: #fff;
  border: 2px solid #0066cc;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 500px;
  min-width: 300px;
  animation: termTooltipFadeIn 0.2s ease-out;
}

@keyframes termTooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.term-tooltip-header {
  padding: 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #ddd;
  border-radius: 6px 6px 0 0;
  position: relative;
}

.term-tooltip-title {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.term-tooltip-subtitle {
  font-size: 14px;
  color: #666;
  font-style: italic;
}

.term-tooltip-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.term-tooltip-close:hover {
  color: #333;
  background: #e9ecef;
  border-radius: 4px;
}

.term-tooltip-content {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  max-height: 400px;
  overflow-y: auto;
}

.term-tooltip-content img {
  max-width: 100%;
  height: auto;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  .toc-content {
    padding: 12px;
  }
  
  .blocked {
    padding: 24px 16px;
  }
  
  .term-tooltip {
    max-width: calc(100vw - 20px) !important;
    min-width: calc(100vw - 20px) !important;
    width: calc(100vw - 20px) !important;
    left: 10px !important;
    right: 10px;
    max-height: calc(100vh - 40px) !important;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }
  
  .term-tooltip-header {
    padding: 14px;
    padding-right: 40px;
  }
  
  .term-tooltip-title {
    font-size: 16px;
    padding-right: 30px;
  }
  
  .term-tooltip-subtitle {
    font-size: 13px;
  }
  
  .term-tooltip-close {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    font-size: 28px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
  }
  
  .term-tooltip-close:hover {
    background: rgba(0, 0, 0, 0.1);
  }
  
  .term-tooltip-content {
    padding: 14px;
    font-size: 14px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* 모바일 스크롤바 스타일 */
  .term-tooltip-content::-webkit-scrollbar {
    width: 6px;
  }
  
  .term-tooltip-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
  }
}

/* 매우 작은 화면 (세로 모드) */
@media (max-width: 480px) {
  .term-tooltip {
    max-width: calc(100vw - 16px) !important;
    min-width: calc(100vw - 16px) !important;
    width: calc(100vw - 16px) !important;
    left: 8px !important;
    right: 8px;
    border-radius: 10px;
  }
  
  .term-tooltip-header {
    padding: 12px;
    padding-right: 36px;
  }
  
  .term-tooltip-title {
    font-size: 15px;
  }
  
  .term-tooltip-content {
    padding: 12px;
    font-size: 13px;
    max-height: calc(100vh - 130px);
  }
}

/* 가로 모드 모바일 */
@media (max-width: 768px) and (orientation: landscape) {
  .term-tooltip {
    max-height: calc(100vh - 20px) !important;
  }
  
  .term-tooltip-content {
    max-height: calc(100vh - 120px);
  }
}

