/* ═══════════════════════════════════════════
 * xline/style.css
 * ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');

/* 공통 */
.list-wrap { font-family: 'Noto Sans KR', sans-serif; }

/* ══════════════════════════════════════
 * 방명록 카드 피드 (index.php)
 * ══════════════════════════════════════ */

.xl-feed-empty {
  padding: 48px 16px; text-align: center;
  color: var(--ink-mute); font-size: 14px;
  border: 1px solid var(--hair); border-radius: 12px;
}

.xl-card {
  border: 1px solid var(--hair);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--paper);
}

/* 이름 바 */
.xl-card-namebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--hair-soft);
  flex-wrap: wrap; gap: 6px;
}
.xl-card-namebar-left  { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.xl-card-namebar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.xl-card-name   { font-size: 14px; font-weight: 700; color: var(--ink); }
.xl-card-handle { display: none; }
.xl-card-cat    { font-size: 12px; color: var(--accent); font-weight: 500; }
.xl-card-time   { font-size: 13px; color: var(--ink); font-weight: 500; }
.xl-card-action-btn {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  text-decoration: none; border: 1px solid var(--hair);
  color: var(--ink-mute); background: var(--paper-2);
  transition: border-color 0.12s, color 0.12s;
}
.xl-card-action-btn:hover            { border-color: var(--accent); color: var(--accent); }
.xl-card-action-btn--del:hover       { border-color: #e03c3c; color: #e03c3c; }

/* 본문 */
.xl-card-body        { display: block; }
.xl-card-body--split { display: flex; min-height: 240px; }

/* 왼쪽 미디어 */
.xl-card-media {
  flex: 0 0 50%; border-right: 1px solid var(--hair-soft);
  background: #000; display: flex; flex-direction: column; overflow: hidden;
}
.xl-card-media img { width: 100%; display: block; object-fit: cover; flex: 1; }
.xl-card-media img + img { border-top: 2px solid #000; }

/* 유튜브 임베드 */
.xl-card-video { position: relative; width: 100%; padding-top: 56.25%; }
.xl-card-video iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: none;
}

/* 오른쪽 내용 */
.xl-card-content { flex: 1; min-width: 0; padding: 16px 18px; background: #ffffff; }
.xl-card-text { font-size: 15px; line-height: 1.75; color: var(--ink); word-break: break-word; }

/* 댓글 */
.xl-card-comments { background: var(--paper); }

/* 페이지네이션 */
.xl-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 14px 16px;
  border: 1px solid var(--hair); border-radius: 12px; margin-top: 4px;
}
.xl-pagination a {
  font-size: 14px; color: var(--accent); font-weight: 600; text-decoration: none;
  padding: 6px 16px; border-radius: 9999px; border: 1px solid var(--accent);
  transition: background 0.12s;
}
.xl-pagination a:hover { background: var(--accent-soft); }
.xl-pagination .pg-disabled { font-size: 14px; color: var(--ink-mute); padding: 6px 14px; }
.xl-pg-info { font-size: 13px; color: var(--ink-mute); }

/* ══════════════════════════════════════
 * 글 작성/수정 폼 (_form.php)
 * ══════════════════════════════════════ */

.xlf-flash { padding: 12px 16px; font-size: 13px; font-weight: 500; border-radius: 8px; margin-bottom: 12px; }
.xlf-flash--success { background: var(--accent-soft); color: var(--accent); }
.xlf-flash--error   { background: #fff0f0; color: #e03c3c; }

.xl-compose {
  margin-bottom: 24px;
}

.xlf-layout {
  border: 1px solid var(--hair); border-radius: 12px;
  overflow: hidden; background: var(--paper);
  font-family: 'Noto Sans KR', sans-serif;
}

/* 이름 바 */
.xlf-namebar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--hair); background: var(--paper);
}
.xlf-namebar-text { font-size: 14px; font-weight: 700; color: var(--ink); }
.xlf-cat-inline {
  padding: 4px 8px; border: 1px solid var(--hair); border-radius: 6px;
  background: #ffffff; color: var(--ink); font-size: 12px;
  font-family: inherit; outline: none; cursor: pointer;
}
.xlf-cat-inline:focus { border-color: var(--accent); }
/* ── 이름 바 제목 입력 ── */
.xlf-title-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  font-family: 'Noto Sans KR', sans-serif;
  min-width: 0;
}
.xlf-title-input::placeholder {
  color: var(--ink-mute);
  font-weight: 400;
}


/* 2단 메인 */
.xlf-main { display: flex; min-height: 300px; }

/* 왼쪽: 미디어 */
.xlf-media-col {
  flex: 0 0 50%; border-right: 1px solid var(--hair);
  background: #1a1a1a;
  display: flex; flex-direction: column;
  overflow-y: auto; position: relative;
}
.xlf-media-placeholder {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: #555; font-size: 13px; min-height: 260px;
}

