/* Church Vision 컬러 시스템 */
:root {
  --cv-main: #0D47A1;
  --cv-accent: #FFFFFF;
  --cv-deep: #0A3D7A;
  --cv-light: #1565C0;
  --cv-pale: #E3F2FD;
  --cv-indigo: #1A237E;
}

/* 가로 스크롤/드래그 방지 - 모바일에서만 적용 (PC에서 불필요한 스크롤바 방지) */
@media (max-width: 1023px) {
  html, body {
    overflow-x: hidden;
    max-width: 100%;
  }
}
body {
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
}

/* 전 페이지 공통 페이지 타이틀 (교회학교·교회소개와 동일한 비주얼) */
.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--cv-main);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--cv-main);
  line-height: 1.25;
}
@media (min-width: 768px) {
  .page-title { font-size: 2.25rem; }
}

/* 공통 스타일 - 레이아웃/확대·축소/설교 PiP 등 반복 사용 */
[data-zoom] { transition: zoom 0.3s ease; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 메인(/) 오늘의 QT 본문: 말줄임 — 전체는 /qt 페이지에서 */
.qt-daily-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* 스마트 예배: 원래 영상 칸이 비었을 때 안내 (실제 재생은 sermon-media-panel) */
#sermon-video-slot.sermon-slot-pip-active { background: #1e293b; display: flex; align-items: center; justify-content: center; }
#sermon-video-slot.sermon-slot-pip-active::after { content: '플로팅 패널에서 재생 중'; color: #94a3b8; font-size: 0.875rem; }

/* PiP 패널 공통: /qt·설교·라이브 (pip-panel-core.js) */
.pip-panel-fixed {
  position: fixed !important;
  /* 헤더(z-9998), 알림 드롭다운(z-11000)보다 위에 유지 */
  z-index: 12050 !important;
}

.pip-panel-fixed.pip-panel--pip-center {
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  margin: auto !important;
  transform: none !important;
}

/* PiP 우하단 리사이즈: 터치 시 페이지 스크롤·제스처 우선 방지, 최소 터치 타깃(약 44px) */
.pip-panel-resize-handle {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  min-width: 44px;
  min-height: 44px;
  box-sizing: border-box;
}

/* 확대·축소: 알약형 슬라이더 (− / range / +) */
.zoom-slider-container {
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 50px;
  padding: 8px 12px;
  gap: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  user-select: none;
}

.zoom-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.1s;
}
.zoom-btn:hover { opacity: 0.85; }
.zoom-btn:active { transform: scale(0.9); }
.zoom-slider-container input[type="range"] {
  -webkit-appearance: none;
  width: 72px;
  background: transparent;
}
.zoom-slider-container input[type="range"]:focus { outline: none; }
.zoom-slider-container input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}
.zoom-slider-container input[type="range"]::-webkit-slider-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s;
}
.zoom-slider-container input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.08); }
.zoom-slider-container input[type="range"]::-moz-range-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}
.zoom-slider-container input[type="range"]::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 모바일: 슬라이더·버튼 크기 확대 (터치 친화) */
#mobileMenu .zoom-slider-container {
  padding: 12px 20px;
  gap: 16px;
  isolation: isolate;
  transform: translateZ(0);
  backface-visibility: hidden;
}
#mobileMenu .zoom-slider-container.zoom-slider-mobile input[type="range"] { width: 100%; min-width: 140px; }
#mobileMenu .zoom-btn { font-size: 26px; width: 32px; height: 32px; }
#mobileMenu .zoom-slider-container input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; }
#mobileMenu .zoom-slider-container input[type="range"]::-webkit-slider-thumb { height: 28px; width: 28px; margin-top: -9px; }
#mobileMenu .zoom-slider-container input[type="range"]::-moz-range-track { height: 10px; border-radius: 5px; }
#mobileMenu .zoom-slider-container input[type="range"]::-moz-range-thumb { height: 28px; width: 28px; }
#mobileMenu .mobile-zoom-wrap {
  isolation: isolate;
  transform: translateZ(0);
  background: rgba(255, 255, 255, 0.14);
  backface-visibility: hidden;
  min-width: 0;
}
/* 확대 시 슬라이더가 메뉴 밖으로 나가지 않도록 */
#mobileMenu .mobile-zoom-wrap .zoom-slider-container input[type="range"] {
  min-width: 0;
  max-width: 100%;
}

/* 모바일 메뉴: 뷰포트 기준 fixed + 최상위 레이어 (본문·퀵 링크 위에 항상 표시) */
#mobileMenu {
  position: fixed !important;
  top: 4rem;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 9998 !important;
}
/* 모바일 메뉴: 아코디언(열림/닫힘) */
.mobile-menu-trigger { background: none; border: none; cursor: pointer; font: inherit; }
.mobile-menu-trigger[aria-expanded="true"] .mobile-menu-chevron { transform: rotate(180deg); }
.mobile-menu-sub.hidden { display: none !important; }
.mobile-menu-sub:not(.hidden) { display: flex; }

