/* ═══════════════════════════════════════════════════
   notice.css — お知らせ機能スタイル
═══════════════════════════════════════════════════ */

.notice-list-wrapper,
.notice-manage-wrapper,
.notice-edit-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
  width: 100%;
  height: 100%;      /* モーダルが画面からはみ出さないよう上限を設定 */
  overflow-y: auto;      /* 内容が多い場合はここでスクロール */
  padding-right: 4px;    /* スクロールバーが文字に被らないよう余白を確保 */
}

.notice-manage-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.notice-list-wrapper .popup-title,
.notice-manage-wrapper .popup-title,
.notice-edit-wrapper .popup-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

/* ---------- リスト/詳細ビュー ---------- */

#noticeManageListView,
#noticeManageDetailView,
#noticeListView,
#noticeDetailView {
  display: flex;
  flex-direction: column;
}

/* ---------- テーブル共通 ---------- */

.notice-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.notice-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .02em;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.notice-table tbody tr {
  transition: background-color .12s ease;
}

.notice-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid #f1f5f9;
}

.notice-table tbody td {
  padding: 12px 14px;
  color: #334155;
  vertical-align: middle;
}

.notice-row:hover,
.notice-manage-row:hover {
  background-color: #f8fafc;
  cursor: pointer;
}

.notice-empty-cell {
  text-align: center;
  color: #94a3b8;
  padding: 32px 0 !important;
  font-size: 13px;
}

/* 未読バッジ */
.notice-new-badge {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ---------- ページネーション ---------- */

.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.notice-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  transition: all .12s ease;
}

.notice-page-btn:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #f8fafc;
}

.notice-page-btn:disabled {
  opacity: .35;
  cursor: default;
}

.notice-page-btn.btn-primary {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

.notice-page-count {
  font-size: 12px;
  color: #94a3b8;
  margin-left: 8px;
}

/* ---------- 戻るボタン（幅いっぱいにならないよう調整） ---------- */

#noticeBackToListBtn,
#noticeManageBackToListBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  align-self: flex-start;
  padding: 7px 16px;
  margin-bottom: 4px;
}

/* ---------- 詳細ビュー（一般/管理共通） ---------- */

.notice-detail-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 22px;
  margin-top: 12px;
}

.notice-detail-head {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

#noticeDetailTitle,
#noticeManageDetailTitle {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px;
}

.notice-detail-meta,
.muted {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 14px;
}

.notice-detail-body {
  white-space: pre-wrap;
  line-height: 1.7;
  color: #374151;
  font-size: 14px;
  border-top: 1px dashed #e5e7eb;
  padding-top: 14px;
}

/* ---------- ステータスバッジ ---------- */

.notice-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  line-height: 1.5;
}

.notice-status-draft {
  background: #f1f5f9;
  color: #64748b;
}

.notice-status-scheduled {
  background: #fef3c7;
  color: #b45309;
}

.notice-status-published {
  background: #dcfce7;
  color: #15803d;
}

/* ---------- 重要度バッジ ---------- */

.notice-importance-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.notice-importance-normal {
  background: #e0e7ff;
  color: #4338ca;
}

.notice-importance-important {
  background: #fef3c7;
  color: #b45309;
}

.notice-importance-urgent {
  background: #fee2e2;
  color: #dc2626;
}

/* ---------- 管理者ツールバー ---------- */

.notice-manage-toolbar {
  display: flex;
  justify-content: flex-end;
}

.notice-manage-title-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-manage-actions-cell {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.notice-manage-actions-cell .btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.col-status { width: 100px; }
.col-date { width: 170px; }
.col-actions { width: 150px; }

/* ---------- 編集フォーム ---------- */

.notice-edit-wrapper .modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.notice-edit-wrapper label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.notice-edit-wrapper input[type="text"],
.notice-edit-wrapper input[type="date"],
.notice-edit-wrapper input[type="time"],
.notice-edit-wrapper select,
.notice-edit-wrapper textarea {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  color: #1f2937;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
  font-family: inherit;
}

.notice-edit-wrapper input:focus,
.notice-edit-wrapper select:focus,
.notice-edit-wrapper textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.notice-edit-wrapper textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.6;
}

.notice-edit-wrapper .input-error {
  font-size: 12px;
  color: #dc2626;
}

/* ---------- 発行方法トグル（セグメントピル） ---------- */

.notice-publish-mode {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.notice-publish-mode .publish-mode-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.notice-publish-mode .publish-mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.notice-publish-mode .publish-mode-option:hover {
  color: #334155;
}

/* :has() 対応ブラウザ（Chrome/Edge/Safari/Firefox 最新版）はこれだけで動く */
.notice-publish-mode .publish-mode-option:has(input:checked) {
  background: #fff;
  color: #4338ca;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

/* :has() 非対応ブラウザ向けフォールバック（JSでis-checkedを付与） */
.notice-publish-mode .publish-mode-option.is-checked {
  background: #fff;
  color: #4338ca;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

.notice-schedule-fields {
  display: flex;
  gap: 10px;
  align-items: center;
}

.notice-schedule-fields input {
  flex: 1;
}

/* ---------- ボタン共通（既存 .btn を上書きしすぎない範囲で調整） ---------- */

.notice-edit-wrapper .popup-actions,
.notice-manage-wrapper .popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}

/* ---------- ベル通知アイコン（サイドバー） ---------- */

.notice-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--slack-sidebar-text, #475569);
  cursor: pointer;
  border-radius: 10px;
  transition: background-color .15s ease;
}

.notice-bell-btn:hover {
  background-color: rgba(0, 0, 0, .06);
}

.notice-bell-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444;
  border: 1.5px solid var(--slack-sidebar-bg, #fff);
}

/* ---------- レスポンシブ ---------- */

@media (max-width: 640px) {
  .notice-list-wrapper,
  .notice-manage-wrapper,
  .notice-edit-wrapper {
    min-width: 0;
    width: 100%;
  }

  .notice-table thead {
    display: none;
  }

  .notice-table,
  .notice-table tbody,
  .notice-table tr,
  .notice-table td {
    display: block;
    width: 100%;
  }

  .notice-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 0;
  }

  .notice-manage-actions-cell {
    justify-content: flex-end;
    padding-top: 6px;
  }
}

/* ---------- サイドバー下部：アバター行 + ベル（横並び固定） ---------- */

.sidebar-footer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;          /* flex子要素の縮小を許可（これがないと折り返す） */
}

.sidebar-footer-row .sidebar-user-btn {
  flex: 1 1 auto;
  min-width: 0;           /* 同上：中の文字を省略できるようにする */
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.sidebar-footer-row .sidebar-user-info {
  min-width: 0;           /* これがないと子要素が縮まず全体が広がる */
  flex: 1 1 auto;
  overflow: hidden;
}

.sidebar-footer-row .sidebar-user-name,
.sidebar-footer-row .sidebar-user-email {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sidebar-footer-row .notice-bell-btn {
  flex: 0 0 auto;         /* ベルは常に固定サイズ、縮まない */
}