/**
 * EOND Board — 프론트엔드 공통 CSS (스킨 CSS보다 먼저 로드)
 */

/* 스킨 전역 리셋 */
.eond-board,
.eond-board * {
    box-sizing: border-box;
}

/* 폼 리셋 */
.eond-board input,
.eond-board select,
.eond-board textarea,
.eond-board button {
    font-family: inherit;
}

/* 링크 기본 */
.eond-board a {
    text-decoration: none;
    color: inherit;
}

/* 임시저장 알림 */
.eond-draft-notice {
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}
.eond-draft-notice strong {
    color: #92400e;
}
.eond-draft-notice ul {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}
.eond-draft-notice li {
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.eond-draft-notice li a {
    color: #2563eb;
    text-decoration: underline;
}
.eond-draft-date {
    color: #9ca3af;
    font-size: 12px;
}
/* 예약글 알림 */
.eond-scheduled-notice {
    background: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}
.eond-scheduled-notice strong {
    color: #1e40af;
}
.eond-scheduled-notice ul {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}
.eond-scheduled-notice li {
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.eond-scheduled-notice li a {
    color: #2563eb;
    text-decoration: underline;
}
.eond-scheduled-notice li a.eond-load-post-btn {
    cursor: pointer;
}
.eond-scheduled-date {
    color: #3b82f6;
    font-size: 12px;
}

.eond-draft-delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}
.eond-draft-delete-btn:hover {
    background: #fef2f2;
    color: #dc2626;
}
.eond-draft-delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 예약 발행 필드 */
.eond-schedule-field {
    margin: 8px 0 12px;
}
.eond-schedule-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}
.eond-schedule-field input[type="datetime-local"] {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

/* 자동저장 상태 */
.eond-autosave-status {
    font-size: 12px;
    color: #6b7280;
    margin-left: 8px;
}

/* 임시저장 버튼 */
.eond-btn-draft,
.pikaive-btn-draft {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}
.eond-btn-draft:hover,
.pikaive-btn-draft:hover {
    background: #e5e7eb;
}
.eond-btn-draft:disabled,
.pikaive-btn-draft:disabled,
.pikaive-btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─── 유튜브 스마트 임베딩 ─── */
.eond-yt-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
    margin: 16px 0;
}
.eond-yt-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* PIP placeholder (원본 자리 유지) */
.eond-yt-pip-placeholder {
    position: relative;
    background: #1a1a1a;
    border-radius: 8px;
    margin: 16px 0;
}

/* PIP 모드 */
.eond-yt-pip {
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    width: 360px;
    height: 203px;
    padding-bottom: 0 !important;
    overflow: visible;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: eondPipIn 0.3s ease-out;
    margin: 0;
}
@keyframes eondPipIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.eond-yt-pip iframe {
    border-radius: 12px;
}

/* PIP 닫기 버튼 */
.eond-pip-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1f2937;
    color: #fff;
    border: 2px solid #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: background 0.2s;
}
.eond-pip-close:hover {
    background: #ef4444;
}

/* 모바일 PIP */
@media (max-width: 640px) {
    .eond-yt-pip {
        width: 240px;
        height: 135px;
        bottom: 12px;
        right: 12px;
    }
}

/* 글쓰기 유튜브 미리보기 */
.eond-yt-write-preview {
    margin-top: 12px;
}
.eond-yt-preview-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 6px;
}

/* ─── 투표(Poll) 빌더 (글쓰기) ─── */
.pikaive-poll-builder {
    margin: 12px 0;
}

.pikaive-poll-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.pikaive-poll-toggle:hover {
    border-color: #9ca3af;
    color: #374151;
    background: #f3f4f6;
}

.pikaive-poll-form {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #fafafa;
}

.pikaive-poll-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.pikaive-poll-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pikaive-poll-option-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s;
}

.pikaive-poll-option-row input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.pikaive-poll-option-remove {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.pikaive-poll-option-remove:hover {
    background: #fee2e2;
    color: #ef4444;
}

.pikaive-poll-add-option {
    display: inline-block;
    padding: 6px 12px;
    border: none;
    background: none;
    color: #2563eb;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.2s;
}

.pikaive-poll-add-option:hover {
    color: #1d4ed8;
}

.pikaive-poll-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.pikaive-poll-info {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #9ca3af;
}

.pikaive-poll-remove {
    padding: 4px 10px;
    border: none;
    background: none;
    color: #ef4444;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.2s;
}

.pikaive-poll-remove:hover {
    color: #dc2626;
    text-decoration: underline;
}

/* ─── 투표(Poll) 결과 (글 보기) ─── */
.eond-poll {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: #fff;
}

.eond-poll-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.eond-poll-title {
    font-size: 15px;
    font-weight: 600;
    color: #212121;
}

.eond-poll-status {
    margin-left: auto;
    font-size: 12px;
    color: #9ca3af;
}

.eond-poll-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eond-poll-option-btn {
    position: relative;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.2s;
}

.eond-poll-option-btn:hover:not(:disabled) {
    border-color: #9ca3af;
}

.eond-poll-option-btn:disabled {
    cursor: default;
}

.eond-poll-option-btn.voted {
    border-color: #93c5fd;
}

.eond-poll-option-bar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: rgba(37, 99, 235, 0.08);
    transition: width 0.5s ease;
    pointer-events: none;
}