/* GNB 사진나눔터 하부 메뉴 드롭다운 */
/* GNB 서브메뉴: 호버 시 형제 메뉴보다 위에 올려 클릭 가능 */
.gnb-item-with-dropdown { position: relative; z-index: 1; }
.gnb-item-with-dropdown:hover,
.gnb-item-with-dropdown:focus-within { z-index: 10002; }
.gnb-dropdown {
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}
.gnb-item-with-dropdown:hover .gnb-dropdown,
.gnb-item-with-dropdown:focus-within .gnb-dropdown {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
}

/* 헤더 로고: 원본 컬러 유지 (파란·초록 패널 + 흰색 십자가) */

/* 푸시 알림 종: 미확인 시 딸랑딸랑 */
.notification-badge { line-height: 1.25rem; }
#notificationBellWrap.bell-has-unread #notificationBellIcon {
  animation: bellShake 0.5s ease-in-out infinite;
}
@keyframes bellShake {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-12deg); }
  20%, 40% { transform: rotate(12deg); }
  50% { transform: rotate(-8deg); }
  60% { transform: rotate(8deg); }
  70%, 90% { transform: rotate(-4deg); }
  80% { transform: rotate(4deg); }
}
/* 알림 창: 모바일에서 뷰포트 넘지 않도록 max-width, 내용 줄바꿈 */
.notification-dropdown { opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity 0.2s, visibility 0.2s, transform 0.2s; min-width: 0; overflow-wrap: break-word; pointer-events: none; }
.notification-dropdown.open { display: block !important; opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
.notification-dropdown .notification-item { display: block; padding: 0.75rem 1rem; text-align: left; color: #334155; font-size: 0.875rem; transition: background 0.15s; min-width: 0; word-break: break-word; overflow-wrap: break-word; }
.notification-dropdown .notification-item:hover { background: #f1f5f9; }
.notification-dropdown .notification-item .notification-title { font-weight: 600; color: #0f172a; display: block; word-break: break-word; }
.notification-dropdown .notification-item .notification-time { font-size: 0.75rem; color: #94a3b8; margin-top: 0.25rem; display: block; }
.notification-dropdown #notificationPermissionPrompt p,
.notification-dropdown #notificationPermissionDenied p { word-break: break-word; overflow-wrap: break-word; }

/* 로그인 팝업 */
#loginPopup { transition: opacity 0.2s ease; }
#loginPopup .login-popup-box { animation: loginPopupIn 0.2s ease; }
@keyframes loginPopupIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* 채팅형 말풍선 공통 (설교 댓글 + 중보기도 함께 기도한 분) */
.chat-bubble-area {
  background-color: rgba(227, 242, 253, 0.5);
  border-radius: 0.75rem;
  padding: 1rem;
  min-height: 80px;
}
.chat-bubble-label { font-size: 0.875rem; font-weight: 500; color: #0D47A1; margin-bottom: 0.75rem; }
.chat-bubble-row { display: flex; flex-direction: column; gap: 0.5rem; max-height: 50vh; overflow-y: auto; list-style: none; padding: 0; margin: 0; }
.chat-bubble-item { display: flex; }
.chat-bubble-item--right { justify-content: flex-end; }
.chat-bubble-item--left { justify-content: flex-start; }
.chat-bubble {
  max-width: 85%;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  background-color: #f1f5f9;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border: 1px solid rgba(226, 232, 240, 0.9);
  position: relative;
}
.chat-bubble--right::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  margin-top: -5px;
  border: 5px solid transparent;
  border-left-color: #f1f5f9;
  border-width: 5px 0 5px 6px;
}
.chat-bubble--left::after {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  margin-top: -5px;
  border: 5px solid transparent;
  border-right-color: #f1f5f9;
  border-width: 5px 6px 5px 0;
}
.chat-bubble-meta { font-size: 0.875rem; color: #475569; margin-bottom: 0.25rem; }
.chat-bubble-meta strong { color: #1e293b; }
.chat-bubble-body { font-size: 0.875rem; color: #334155; white-space: pre-wrap; word-break: break-word; margin: 0; }

/* 설교 댓글 전용 래퍼 */
#sermon-comment-chat { min-height: 120px; }
#sermon-comment-chat .sermon-chat-row { display: flex; flex-direction: column; gap: 0.5rem; max-height: 50vh; overflow-y: auto; }
#sermon-comment-chat .sermon-chat-item--right { display: flex; justify-content: flex-end; }
#sermon-comment-chat .sermon-chat-item--left { display: flex; justify-content: flex-start; }
#sermon-comment-chat .sermon-chat-bubble { max-width: 85%; border-radius: 1rem; padding: 0.75rem 1rem; background-color: #f1f5f9; box-shadow: 0 1px 2px rgba(0,0,0,0.05); border: 1px solid rgba(226, 232, 240, 0.9); position: relative; }
#sermon-comment-chat .sermon-chat-bubble--right::after { content: ''; position: absolute; right: -6px; top: 50%; margin-top: -5px; border: 5px solid transparent; border-left-color: #f1f5f9; border-width: 5px 0 5px 6px; }
#sermon-comment-chat .sermon-chat-bubble--left::after { content: ''; position: absolute; left: -6px; top: 50%; margin-top: -5px; border: 5px solid transparent; border-right-color: #f1f5f9; border-width: 5px 6px 5px 0; }
#sermon-comment-chat .sermon-chat-label { font-size: 0.875rem; font-weight: 500; color: #0D47A1; margin-bottom: 0.75rem; }
#sermon-comment-chat .sermon-chat-bubble .sermon-chat-meta { font-size: 0.875rem; color: #475569; margin-bottom: 0.25rem; }
#sermon-comment-chat .sermon-chat-bubble .sermon-chat-meta strong { color: #1e293b; }
#sermon-comment-chat .sermon-chat-bubble .sermon-chat-body { font-size: 0.875rem; color: #334155; white-space: pre-wrap; word-break: break-word; }

/* 설교 댓글 (채팅형) 삭제 버튼 (본인 댓글만 표시) */
#sermon-comment-chat .sermon-comment-bubble {
  position: relative;
}
.sermon-comment-delete {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: rgba(0,0,0,0.08);
  color: #475569;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.sermon-comment-delete:hover {
  background: rgba(185, 28, 28, 0.2);
  color: #b91c1c;
}

/* 설교 댓글 포스트잇 보드 - 반응형 (퍼센트 그리드) */
.postit-board-wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}
.postit-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 420;
  min-height: 280px;
  max-height: 420px;
  background-color: #fff;
  border: 2px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  overflow: hidden;
  background-image: radial-gradient(#e5e5e5 1px, transparent 1px);
  background-size: 30px 30px;
}
/* 5열 그리드 (가로·세로 2배), 퍼센트로 보드 크기에 맞춤 */
.postit-note {
  position: absolute;
  left: calc(var(--col, 0) * 20% + 0.4%);
  top: calc(var(--row, 0) * 30% + 0.5%);
  width: 18%;
  height: 30%;
  min-width: 140px;
  min-height: 144px;
  padding: 10px;
  box-sizing: border-box;
  cursor: grab;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 14px;
  box-shadow: 3px 3px 7px rgba(0,0,0,0.15);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  border-bottom-right-radius: 18px 4px;
}
.postit-note:active {
  cursor: grabbing;
  box-shadow: 8px 8px 20px rgba(0,0,0,0.2);
  transform: scale(1.05) rotate(0deg) !important;
  z-index: 1000 !important;
}
.postit-note .postit-name {
  font-weight: bold;
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding-bottom: 3px;
}
.postit-note .postit-body {
  margin: 0;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
  font-weight: 500;
  overflow: hidden;
  line-height: 1.35;
  font-size: 13px;
  padding: 2px 0;
}
.postit-note .postit-meta {
  font-size: 11px;
  color: rgba(0,0,0,0.5);
  margin: 0;
}
.postit-note .sermon-comment-delete,
.postit-note .postit-comment-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 1rem;
  z-index: 2;
}
.postit-board-info {
  margin-top: 10px;
  font-size: 13px;
  color: #666;
}

/* 태블릿 */
@media (max-width: 1024px) {
  .postit-board {
    max-height: 380px;
    min-height: 260px;
  }
  .postit-note {
    min-width: 120px;
    min-height: 128px;
    padding: 8px;
    font-size: 13px;
  }
  .postit-note .postit-name { font-size: 12px; }
  .postit-note .postit-body { font-size: 12px; }
  .postit-note .postit-meta { font-size: 10px; }
}

/* 모바일 가로 ~ 세로 전환 */
@media (max-width: 768px) {
  .postit-board-wrap {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    width: calc(100% + 1rem);
    max-width: none;
  }
  .postit-board {
    border-radius: 6px;
    max-height: 340px;
    min-height: 240px;
  }
  .postit-note {
    min-width: 100px;
    min-height: 116px;
    padding: 6px;
    font-size: 12px;
  }
  .postit-note .postit-name { font-size: 11px; }
  .postit-note .postit-body { font-size: 11px; line-height: 1.3; }
  .postit-note .postit-meta { font-size: 9px; }
  .postit-note .sermon-comment-delete,
  .postit-note .postit-comment-delete {
    min-width: 32px;
    min-height: 32px;
    top: 4px;
    right: 4px;
  }
  .postit-board-info { font-size: 12px; }
}

/* 모바일 세로 (작은 화면) */
@media (max-width: 480px) {
  .postit-board {
    max-height: 300px;
    min-height: 200px;
  }
  .postit-note {
    min-width: 88px;
    min-height: 100px;
    padding: 5px;
    font-size: 11px;
  }
  .postit-note .postit-name { font-size: 10px; }
  .postit-note .postit-body { font-size: 10px; }
  .postit-note .postit-meta { font-size: 9px; }
}