/* 이미지 아이템 */
.xlf-img-item { width: 100%; }
.xlf-img-item img { width: 100%; display: block; object-fit: cover; }
.xlf-img-item img + img { border-top: 2px solid #000; }

/* 유튜브 아이템 */
.xlf-yt-item { position: relative; width: 100%; padding-top: 56.25%; }
.xlf-yt-item iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: none;
}
.xlf-media-remove {
  position: absolute; top: 6px; right: 6px; z-index: 10;
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.65); color: #fff;
  font-size: 12px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}

/* 오른쪽: 내용 */
.xlf-content-col { flex: 1; display: flex; flex-direction: column; }
.xlf-content-area {
  flex: 1; width: 100%; box-sizing: border-box;
  padding: 16px; border: none; outline: none; resize: none;
  font-size: 15px; line-height: 1.7; color: var(--ink);
  background: #ffffff; font-family: 'Noto Sans KR', sans-serif;
  min-height: 300px;
}
.xlf-content-area::placeholder { color: var(--ink-mute); }

/* 미디어 입력 패널 */
.xlf-panel-wrap { border-top: 1px solid var(--hair-soft); }
.xlf-panel {
  padding: 12px 16px; background: var(--paper-2);
  border-bottom: 1px solid var(--hair-soft);
}
.xlf-panel-title {
  font-size: 12px; font-weight: 700; color: var(--ink-mute);
  letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 8px;
}
.xlf-panel-hint { font-size: 11px; color: var(--ink-mute); margin-top: 8px; }

/* URL 입력 행 */
.xlf-ext-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.xlf-ext-row  { display: flex; align-items: center; gap: 6px; }
.xlf-ext-input, .xlf-yt-input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--hair); border-radius: 7px;
  background: #ffffff; color: var(--ink); font-size: 13px;
  font-family: inherit; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.xlf-ext-input:focus, .xlf-yt-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.xlf-ext-remove {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--hair); background: var(--paper);
  color: var(--ink-mute); cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.12s, color 0.12s;
}
.xlf-ext-remove:hover { border-color: #e03c3c; color: #e03c3c; }
.xlf-add-row-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border: 1px solid var(--accent); border-radius: 9999px;
  background: transparent; color: var(--accent);
  font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background 0.12s;
}
.xlf-add-row-btn:hover { background: var(--accent-soft); }

/* 툴바 */
.xlf-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid var(--hair);
  background: var(--paper); flex-wrap: wrap; gap: 8px;
}
.xlf-toolbar-left  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.xlf-toolbar-right { display: flex; align-items: center; gap: 8px; }

.xlf-tool-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 9999px;
  border: 1px solid var(--hair); background: var(--paper-2);
  color: var(--ink-soft); font-size: 13px; cursor: pointer;
  font-family: inherit; transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.xlf-tool-btn:hover, .xlf-tool-btn--active {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft);
}
.xlf-tool-btn--check input { display: none; }

.xlf-btn {
  display: inline-flex; align-items: center;
  padding: 8px 18px; border-radius: 9999px;
  font-size: 14px; font-weight: 700;
  text-decoration: none; cursor: pointer;
  border: none; font-family: inherit;
  transition: opacity 0.12s, background 0.12s;
}
.xlf-btn--cancel { background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--hair); }
.xlf-btn--cancel:hover { background: var(--hair-soft); }
.xlf-btn--submit { background: var(--accent); color: #ffffff; }
.xlf-btn--submit:hover { opacity: 0.85; }

/* ══════════════════════════════════════
 * 반응형
 * ══════════════════════════════════════ */

@media (max-width: 600px) {
  .xl-card-body--split { flex-direction: column; }
  .xl-card-media { flex: none; border-right: none; border-bottom: 1px solid var(--hair-soft); }
  .xlf-main { flex-direction: column; }
  .xlf-media-col { flex: none; border-right: none; border-bottom: 1px solid var(--hair); min-height: 200px; }
  .xlf-content-area { min-height: 160px; }
}

/* ── 플래시 메시지 ── */
.xl-flash {
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; margin-bottom: 12px;
}
.xl-flash--success { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
.xl-flash--error   { background: #fff0f0; color: #e03c3c; border: 1px solid #fecaca; }

/* ── 수정 모드 배너 ── */
.xl-edit-banner {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent); padding: 9px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 700; margin-bottom: 10px;
}
.xl-edit-banner a { color: var(--accent); }

/* ── 글쓰기 버튼 active 상태 ── */
.list-actions .btn-new.active {
  background: color-mix(in srgb, var(--accent) 85%, #000);
}

/* ── 댓글 토글 버튼 ── */
.xl-comment-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-top: 1px solid var(--hair-soft);
  background: var(--paper);
  color: var(--ink-mute);
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.xl-comment-toggle:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.xl-comment-toggle.open {
  color: var(--accent);
  border-bottom: 1px solid var(--hair-soft);
}
.xl-comment-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  border-radius: 9999px;
}
.xl-comment-chevron {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.18s;
  display: inline-block;
}
.xl-comment-toggle.open .xl-comment-chevron {
  transform: rotate(180deg);
}
/* 댓글 영역 숨김/표시 */
.xl-card-comments[hidden] { display: none; }
.xl-card-comments { background: var(--paper); }

/* ══════════════════════════════════════
 * 댓글 (xline 자체 구현)
 * ══════════════════════════════════════ */

/* 댓글 목록 */
.xl-comment-list {
  border-bottom: 1px solid var(--hair-soft);
}
.xl-comment-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--hair-soft);
}
.xl-comment-item:last-child { border-bottom: none; }

