/* ==========================================
   NOTICEBOARD DRAWER STYLES
   Follows forum.js UI patterns for consistency
   ========================================== */

:root {
  --bg: #f1efef;
  --text: #111111;
  --muted: #666;
  --soft: #f7f7f7;
  --line: #ececec;
  --blue: #0a84ff;
  --green: #10b981;
  --red: #ff3b30;
  --amber: #ff9f0a;
  --card: #fff;
  --shadow: 0 6px 18px rgba(0,0,0,.06);
}

/* ===== DRAWER CONTAINER ===== */
#noticeboardDrawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

#noticeboardDrawer.open {
  transform: translateX(0);
}

/* ===== DRAWER HEADER ===== */
.noticeboard-drawer-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.noticeboard-header-content {
  flex: 1;
}

.noticeboard-group-name {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: -0.3px;
}

.noticeboard-member-count {
  font-size: 13px;
  color: var(--muted);
}

.noticeboard-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 12px;
}

.noticeboard-close-btn:hover {
  background: var(--soft);
}

.noticeboard-close-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text);
}

/* ===== DRAWER BODY ===== */
.noticeboard-drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== CREATE POST SECTION ===== */
.noticeboard-create-section {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.noticeboard-create-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
}

.noticeboard-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 12px;
}

.noticeboard-textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.noticeboard-image-preview {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 12px;
  display: none;
}

.noticeboard-create-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.noticeboard-upload-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.noticeboard-upload-btn:hover {
  background: var(--soft);
}

.noticeboard-upload-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text);
}

.noticeboard-clear-image {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  display: none;
}

.noticeboard-clear-image:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.noticeboard-create-btn {
  margin-left: auto;
  padding: 8px 16px;
  border-radius: 10px;
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.noticeboard-create-btn:hover {
  opacity: 0.9;
}

.noticeboard-create-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== POSTS FEED ===== */
.noticeboard-posts-feed {
  padding: 16px;
}

.post {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.post .meta {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 8px;
}

.post .body {
  font-size: 14px;
  line-height: 1.5;
  margin: 8px 0;
}

.post .actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.left-actions,
.right-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.icon-pill:hover {
  background: var(--soft);
}

.icon-pill svg {
  width: 14px;
  height: 14px;
}

.vote-container {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}

.vote-container .vote-up,
.vote-container .vote-down {
  border: none;
  border-radius: 0;
  padding: 6px 10px;
}

.vote-container .vote-up {
  border-right: 1px solid var(--line);
}

.vote-container .vote-down {
  border-left: 1px solid var(--line);
}

.vote-container .vote-up.voted {
  background: var(--green);
  color: #fff;
}

.vote-container .vote-down.voted {
  background: var(--red);
  color: #fff;
}

.vote-container .score {
  padding: 0 10px;
  font-size: 12px;
  color: var(--muted);
  min-width: 22px;
  text-align: center;
}

/* ===== EMPTY STATES ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.loading,
.error {
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
  color: var(--muted);
}

.error {
  color: var(--red);
}

/* ===== THREAD MODAL ===== */
#noticeboardThreadModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 3000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.noticeboard-thread-content {
  background: var(--bg);
  max-width: 600px;
  margin: 40px auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.noticeboard-thread-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.noticeboard-thread-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.noticeboard-thread-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.noticeboard-thread-close:hover {
  background: var(--line);
}

.noticeboard-thread-close svg {
  width: 16px;
  height: 16px;
}

.noticeboard-thread-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.thread-post {
  background: var(--card);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

.comments-divider {
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

.comments-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment {
  background: var(--card);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.comment-body {
  font-size: 13px;
  line-height: 1.5;
  padding-left: 26px;
}

.comment-actions {
  padding-left: 26px;
  margin-top: 8px;
}

.delete-comment-btn {
  font-size: 11px;
  color: var(--red);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}

.delete-comment-btn:hover {
  text-decoration: underline;
}

.empty-comments {
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
  color: var(--muted);
}

.noticeboard-thread-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 16px;
}

.noticeboard-comment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.noticeboard-comment-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.noticeboard-comment-textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.noticeboard-submit-comment {
  align-self: flex-end;
  padding: 8px 16px;
  border-radius: 10px;
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.noticeboard-submit-comment:hover {
  opacity: 0.9;
}

.noticeboard-submit-comment:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
  #noticeboardDrawer {
    max-width: 100%;
  }

  .noticeboard-thread-content {
    margin: 20px;
    max-width: calc(100% - 40px);
  }
}