.eond-poll-option-btn.voted .eond-poll-option-bar {
    background: rgba(37, 99, 235, 0.15);
}

.eond-poll-option-label {
    position: relative;
    z-index: 1;
    flex: 1;
}

.eond-poll-option-pct {
    position: relative;
    z-index: 1;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
}

.eond-poll-option-count {
    position: relative;
    z-index: 1;
    font-size: 12px;
    color: #9ca3af;
}

.eond-poll-check {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    color: #2563eb;
}

.eond-poll-footer {
    margin-top: 12px;
    font-size: 12px;
    color: #9ca3af;
}

/* 예약 배지 (목록용) */
.eond-badge-scheduled {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 500;
}

/* =========================================
   게시물 순서 변경 (Reorder)
   ========================================= */

/* 순서 변경 토글 버튼 */
.eond-reorder-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--eb-text-muted, #718096);
    background: var(--eb-bg-subtle, #f7fafc);
    border: 1px solid var(--eb-border, #e2e8f0);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}
.eond-reorder-toggle:hover {
    color: var(--eb-accent, #1a1a1a);
    border-color: var(--eb-accent, #1a1a1a);
}
.eond-reorder-toggle.active {
    color: #fff;
    background: var(--eb-accent, #1a1a1a);
    border-color: var(--eb-accent, #1a1a1a);
}
.eond-reorder-toggle svg {
    flex-shrink: 0;
}

/* 저장됨 피드백 */
.eond-reorder-saved {
    font-size: 12px;
    color: #16a34a;
    font-weight: 500;
    margin-left: 8px;
}

/* 드래그 핸들 (공통) */
.eond-reorder-handle {
    cursor: grab;
    color: var(--eb-text-muted, #a0aec0);
    font-size: 16px;
    user-select: none;
    line-height: 1;
}
.eond-reorder-handle:active {
    cursor: grabbing;
}

/* 순서 번호 배지 */
.eond-reorder-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--eb-accent, #1a1a1a);
    border-radius: 50%;
    line-height: 1;
}

/* 드래그 오버 하이라이트 */
.eond-drag-over {
    outline: 2px dashed var(--eb-accent, #3182ce) !important;
    outline-offset: -2px;
    background: var(--eb-bg-subtle, #ebf8ff) !important;
}

/* 리오더 모드 — 테이블 행 */
.eond-reorder-mode tr[data-reorder-item] {
    cursor: grab;
}
.eond-reorder-mode tr[data-reorder-item]:active {
    cursor: grabbing;
}

/* 핸들 컬럼 */
.col-handle {
    width: 60px;
    text-align: center;
    white-space: nowrap;
}
.col-handle .eond-reorder-handle {
    margin-right: 4px;
}

/* 리오더 모드 — pikaive 카드 */
.eond-reorder-handle-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--eb-bg-subtle, #f7fafc);
    border-bottom: 1px solid var(--eb-border, #e2e8f0);
    font-size: 13px;
}
.eond-reorder-handle-wrap button {
    background: none;
    border: 1px solid var(--eb-border, #e2e8f0);
    border-radius: 3px;
    padding: 2px 6px;
    cursor: pointer;
    color: var(--eb-text-muted, #718096);
    font-size: 10px;
    line-height: 1;
}
.eond-reorder-handle-wrap button:hover:not(:disabled) {
    color: var(--eb-accent, #1a1a1a);
    border-color: var(--eb-accent, #1a1a1a);
}
.eond-reorder-handle-wrap button:disabled {
    opacity: 0.3;
    cursor: default;
}

/* pikaive 리오더 모드 */
.pikaive-post-list.eond-reorder-mode .pikaive-post-item[data-reorder-item] {
    cursor: grab;
}
.pikaive-post-list.eond-reorder-mode .pikaive-post-item[data-reorder-item]:active {
    cursor: grabbing;
}

/* pikaive 헤더 info flex */
.pikaive-board-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
