/**
 * EOND Board — 기본 스킨 스타일 (CSS 변수 기반 테마)
 *
 * 테마 변수는 .eond-board[style] 에 inline으로 주입됩니다.
 * --eb-bg, --eb-bg-subtle, --eb-text, --eb-text-heading, --eb-text-muted,
 * --eb-text-link, --eb-border, --eb-border-strong, --eb-accent,
 * --eb-accent-hover, --eb-accent-text, --eb-badge-notice, --eb-badge-secret,
 * --eb-focus-ring, --eb-focus-border, --eb-radius
 */

/* === Fallback (테마 변수가 없을 때) === */
.eond-board {
    --eb-bg: #ffffff;
    --eb-bg-subtle: #f7fafc;
    --eb-bg-notice: #fffbeb;
    --eb-text: #333333;
    --eb-text-heading: #1a1a1a;
    --eb-text-muted: #718096;
    --eb-text-link: #1a1a1a;
    --eb-border: #e2e8f0;
    --eb-border-strong: #1a1a1a;
    --eb-accent: #1a1a1a;
    --eb-accent-hover: #333333;
    --eb-accent-text: #ffffff;
    --eb-badge-notice: #e53e3e;
    --eb-badge-secret: #718096;
    --eb-focus-ring: rgba(49, 130, 206, 0.1);
    --eb-focus-border: #3182ce;
    --eb-radius: 4px;
}

/* === 공통 === */
.eond-board {
    max-width: 960px;
    margin: 0 auto;
    font-size: 14px;
    color: var(--eb-text);
    background: var(--eb-bg);
    line-height: 1.6;
}

.eond-board * {
    box-sizing: border-box;
}

.eond-board-title {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0 0 1em;
    color: var(--eb-text-heading);
}

/* === 배지 === */
.eond-badge-notice {
    display: inline-block;
    background: var(--eb-badge-notice);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: middle;
}

.eond-badge-secret {
    display: inline-block;
    background: var(--eb-badge-secret);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: middle;
}

.eond-post-category {
    display: inline-block;
    background: var(--eb-bg-subtle);
    color: var(--eb-text-muted);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

/* === 목록 === */
.eond-board-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
}

.eond-board-count {
    font-size: 13px;
    color: var(--eb-text-muted);
}

.eond-board-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1em;
}

.eond-board-cat {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--eb-border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--eb-text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.eond-board-cat:hover,
.eond-board-cat.active {
    background: var(--eb-accent);
    color: var(--eb-accent-text);
    border-color: var(--eb-accent);
}

.eond-board-table {
    width: 100%;
    border-collapse: collapse;
    border-top: 1px solid var(--eb-border);
}

.eond-board-table th {
    background: var(--eb-bg-subtle);
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--eb-border);
    color: var(--eb-text-muted);
}

.eond-board-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--eb-border);
    text-align: center;
    font-size: 13px;
}

.eond-board-table .col-num { width: 60px; }
.eond-board-table .col-title { text-align: left; }
.eond-board-table .col-author { width: 100px; }
.eond-board-table .col-date { width: 90px; }
.eond-board-table .col-views { width: 60px; }

.eond-board-table .col-title a {
    color: var(--eb-text-link);
    text-decoration: none;
}

.eond-board-table .col-title a:hover {
    text-decoration: underline;
}

.eond-notice-row {
    background: var(--eb-bg-notice);
}

.eond-comment-count {
    color: var(--eb-badge-notice);
    font-weight: 600;
    font-size: 12px;
    margin-left: 4px;
}

.eond-empty {
    text-align: center !important;
    padding: 40px !important;
    color: var(--eb-text-muted);
}

/* === 페이지네이션 === */
.eond-board-pagination {
    margin: 1.5em 0;
    text-align: center;
}

.eond-board-pagination .page-numbers {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid var(--eb-border);
    border-radius: var(--eb-radius);
    text-decoration: none;
    color: var(--eb-text-muted);
    font-size: 13px;
}

