
/* public/styles/wiki.css */
.wiki-body { background:#fff; border:1px solid #eee; border-radius:12px; padding:18px; }
.btn { padding:8px 10px; border:1px solid #ccc; border-radius:8px; background:#f8f8f8; cursor:pointer; }
.btn:hover { background:#f0f0f0; }
.badge { display:inline-block; padding:2px 6px; background:#eee; border-radius:6px; font-size:12px; }

/* === ShimKuWiki Home only === */
.wiki-container.wiki-home{
  max-width: 960px;   /* 가로 폭 고정 */
  width: 100%;
  margin: 0 auto;     /* 가운데 정렬 */
  padding: 16px;
}

.wiki-home h2{ margin: 6px 0 10px; }

.wiki-home .wiki-search-form{
  display: flex;
  gap: 8px;
  align-items: center;
}

.wiki-home .wiki-search-form input[type="text"]{
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.wiki-home .wiki-list{ margin-top: 12px; }
.wiki-home .wiki-list-item{
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

/* 칩 스타일 (이미 .chip이 있으면 생략 가능) */
.wiki-home .chips .chip{
  display:inline-block; padding:6px 10px;
  border:1px solid #ddd; border-radius:16px;
  text-decoration:none; color:inherit;
}
.wiki-home .chips .chip:hover{ background:#f7f7f7; }

/* 모바일 대응 */
@media (max-width: 640px){
  .wiki-home .wiki-search-form{
    flex-direction: column;
    align-items: stretch;
  }
  .wiki-home .wiki-search-form button{ width: 100%; }
}


/* Rich toolbar basic */
.wiki-toolbar .rt-btn {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f8f8f8;
  cursor: pointer;
}
.wiki-toolbar .rt-btn:hover { background:#f0f0f0; }


/* Responsive images inside wiki content & editor */
.wiki-body img,
.wiki-content img,
#wikiContent img,
#editor img,
#editModalEditor img {
  max-width: 100%;
  height: auto;
  display: block;
}

.wiki-body figure,
.wiki-content figure,
#wikiContent figure {
  margin: 12px 0;
}

.wiki-body img[width],
.wiki-body img[height],
.wiki-content img[width],
.wiki-content img[height],
#editor img[width],
#editor img[height],
#editModalEditor img[width],
#editModalEditor img[height] {
  height: auto; /* avoid distortion if width/height attrs exist */
}


/* === Wiki images: force responsive inside content & editors === */
.wiki-body img,
.wiki-body figure > img,
.wiki-content img,
.wiki-content figure > img,
#wikiContent img,
#editor img,
#editModalEditor img {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  display: block !important;
}

/* override inline style width/height on <img> */
.wiki-body img[style],
.wiki-content img[style],
#wikiContent img[style],
#editor img[style],
#editModalEditor img[style] {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
}

.wiki-body figure,
.wiki-content figure,
#wikiContent figure,
#editor figure,
#editModalEditor figure {
  margin: 12px 0 !important;
  max-width: 100% !important;
}

#editor, #editModalEditor {
  overflow-x: hidden !important;
  box-sizing: border-box;
}

.wiki-body figure,
.wiki-content figure,
#wikiContent figure,
#editor figure,
#editModalEditor figure {
  margin: 12px 0;
  max-width: 100%;
}

#editor, #editModalEditor {
  overflow: hidden;
  box-sizing: border-box;
}

/* If any inline width/height attributes exist, keep aspect and cap width */
.wiki-body img[width], .wiki-body img[height],
.wiki-content img[width], .wiki-content img[height],
#editor img[width], #editor img[height],
#editModalEditor img[width], #editModalEditor img[height] {
  max-width: 100% !important;
  height: auto !important;
}


/* safety: images inside new form editor */
#newForm img {max-width:100% !important; width:100% !important; height:auto !important; display:block !important;}


/* === Patches (2025-09-01): modal scroll + proposal images === */
#editModal .modal-panel {
  max-height: 90vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
#editModalEditor {
  max-height: 60vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
/* Proposed content images responsive */
.proposed-html img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
}


/* === Wiki table defaults & alignment/width classes (2025-10-31) === */
.wiki-body table,
#editor table,
[data-editor] table {
  border-collapse: collapse;
  border: 1px solid #d0d3e7;
  margin: 8px 0;
  max-width: 100%;
}
.wiki-body td, .wiki-body th,
#editor td, #editor th,
[data-editor] td, [data-editor] th {
  border: 1px solid #d0d3e7;
  padding: 8px;
  min-height: 24px;
}

/* Alignment */
.table-align-left   { margin-left: 0;   margin-right: auto; }
.table-align-center { margin-left: auto; margin-right: auto; }
.table-align-right  { margin-left: auto; margin-right: 0; }

/* Width presets */
.table-w-25  { width:25%; }
.table-w-33  { width:33.3333%; }
.table-w-50  { width:50%; }
.table-w-66  { width:66.6667%; }
.table-w-75  { width:75%; }
.table-w-100 { width:100%; }


/* === Wiki table wrapper for inline/float alignment (2025-10-31 v2) === */
.wiki-table-wrap { max-width: 100%; }
.wiki-table-wrap > table.wiki-table { width: 100%; border-collapse: collapse; border:1px solid #d0d3e7; }
.wiki-table-wrap > table.wiki-table td,
.wiki-table-wrap > table.wiki-table th { border:1px solid #d0d3e7; padding:8px; min-height:24px; }

/* Alignment on wrapper (block-centering by margin) */
.wiki-table-wrap.table-align-left  { display:block; margin-left:0;    margin-right:auto; float:none; }
.wiki-table-wrap.table-align-right { display:block; margin-left:auto; margin-right:0;    float:none; }
.wiki-table-wrap.table-align-center{ display:block; margin-left:auto; margin-right:auto; float:none; }

/* Inline (character-like) mode */
.wiki-table-wrap.table-inline { display:inline-block; vertical-align:middle; }
.wiki-table-wrap.table-inline.table-align-left  { float:left;  margin:0 12px 12px 0; }
.wiki-table-wrap.table-inline.table-align-right { float:right; margin:0 0 12px 12px; }
.wiki-table-wrap.table-inline.table-align-center{ display:block; float:none; margin-left:auto; margin-right:auto; }

/* Width presets apply to wrapper */
.wiki-table-wrap.table-w-25  { width:25%; }
.wiki-table-wrap.table-w-33  { width:33.3333%; }
.wiki-table-wrap.table-w-50  { width:50%; }
.wiki-table-wrap.table-w-66  { width:66.6667%; }
.wiki-table-wrap.table-w-75  { width:75%; }
.wiki-table-wrap.table-w-100 { width:100%; }

/* Back-compat: if classes are on <table> (old pages), keep working */
.table-align-left   { margin-left:0;   margin-right:auto; }
.table-align-center { margin-left:auto; margin-right:auto; }
.table-align-right  { margin-left:auto; margin-right:0; }
.table-w-25  { width:25%; }
.table-w-33  { width:33.3333%; }
.table-w-50  { width:50%; }
.table-w-66  { width:66.6667%; }
.table-w-75  { width:75%; }
.table-w-100 { width:100%; }
