/* css/announcement.css */

/* ==========================================
 * 1. 共通コンテナ・ヘッダー
 * ========================================== */
.announcement-container {
  /*max-width: 800px;
  margin: 0 auto;
  padding: 1rem;*/
}

/* ==========================================
 * 2. ホーム画面（未読掲示リスト）用スタイル
 * ========================================== */
.unread-row {
  padding: 0.65rem 0;
  border-bottom: 1px solid #fef3c7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 0.5rem;
  transition: background-color 0.15s ease;
  min-width: 0; /* カード枠の横拡張を防止 */
}

.unread-row:hover {
  background-color: rgba(253, 230, 138, 0.25);
}

/* [NEW]バッジとタイトル文字列を包むコンテナ */
.unread-row-title {
  display: flex; /* 横並びレイアウトにする */
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  min-width: 0; /* これがないと「...」が効かずに横に伸びる */
  overflow: hidden;
}

/* [NEW] バッジ：幅を絶対に潰さない */
.badge-new-text {
  color: #d97706;
  font-weight: bold;
  font-size: 0.85rem;
  flex-shrink: 0; /* 幅固定 */
  white-space: nowrap;
}

/* タイトル本文：枠を超えたら「...」にする */
.unread-title-text {
  font-size: 0.9rem;
  font-weight: bold;
  color: #78350f;
  overflow: hidden;
  text-overflow: ellipsis; /* 三点リーダー表示 */
  white-space: nowrap;    /* 改行禁止 */
  flex: 1;
  min-width: 0;
}

/* 日付：幅を絶対に潰さない */
.unread-row-date {
  font-size: 0.8rem;
  color: #b45309;
  white-space: nowrap;
  flex-shrink: 0; /* 幅固定 */
}

.unread-card-footer {
  text-align: right;
  margin-top: 0.5rem;
  padding-top: 0.25rem;
}

/* ==========================================
 * 3. 掲示一覧画面（announcement-view）リスト表示
 * ========================================== */
.announcement-list-section {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.announcement-list {
  display: flex;
  flex-direction: column;
}

.announcement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background-color: #ffffff;
  transition: background-color 0.15s ease;
}

.announcement-row:last-child {
  border-bottom: none;
}

.announcement-row:hover {
  background-color: #f8fafc;
}

.announcement-row.unread {
  background-color: #f0f7ff;
  border-left: 4px solid #2563eb;
}

.row-main {
  flex: 1;
  overflow: hidden;
  margin-right: 0.75rem;
  cursor: pointer;
}

.row-title-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.badge-unread {
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.row-title {
  font-size: 0.95rem;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.row-action {
  flex-shrink: 0;
  gap: 0.4rem;
}

.icon-attachment {
  flex-shrink: 0;   /* タイトルが長くても記号は潰さない */
  font-size: 0.9rem;
}

.btn-quick-read {
  background-color: #e2e8f0;
  color: #475569;
  border: none;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s;
}

.btn-quick-read:hover {
  background-color: #cbd5e1;
  color: #1e293b;
}

.text-read-done {
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 0.35rem 0.5rem;
}

/* ==========================================
 * 4. 掲示板専用モーダルパーツ（カレンダーとデザイン統一）
 * ========================================== */
.announcement-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #334155;
  white-space: pre-wrap;
  margin-bottom: 1rem;
}

.announcement-meta {
  font-size: 0.8rem;
  color: #64748b;
  background-color: #f8fafc;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

/* フォーム共通設定（calendar-modal と同じクラスを活用） */
.announcement-form .form-group {
  margin-bottom: 1rem;
}

/* お知らせ詳細：本文だけスクロール */
.modal-content:has(.announcement-body-scroll) {
  display: flex;
  flex-direction: column;
  overflow: hidden;          /* モーダル全体はスクロールさせない */
}

.modal-content:has(.announcement-body-scroll) > * {
  flex-shrink: 0;            /* 題名・添付・投稿者情報は縮めない */
}

.modal-content:has(.announcement-body-scroll) > .announcement-body-scroll {
  flex: 1 1 auto;
  min-height: 3em;
  overflow-y: auto;          /* 本文だけスクロール */
}

.announcement-body-scroll .announcement-body {
  margin-bottom: 0;
}

.announcement-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: bold;
  color: #475569;
  margin-bottom: 0.35rem;
}

.announcement-form .form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.announcement-form .form-control:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (max-width: 640px) {
  .announcement-container {
    /*padding: 0.5rem;*/
  }

  .announcement-row {
    padding: 0.65rem 0.75rem;
  }

  .row-title {
    font-size: 0.9rem;
  }
}

.btn-quick-unread {
  background-color: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-quick-unread:hover {
  background-color: #e2e8f0;
  color: #1e293b;
}

/* お知らせ先バッジ（セクション／パート宛て） */
.badge-audience {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;       /* タイトルが長くても潰さない */
  white-space: nowrap;
}
.badge-audience-section {
  background-color: #dbeafe;
  color: #1e40af;
}
.badge-audience-instrument {
  background-color: #dcfce7;
  color: #166534;
}

.badge-audience-position {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-audience-member {
  background-color: #fce7f3;
  color: #9d174d;
}

/* 添付ファイル欄 */
.attachment-existing-row {
  align-items: center;
  gap: 8px;
  margin-bottom: 0.4rem;
}
.attachment-existing-name {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: #475569;
  overflow-wrap: anywhere;
}
.btn-remove-attachment {
  flex-shrink: 0;
  white-space: nowrap;
  color: #dc2626;
}
.attachment-file-error {
  display: none;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: #dc2626;
}