.eond-board-pagination .page-numbers.current {
    background: var(--eb-accent);
    color: var(--eb-accent-text);
    border-color: var(--eb-accent);
}

.eond-board-pagination .page-numbers:hover:not(.current) {
    background: var(--eb-bg-subtle);
}

/* === 하단 액션 === */
.eond-board-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1em;
}

.eond-board-search {
    display: flex;
    gap: 4px;
}

.eond-board-search input {
    padding: 8px 12px;
    border: 1px solid var(--eb-border);
    border-radius: var(--eb-radius);
    font-size: 13px;
    width: 200px;
    background: var(--eb-bg);
    color: var(--eb-text);
}

.eond-board .eond-board-search button {
    padding: 8px 16px;
    background: var(--eb-text-muted);
    color: #fff;
    border: none;
    border-radius: var(--eb-radius);
    cursor: pointer;
    font-size: 13px;
}

/* === 버튼 === */
.eond-board .eond-btn {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid var(--eb-border);
    border-radius: var(--eb-radius);
    text-decoration: none;
    font-size: 13px;
    color: var(--eb-text-muted);
    background: var(--eb-bg);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.eond-board .eond-btn:hover {
    background: var(--eb-bg-subtle);
    text-decoration: none;
}

.eond-board a.eond-btn-write,
.eond-board button.eond-btn-submit,
.eond-board .eond-btn-write,
.eond-board .eond-btn-submit {
    background: var(--eb-accent);
    color: var(--eb-accent-text);
    border-color: var(--eb-accent);
}

.eond-board a.eond-btn-write:hover,
.eond-board button.eond-btn-submit:hover,
.eond-board .eond-btn-write:hover,
.eond-board .eond-btn-submit:hover {
    background: var(--eb-accent-hover);
    color: var(--eb-accent-text);
    text-decoration: none;
}

.eond-board .eond-btn-delete {
    color: var(--eb-badge-notice);
    border-color: var(--eb-badge-notice);
}

.eond-board .eond-btn-delete:hover {
    background: var(--eb-badge-notice);
    color: #fff;
}

/* === 글 보기 === */
.eond-view-header {
    border-bottom: 1px solid var(--eb-border);
    padding-bottom: 1em;
    margin-bottom: 1.5em;
}

.eond-view-title {
    font-size: 1.6em;
    font-weight: 700;
    margin: 0.5em 0 0.3em;
    color: var(--eb-text-heading);
    line-height: 1.4;
}

.eond-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--eb-text-muted);
}

.eond-view-content {
    min-height: 200px;
    padding: 1.5em 0;
    line-height: 1.8;
    word-break: break-word;
}

.eond-view-content img {
    max-width: 100%;
    height: auto;
}

/* 글 본문 리스트 스타일 */
.eond-view-content ul {
    list-style: disc;
    padding-left: 24px;
    margin: 8px 0;
}

.eond-view-content ol {
    list-style: decimal;
    padding-left: 24px;
    margin: 8px 0;
}

.eond-view-content li {
    margin: 4px 0;
    display: list-item;
}

.eond-view-content ul ul {
    list-style: circle;
}

.eond-view-content ul ul ul {
    list-style: square;
}

/* 글 본문 체크박스(task list) — Toast UI: li.task-list-item */
.eond-view-content li.task-list-item {
    list-style: none;
    display: flex;
    align-items: flex-start;
    gap: 0 8px;
    margin-left: -24px;
    display:grid;
    grid-template-columns: 16px auto;
}
.eond-view-content li.task-list-item p:first-child ~ *{
  grid-column: 1 / -1;
  margin-left: 24px;
}

.eond-view-content li.task-list-item::before {
    content: '';
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 4px;
    border: 1.5px solid var(--eb-text-muted);
    border-radius: 3px;
    background: var(--eb-bg);
}

