/* studygroup.css — 스터디 모집 게시판 */
.sg-root { max-width: 760px; margin: 0 auto; padding: 4px 0 60px; }

/* 검색 */
.sg-search { margin-bottom: 12px; }
.sg-search__input { width: 100%; }

/* 툴바 */
.sg-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sg-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.sg-filter { padding: 8px 10px; border: 1px solid #dde2e8; border-radius: 9px; font-size: 13px; background: #fff; color: #1d1d1f; cursor: pointer; }

/* 버튼 */
.sg-btn { border: 0; border-radius: 9px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; background: #eef1f5; color: #1d2f4e; }
.sg-btn--primary { background: #1D2F4E; color: #fff; }
.sg-btn--ghost { background: transparent; color: #86868b; }
.sg-btn--sm { padding: 7px 12px; font-size: 13px; }
.sg-btn:disabled { opacity: .6; cursor: default; }
.sg-back { margin-bottom: 12px; padding-left: 0; }

/* 목록 */
.sg-list { display: flex; flex-direction: column; gap: 10px; }
.sg-card { border: 1px solid #ececf0; border-radius: 14px; padding: 15px 16px; background: #fff; cursor: pointer; transition: box-shadow .15s, transform .05s; }
.sg-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.sg-card:active { transform: scale(.997); }
.sg-card.is-closed { opacity: .62; }
.sg-card__tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.sg-card__title { font-size: 16px; font-weight: 700; color: #1d1d1f; line-height: 1.35; }
.sg-card__meta { margin-top: 7px; font-size: 12.5px; color: #8a94a3; }

/* 태그/상태 */
.sg-tag { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 7px; background: #f1f4f8; color: #5a6678; }
.sg-tag--region { background: #e7f0fb; color: #1d4e89; }
.sg-tag--mode { background: #eafaf3; color: #0a7c52; }
.sg-status { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 7px; }
.sg-status--open { background: #e6f7ee; color: #0a9e72; }
.sg-status--closed { background: #f0f0f2; color: #98989d; }
.sg-dday { font-size: 11.5px; font-weight: 700; color: #d9480f; }

/* 상세 */
.sg-detail { border: 1px solid #ececf0; border-radius: 16px; padding: 20px 18px; background: #fff; }
.sg-detail__title { font-size: 21px; font-weight: 800; color: #1d1d1f; margin: 12px 0 6px; line-height: 1.3; }
.sg-detail__meta { font-size: 13px; color: #8a94a3; margin-bottom: 14px; }
.sg-detail__body { font-size: 15px; color: #2c2c2e; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.sg-redact-note { font-size: 12.5px; color: #8a6d00; background: #fff7e0; border: 1px solid #f3e2a8; border-radius: 9px; padding: 9px 12px; margin: 0 0 12px; line-height: 1.5; }
.sg-detail__actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid #f0f0f2; }

/* 댓글 */
.sg-comments { margin-top: 22px; }
.sg-comments__title { font-size: 15px; font-weight: 700; color: #1d2f4e; margin-bottom: 12px; }
.sg-comment { padding: 11px 0; border-bottom: 1px solid #f2f2f4; position: relative; }
.sg-comment__head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.sg-comment__nick { font-size: 13.5px; font-weight: 700; color: #1d2f4e; }
.sg-comment__date { font-size: 11.5px; color: #aab2bd; }
.sg-comment__text { font-size: 14px; color: #2c2c2e; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.sg-comment__del { position: absolute; top: 11px; right: 0; background: none; border: 0; color: #c0c6cf; font-size: 12px; cursor: pointer; }
.sg-comment-form { display: flex; gap: 8px; margin-top: 14px; }
.sg-comment-form .sg-input { flex: 1; }

/* 입력/폼 */
.sg-input { width: 100%; padding: 11px 13px; border: 1px solid #dde2e8; border-radius: 10px; font-size: 14px; font-family: inherit; color: #1d1d1f; box-sizing: border-box; }
.sg-input--sm { width: auto; padding: 8px 10px; }
.sg-textarea { width: 100%; padding: 12px 13px; border: 1px solid #dde2e8; border-radius: 10px; font-size: 14px; font-family: inherit; line-height: 1.7; resize: vertical; box-sizing: border-box; color: #1d1d1f; }
.sg-form-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }

/* 선택 옵션 행 (마감일·인원) */
.sg-optrow { gap: 10px; }
.sg-opt { gap: 6px; cursor: pointer; user-select: none; }
.sg-check { width: 16px; height: 16px; accent-color: #1D2F4E; cursor: pointer; margin: 0; }
.sg-date { width: 158px; min-width: 158px; color: #1d1d1f; }
.sg-date::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.sg-input:disabled { background: #f4f5f7; color: #b0b6bf; cursor: not-allowed; }
.sg-mini { font-size: 12.5px; color: #6e6e73; display: flex; align-items: center; gap: 6px; }
.sg-notice { font-size: 12px; color: #94a0ae; line-height: 1.6; background: #f7f8fa; border-radius: 9px; padding: 10px 12px; margin: 4px 0 0; }
.sg-msg { font-size: 12.5px; color: #d92a2a; min-height: 16px; margin: 6px 0; }
.sg-empty { text-align: center; color: #9aa3ae; padding: 40px 16px; font-size: 14px; }
.sg-empty--sm { padding: 18px; }

/* 모달 */
.sg-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 18px; }
.sg-modal { background: #fff; border-radius: 18px; padding: 22px 20px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.sg-modal--wide { max-width: 540px; max-height: 88vh; overflow-y: auto; }
.sg-modal__title { font-size: 18px; font-weight: 800; color: #1d2f4e; margin-bottom: 8px; }
.sg-modal__desc { font-size: 13px; color: #6e6e73; line-height: 1.6; margin-bottom: 14px; }
.sg-modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.sg-modal .sg-input, .sg-modal .sg-textarea { margin-bottom: 4px; }

@media (max-width: 520px) {
  .sg-toolbar { flex-direction: column; align-items: stretch; }
  .sg-toolbar .sg-btn--primary { width: 100%; }
  .sg-filters { justify-content: space-between; }
  .sg-filter { flex: 1; min-width: 0; }
}

/* ───── 1:1 쪽지 패널 (Phase 2) ───── */
.sg-chat-fab {
  position: fixed; left: 20px; bottom: 20px; z-index: 1001;
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: #1D2F4E; color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(29,47,78,.35);
}
.sg-chat-fab__badge {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px;
  background: #ff3b30; color: #fff; border-radius: 9px; border: 2px solid #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.sg-chat-panel {
  position: fixed; left: 20px; bottom: 84px; z-index: 1003;
  width: 360px; max-width: calc(100vw - 40px); height: 520px; max-height: calc(100vh - 130px);
  background: #fff; border-radius: 18px; box-shadow: 0 16px 50px rgba(0,0,0,.25);
  display: flex; flex-direction: column; overflow: hidden;
}
.sg-chat-head { display: flex; align-items: center; gap: 8px; padding: 13px 14px; border-bottom: 1px solid #eef1f5; }
.sg-chat-head__title { font-size: 15px; font-weight: 700; color: #1d2f4e; flex: 1; }
.sg-chat-head__menu { display: flex; align-items: center; gap: 4px; }
.sg-chat-x, .sg-chat-back, .sg-chat-report, .sg-chat-block { background: none; border: 0; cursor: pointer; font-size: 16px; color: #86868b; padding: 4px 6px; line-height: 1; }
.sg-chat-x { font-size: 22px; }
.sg-chat-back { font-size: 19px; color: #1d2f4e; }

.sg-chat-tabs { display: flex; border-bottom: 1px solid #eef1f5; }
.sg-chat-tab { flex: 1; padding: 10px; background: none; border: 0; border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 600; color: #98989d; cursor: pointer; font-family: inherit; }
.sg-chat-tab.is-active { color: #1d2f4e; border-bottom-color: #1D2F4E; }

.sg-chat-list { flex: 1; overflow-y: auto; }
.sg-bubble-wrap { display: flex; flex-direction: column; gap: 2px; }
.sg-bubble-nick { font-size: 11px; color: #8a94a3; margin-left: 2px; }
.sg-chat-item { position: relative; padding: 13px 16px; border-bottom: 1px solid #f4f5f7; cursor: pointer; }
.sg-chat-item:hover { background: #fafbfc; }
.sg-chat-item__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.sg-chat-item__nick { font-size: 14px; font-weight: 700; color: #1d2f4e; }
.sg-chat-item__time { font-size: 11px; color: #aab2bd; }
.sg-chat-item__last { font-size: 13px; color: #6e6e73; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-chat-item.is-unread .sg-chat-item__last { color: #1d1d1f; font-weight: 600; }
.sg-chat-item__dot { position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; background: #ff3b30; border-radius: 50%; transform: translateY(-50%); }

.sg-chat-msgs { flex: 1; overflow-y: auto; padding: 14px; background: #f6f8fa; display: flex; flex-direction: column; gap: 7px; }
.sg-msg-row { display: flex; align-items: flex-end; gap: 6px; max-width: 78%; }
.sg-msg-row.is-mine { align-self: flex-end; flex-direction: row-reverse; }
.sg-bubble { padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.5; background: #fff; color: #1d1d1f; box-shadow: 0 1px 2px rgba(0,0,0,.05); word-break: break-word; white-space: pre-wrap; }
.sg-msg-row.is-mine .sg-bubble { background: #1D2F4E; color: #fff; }
.sg-msg-time { font-size: 10px; color: #aab2bd; flex-shrink: 0; }
.sg-chat-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid #eef1f5; }
.sg-chat-input .sg-input { flex: 1; }

@media (max-width: 520px) {
  .sg-chat-panel { left: 10px; right: 10px; width: auto; bottom: 80px; height: calc(100vh - 150px); }
  .sg-chat-fab { left: 14px; bottom: 14px; }
}