.xl-comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.xl-comment-author {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.xl-comment-time {
  font-size: 11px;
  color: var(--ink-mute);
}
.xl-comment-del-form { margin-left: auto; }
.xl-comment-del {
  background: none;
  border: none;
  color: var(--ink-mute);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.12s;
}
.xl-comment-del:hover { color: #e03c3c; }

.xl-comment-text {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
  word-break: break-word;
}

/* 댓글 작성 폼 */
.xl-comment-form {
  padding: 12px 16px;
  background: var(--paper);
}
.xl-comment-inputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.xl-comment-author-input {
  width: 180px;
  padding: 7px 10px;
  border: 1px solid var(--hair);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.xl-comment-author-input:focus { border-color: var(--accent); }

.xl-comment-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--hair);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  min-height: 64px;
}
.xl-comment-textarea:focus { border-color: var(--accent); }
.xl-comment-textarea::placeholder,
.xl-comment-author-input::placeholder { color: var(--ink-mute); }

.xl-comment-submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.xl-comment-submit {
  padding: 7px 18px;
  border-radius: 9999px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.12s;
}
.xl-comment-submit:hover { opacity: 0.85; }

/* ── 라이트박스 ── */
#xlLightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#xlLightbox.open { display: flex; }

.xl-lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}
.xl-lb-img {
  position: relative;
  z-index: 1;
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  cursor: default;
}
.xl-lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 2;
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.12s;
}
.xl-lb-close:hover { opacity: 1; }

/* ══════════════════════════════════════
 * 캘린더 (12px 기준 소형)
 * ══════════════════════════════════════ */

/* 토글 버튼 */
.xl-cal-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--hair);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.xl-cal-toggle-btn:hover,
.xl-cal-toggle-btn.open {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.xl-cal-chevron {
  font-size: 10px;
  transition: transform 0.18s;
  display: inline-block;
}
.xl-cal-toggle-btn.open .xl-cal-chevron { transform: rotate(180deg); }

/* 캘린더 패널 */
.xl-calendar {
  display: block;
  border: 1px solid var(--hair);
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
  margin-bottom: 14px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12px;
  width: 224px;  /* 7칸 × 32px */
}
.xl-calendar[hidden] { display: none; }

/* 헤더 */
.xl-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid var(--hair-soft);
}
.xl-cal-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.xl-cal-nav {
  background: none;
  border: 1px solid var(--hair);
  border-radius: 4px;
  width: 20px;
  height: 20px;
  font-size: 14px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s, color 0.12s;
  padding: 0;
}
.xl-cal-nav:hover { border-color: var(--accent); color: var(--accent); }

/* 요일 행 */
.xl-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 32px);
  background: var(--paper-2);
  border-bottom: 1px solid var(--hair-soft);
}
.xl-cal-weekdays span {
  text-align: center;
  padding: 4px 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-mute);
}
.xl-cal-weekdays span:first-child { color: #e03c3c; }
.xl-cal-weekdays span:last-child  { color: #3b82f6; }

/* 날짜 그리드 */
.xl-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 32px);
  gap: 0;
  padding: 4px;
}
.xl-cal-day {
  width: 28px;
  height: 28px;
  margin: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  color: var(--ink-mute);
  background: none;
  border: none;
  cursor: default;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  padding: 0;
}
.xl-cal-day--empty { pointer-events: none; }

/* 글 있는 날짜 */
.xl-cal-day--active {
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  background: var(--accent-soft);
}
.xl-cal-day--active:hover {
  background: var(--accent);
  color: #fff;
}

/* 선택된 날짜 */
.xl-cal-day--selected {
  background: var(--accent) !important;
  color: #fff !important;
}

/* 오늘 */
.xl-cal-day--today:not(.xl-cal-day--active) {
  border: 1px solid var(--hair);
  color: var(--ink);
}

/* 전체 보기 버튼 */
.xl-cal-reset-wrap {
  padding: 5px 8px;
  border-top: 1px solid var(--hair-soft);
  display: flex;
  justify-content: center;
}
.xl-cal-reset-wrap[hidden] { display: none; }
.xl-cal-reset {
  padding: 3px 12px;
  border-radius: 9999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.xl-cal-reset:hover { background: var(--accent-soft); }