.eond-view-content li.task-list-item.checked::before {
    background: var(--eb-accent);
    border-color: var(--eb-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-size: 12px 12px;
    background-repeat: no-repeat;
    background-position: center;
}

.eond-view-content li.task-list-item p {
    margin: 0;
}

.eond-view-content li.task-list-item.checked p {
    color: var(--eb-text-muted);
    text-decoration: line-through;
}

/* 글 본문 기타 마크다운 요소 */
.eond-view-content h1,
.eond-view-content h2,
.eond-view-content h3,
.eond-view-content h4,
.eond-view-content h5,
.eond-view-content h6 {
    color: var(--eb-text-heading);
    line-height: 1.4;
    margin: 1em 0 0.5em;
}

.eond-view-content h1 { font-size: 1.6em; font-weight: 700; }
.eond-view-content h2 { font-size: 1.4em; font-weight: 700; }
.eond-view-content h3 { font-size: 1.2em; font-weight: 600; }
.eond-view-content h4 { font-size: 1.1em; font-weight: 600; }

.eond-view-content blockquote {
    border-left: 4px solid var(--eb-accent, #1a1a1a);
    padding-left: 16px;
    margin: 12px 0;
    color: var(--eb-text-muted);
}

.eond-view-content pre {
    background: var(--eb-bg-subtle, #f7fafc);
    border-radius: 4px;
    padding: 12px 16px;
    overflow-x: auto;
}

.eond-view-content code {
    background: var(--eb-bg-subtle, #f7fafc);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.eond-view-content pre code {
    background: none;
    padding: 0;
}

.eond-view-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.eond-view-content th,
.eond-view-content td {
    border: 1px solid var(--eb-border, #e2e8f0);
    padding: 8px 12px;
    text-align: left;
}

.eond-view-content th {
    background: var(--eb-bg-subtle, #f7fafc);
    font-weight: 600;
}

.eond-view-content hr {
    border: none;
    border-top: 1px solid var(--eb-border, #e2e8f0);
    margin: 1.5em 0;
}

.eond-view-content a {
    color: var(--eb-focus-border, #3182ce);
    text-decoration: none;
}

.eond-view-content a:hover {
    text-decoration: underline;
}

.eond-view-attachments {
    background: var(--eb-bg-subtle);
    border-radius: 6px;
    padding: 1em 1.5em;
    margin-bottom: 1.5em;
}

.eond-view-attachments h4 {
    margin: 0 0 0.5em;
    font-size: 14px;
    color: var(--eb-text-muted);
}

.eond-view-attachments ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.eond-view-attachments li {
    padding: 4px 0;
}

.eond-view-attachments a {
    color: var(--eb-focus-border);
    text-decoration: none;
}

.eond-view-attachments a:hover {
    text-decoration: underline;
}

.eond-view-actions {
    display: flex;
    gap: 8px;
    padding: 1em 0;
    border-top: 1px solid var(--eb-border);
    border-bottom: 1px solid var(--eb-border);
}

.eond-delete-form {
    display: inline;
}

/* === 이전/다음 글 === */
.eond-view-navigation {
    padding: 1em 0;
}

.eond-nav-prev,
.eond-nav-next {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--eb-border);
}

.eond-nav-label {
    flex-shrink: 0;
    width: 50px;
    font-size: 12px;
    font-weight: 600;
    color: var(--eb-text-muted);
}

.eond-nav-prev a,
.eond-nav-next a {
    color: var(--eb-text-link);
    text-decoration: none;
    font-size: 13px;
}

.eond-nav-prev a:hover,
.eond-nav-next a:hover {
    text-decoration: underline;
}

/* === 글쓰기 폼 === */
.eond-write-form {
    max-width: 720px;
}

.eond-field {
    margin-bottom: 1em;
}

.eond-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--eb-text-muted);
    margin-bottom: 4px;
}

.eond-field .required {
    color: var(--eb-badge-notice);
}

.eond-field input[type="text"],
.eond-field input[type="email"],
.eond-field input[type="password"],
.eond-field select,
.eond-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--eb-border);
    border-radius: var(--eb-radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--eb-bg);
    color: var(--eb-text);
    transition: border-color 0.2s;
}

.eond-field input:focus,
.eond-field select:focus,
.eond-field textarea:focus {
    outline: none;
    border-color: var(--eb-focus-border);
    box-shadow: 0 0 0 3px var(--eb-focus-ring);
}

.eond-field-row {
    display: flex;
    gap: 12px;
}

.eond-field-row .eond-field {
    flex: 1;
}

.eond-field-options {
    display: flex;
    gap: 16px;
    margin-bottom: 1em;
}

.eond-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--eb-text-muted);
    cursor: pointer;
}

.eond-write-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 1.5em;
}

