/* Jubo Builder Frontend */
.jb-front { max-width: 900px; margin: 0 auto; padding: 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #1d2327; }
.jb-front *, .jb-front *::before, .jb-front *::after { box-sizing: border-box; }
.jb-front h2 { margin: 0 0 4px; font-size: 1.4em; }
.jb-front h2 small { font-weight: 400; color: #888; }
.jb-front h3 { margin: 0 0 12px; font-size: 1.1em; }
.jb-front h4 { margin: 0 0 12px; font-size: 1em; }
.jb-front a { color: #2271b1; text-decoration: none; }
.jb-front a:hover { text-decoration: underline; }
.jb-front p { margin: 6px 0; }

/* Header */
.jb-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid #e0e0e0; }
.jb-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jb-back { font-size: 0.85em; display: block; margin-bottom: 4px; }
.jb-user-info { font-size: 0.85em; color: #888; }

/* Cards */
.jb-card { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.jb-card-highlight { border-left: 4px solid #2271b1; background: #f0f6fc; }

/* Buttons */
.jb-btn { display: inline-block; padding: 8px 16px; border: 1px solid #ccc; border-radius: 6px; background: #fff; color: #333; cursor: pointer; font-size: 0.9em; line-height: 1.4; text-decoration: none !important; transition: all 0.15s; }
.jb-btn:hover { background: #f5f5f5; border-color: #999; }
.jb-btn-primary { background: #2271b1; color: #fff !important; border-color: #2271b1; }
.jb-btn-primary:hover { background: #135e96; }
.jb-btn-danger { color: #cc1818 !important; border-color: #cc1818; }
.jb-btn-danger:hover { background: #cc1818; color: #fff !important; }
.jb-btn-sm { padding: 4px 10px; font-size: 0.82em; }

/* Badges */
.jb-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.82em; font-weight: 600; }
.jb-badge-draft { background: #f0f0f1; color: #646970; }
.jb-badge-review { background: #fff3cd; color: #856404; }
.jb-badge-confirmed { background: #d4edda; color: #155724; }
.jb-badge-generated { background: #cce5ff; color: #004085; }
.jb-badge-published { background: #d4edda; color: #155724; }
.jb-badge-carry { background: #e8f5e9; color: #2e7d32; font-size: 0.75em; margin-left: 6px; }

/* Progress */
.jb-progress { display: inline-block; width: 80px; height: 6px; background: #e0e0e0; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.jb-progress-bar { height: 100%; background: #00a32a; border-radius: 3px; transition: width 0.3s; min-width: 2px; }

/* Table */
.jb-table { width: 100%; border-collapse: collapse; }
.jb-table th { text-align: left; font-size: 0.82em; color: #666; padding: 8px 10px; border-bottom: 2px solid #e0e0e0; }
.jb-table td { padding: 10px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.jb-table tbody tr:hover { background: #fafafa; }
.jb-link-strong { font-weight: 600; }
.jb-actions { white-space: nowrap; }
.jb-actions .jb-btn, .jb-actions form { margin-right: 4px; }
.jb-empty { text-align: center; color: #999; padding: 24px !important; }
.jb-muted { color: #aaa; }
.jb-meta { font-size: 0.82em; color: #888; margin-bottom: 12px; }

/* Inline form */
.jb-form-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.jb-form-inline label { display: flex; align-items: center; gap: 6px; font-size: 0.9em; }
.jb-form-inline input[type="text"],
.jb-form-inline input[type="date"] { padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9em; }
.jb-input-sm { width: 80px; }
.jb-hint { font-size: 0.82em; color: #666; }

/* Tabs */
.jb-tabs-wrap { overflow-x: auto; margin-bottom: 0; }
.jb-tabs { display: flex; gap: 2px; border-bottom: 2px solid #ddd; }
.jb-tab { padding: 10px 14px; font-size: 0.85em; color: #666; white-space: nowrap; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; text-decoration: none !important; transition: all 0.15s; }
.jb-tab:hover { background: #f5f5f5; color: #333; }
.jb-tab.active { background: #fff; color: #1d2327; font-weight: 600; border-color: #ddd; border-bottom: 2px solid #fff; margin-bottom: -2px; }

/* Content area */
.jb-content { background: #fff; border: 1px solid #ddd; border-top: none; border-radius: 0 0 8px 8px; padding: 20px; min-height: 200px; }

/* Form fields */
.jb-field { margin-bottom: 14px; }
.jb-field label { display: block; font-weight: 600; font-size: 0.88em; margin-bottom: 4px; color: #444; }
.jb-field input[type="text"],
.jb-field input[type="number"],
.jb-field textarea { width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.95em; font-family: inherit; transition: border-color 0.15s; }
.jb-field input:focus,
.jb-field textarea:focus { border-color: #2271b1; outline: none; box-shadow: 0 0 0 2px rgba(34,113,177,0.15); }
.jb-field textarea { resize: vertical; }
.jb-checkbox { display: flex; align-items: center; gap: 6px; font-weight: 400 !important; }
.jb-checkbox input { width: auto; }

/* Form actions */
.jb-form-actions { margin-top: 16px; display: flex; align-items: center; gap: 8px; }
.jb-result { font-size: 0.9em; font-weight: 600; }
.jb-result.success { color: #00a32a; }
.jb-result.error { color: #cc1818; }
.jb-result.loading { color: #2271b1; }

/* Multi items list */
.jb-items-list { margin-bottom: 8px; }
.jb-item-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #eee; border-radius: 6px; margin-bottom: 4px; background: #fff; transition: box-shadow 0.15s; }
.jb-item-row:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.jb-drag { cursor: move; color: #bbb; font-size: 1.1em; user-select: none; }
.jb-item-main { flex: 1; min-width: 0; }
.jb-item-main strong { display: block; font-size: 0.95em; }
.jb-item-meta { font-size: 0.78em; color: #999; }
.jb-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.jb-item-row.ui-sortable-helper { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* Publish steps */
.jb-step { border: 1px solid #ddd; border-radius: 8px; padding: 16px; margin-bottom: 12px; border-left: 4px solid #ccc; }
.jb-step h3 { margin: 0 0 8px; }
.jb-step-done { border-left-color: #00a32a; background: #f8fff8; }
.jb-step-disabled { opacity: 0.4; pointer-events: none; }

/* Completion */
.jb-completion { display: flex; flex-wrap: wrap; gap: 6px; }
.jb-comp-item { padding: 4px 10px; background: #f5f5f5; border-radius: 4px; font-size: 0.85em; }

/* Login prompt */
.jb-login-prompt { text-align: center; padding: 40px; }

/* Responsive */
@media (max-width: 600px) {
    .jb-front { padding: 8px; }
    .jb-header { flex-direction: column; gap: 8px; }
    .jb-table th:nth-child(4), .jb-table td:nth-child(4) { display: none; }
    .jb-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .jb-tab { padding: 8px 10px; font-size: 0.8em; }
    .jb-form-inline { flex-direction: column; align-items: stretch; }
}

/* ============================================= */
/* Visual Editor — Bulletin-style inline editing */
/* ============================================= */

.jb-visual-editor { max-width: 760px; margin: 0 auto; font-family: 'Malgun Gothic', '맑은 고딕', -apple-system, sans-serif; }

/* Toolbar */
.jb-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #1d2327; color: #fff; border-radius: 8px 8px 0 0; position: sticky; top: 0; z-index: 100; flex-wrap: wrap; }
.jb-toolbar-title { flex: 1; font-weight: 600; font-size: 1em; }
.jb-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.jb-toolbar .jb-btn { font-size: 0.82em; }
.jb-toolbar .jb-btn-sm { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); color: #fff; }
.jb-toolbar .jb-btn-primary { background: #2271b1; border-color: #2271b1; }

/* Page navigation */
.jb-page-nav { display: flex; gap: 0; border-bottom: 2px solid #333; background: #f5f5f5; overflow-x: auto; }
.jb-page-btn { padding: 10px 16px; border: none; background: transparent; cursor: pointer; font-size: 0.88em; color: #555; white-space: nowrap; border-bottom: 3px solid transparent; transition: all 0.15s; }
.jb-page-btn:hover { background: #e8e8e8; }
.jb-page-btn.active { color: #1d2327; font-weight: 600; border-bottom-color: #2271b1; background: #fff; }

/* Bulletin page */
.jb-page { display: none; }
.jb-page.active { display: block; }
.jb-bulletin-page { background: #fff; border: 1px solid #ddd; border-top: none; padding: 28px 32px; min-height: 400px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

/* Section titles */
.jb-section-title { text-align: center; font-size: 1.1em; border-bottom: 2px solid #333; padding-bottom: 6px; margin: 16px 0 12px; }

/* Verse header */
.jb-page-header-verse { text-align: center; font-style: italic; color: #555; padding: 8px; margin-bottom: 16px; font-size: 0.92em; }

/* Two column */
.jb-two-col { display: flex; gap: 20px; margin: 12px 0; }
.jb-col { flex: 1; }

/* ── Editable fields ── */
.jb-ed, .jb-ed-item {
    cursor: text;
    border-bottom: 1px dashed #bbb;
    padding: 1px 4px;
    border-radius: 2px;
    transition: all 0.15s;
    display: inline;
    min-width: 30px;
    min-height: 1em;
}
.jb-ed:hover, .jb-ed-item:hover { background: #FEE500; border-bottom-color: #FEE500; }
.jb-ed:empty::before, .jb-ed-item:empty::before { content: '클릭하여 입력'; color: #ccc; font-style: italic; }
.jb-ed-important { color: #1a1a1a; font-weight: 600; }
.jb-ed-block { display: block; padding: 6px 8px; margin: 4px 0; border: 1px dashed #ddd; border-radius: 4px; min-height: 1.5em; }
.jb-ed-block:hover { border-color: #FEE500; background: #fffde7; }
.jb-ed-multiline { white-space: pre-wrap; line-height: 1.6; }
.jb-ed-large { min-height: 150px; }

/* Active editing state */
.jb-ed.editing, .jb-ed-item.editing,
.jb-ed-block.editing {
    background: #fffde7;
    border: 2px solid #FEE500 !important;
    outline: none;
    border-radius: 4px;
    padding: 4px 6px;
}

/* Worship table */
.jb-worship-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.92em; }
.jb-worship-table td { padding: 6px 8px; border-bottom: 1px solid #eee; }
.jb-wt-label { font-weight: 600; width: 80px; white-space: nowrap; }
.jb-table-compact { max-width: 500px; }
.jb-highlight-row { background: #f0f6fc; }
.jb-highlight-row td { font-weight: 600; }
.jb-small { font-size: 0.85em; color: #666; }

/* Sub sections */
.jb-sub-section { margin-bottom: 20px; padding-left: 8px; }
.jb-sub-section p { margin: 4px 0; font-size: 0.92em; }

/* Sermon summary */
.jb-sermon-summary h3 { text-align: center; font-size: 1em; margin: 8px 0; }
.jb-verse-quote { text-align: center; font-style: italic; color: #555; padding: 8px; margin: 8px 0; }
.jb-sermon-outline { margin: 12px 0; line-height: 1.8; }
.jb-sermon-conclusion { margin-top: 12px; padding-top: 8px; border-top: 1px solid #eee; }

/* Discussion */
.jb-discussion-intro { font-size: 0.9em; line-height: 1.7; color: #444; margin-bottom: 12px; }
.jb-discussion-tip { font-size: 0.85em; color: #888; margin-bottom: 16px; }
.jb-questions { margin: 12px 0; }

/* Department table */
.jb-dept-table { width: 100%; border-collapse: collapse; font-size: 0.9em; margin: 8px 0; }
.jb-dept-table th { background: #f5f5f5; padding: 6px 8px; text-align: left; font-size: 0.85em; border-bottom: 2px solid #ddd; }
.jb-dept-table td { padding: 6px 8px; border-bottom: 1px solid #eee; vertical-align: top; }

/* Notices */
.jb-notice-item { padding: 10px 0; border-bottom: 1px solid #eee; }
.jb-notice-header { display: flex; align-items: center; gap: 8px; }
.jb-notice-header strong { flex: 1; }
.jb-notice-body { margin-top: 4px; padding-left: 12px; font-size: 0.92em; }

/* Stats table */
.jb-stats-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.jb-stats-table td { padding: 4px 8px; border-bottom: 1px solid #eee; }
.jb-stats-table td:first-child { width: 100px; color: #555; }
.jb-stats-table td:last-child { text-align: right; }
.jb-row-total { font-weight: 600; border-top: 2px solid #333; }
.jb-row-total td { border-bottom: 2px solid #333; }

/* Icon button */
.jb-btn-icon { border: none; background: none; cursor: pointer; color: #ccc; font-size: 1em; padding: 2px; }
.jb-btn-icon:hover { color: #cc1818; }

/* Inline editing inputs */
.jb-inline-input { border: none; outline: none; background: transparent; font-family: inherit; padding: 0; margin: 0; width: 100%; min-width: 60px; }
.jb-block-input { border: none; outline: none; background: transparent; font-family: inherit; padding: 4px; margin: 0; width: 100%; resize: vertical; line-height: 1.6; }

/* Add item button */
.jb-add-item { border-style: dashed; color: #2271b1; }

/* Responsive visual editor */
@media (max-width: 600px) {
    .jb-bulletin-page { padding: 16px; }
    .jb-two-col { flex-direction: column; gap: 12px; }
    .jb-toolbar { flex-direction: column; align-items: stretch; }
    .jb-page-nav { overflow-x: auto; }
    .jb-page-btn { font-size: 0.8em; padding: 8px 10px; }
}