/* === 비밀번호 확인 === */
.eond-confirm-message {
    color: var(--eb-text-muted);
    margin-bottom: 1.5em;
}

.eond-confirm-form {
    max-width: 400px;
}

.eond-confirm-actions {
    display: flex;
    gap: 8px;
    margin-top: 1em;
}

.eond-alert {
    padding: 10px 16px;
    border-radius: var(--eb-radius);
    margin-bottom: 1em;
    font-size: 13px;
}

.eond-alert-error {
    background: #fff5f5;
    color: #e53e3e;
    border: 1px solid #fed7d7;
}

/* === 추천/비추천 버튼 === */
.eond-vote-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.eond-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--eb-border);
    border-radius: var(--eb-radius);
    background: var(--eb-bg);
    color: var(--eb-text-muted);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    transition: all 0.2s;
}

.eond-vote-btn:hover {
    background: var(--eb-bg-subtle);
}

.eond-vote-btn svg {
    flex-shrink: 0;
}

.eond-vote-btn.active.eond-vote-up {
    color: var(--eb-focus-border, #3182ce);
    border-color: var(--eb-focus-border, #3182ce);
    background: var(--eb-focus-ring, rgba(49, 130, 206, 0.1));
}

.eond-vote-btn.active.eond-vote-down {
    color: var(--eb-badge-notice, #e53e3e);
    border-color: var(--eb-badge-notice, #e53e3e);
    background: rgba(229, 62, 62, 0.08);
}

.eond-vote-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.eond-vote-count {
    font-weight: 600;
    min-width: 8px;
    text-align: center;
}

/* === 좋아요 버튼 === */
.eond-like-button {
    display: inline-block;
}

.eond-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    border: 1px solid var(--eb-border);
    border-radius: var(--eb-radius);
    background: var(--eb-bg);
    color: var(--eb-text-muted);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
}

.eond-like-btn:hover {
    background: var(--eb-bg-subtle);
}

.eond-like-btn.active {
    color: var(--eb-text-heading);
    background: var(--eb-bg-subtle);
    border-color: var(--eb-text-muted);
}

.eond-like-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.eond-like-icon {
    flex-shrink: 0;
}

.eond-like-count {
    font-weight: 600;
    min-width: 8px;
}

/* === 댓글 콘텐츠 (Tailwind Preflight p{margin:0} 대응) === */
.eond-view-comments .comment-content p,
.eond-view-comments .comment-body p {
    margin: 0 0 0.6em !important;
}

.eond-view-comments .comment-content p:last-child,
.eond-view-comments .comment-body p:last-child {
    margin-bottom: 0 !important;
}

/* 본문 <p> 마진 — Tailwind Preflight 대응 */
.eond-view-content p {
    margin: 0 0 0.8em !important;
}

.eond-view-content p:last-child {
    margin-bottom: 0 !important;
}

/* === 반응형 === */
@media (max-width: 768px) {
    .eond-board-table .col-author,
    .eond-board-table .col-views {
        display: none;
    }

    .eond-board-table .col-num {
        width: 40px;
    }

    .eond-board-table .col-date {
        width: 70px;
        font-size: 12px;
    }

    .eond-board-actions {
        flex-direction: column;
        gap: 10px;
    }

    .eond-board-search input {
        width: 150px;
    }

    .eond-field-row {
        flex-direction: column;
        gap: 0;
    }

    .eond-view-meta {
        gap: 8px;
    }
}
