/* ========================================
 * board-notes.css (v1.7.0〜)
 * 全体タスク（付箋ボード）UI
 * ======================================== */

/* ----- ダッシュボード内のセクション ----- */
#board-notes-area {
  margin: 14px 0;
}

/* v1.7.8: 重要ビュー（タブ切替時）に背景を確実に。!important で specificity 負け対策 */
#view-overview {
  background: var(--bg, #0f1117) !important;
}
body[data-theme="light"] #view-overview { background: var(--bg, #f5f1ea) !important; }
#overview-board-notes-area,
#board-notes-area { background: transparent; }

/* v1.7.8: アクションシート（⋮メニュー → 下から出るモーダル） */
#modal-bn-actions {
  align-items: flex-end !important;
  justify-content: center !important;
}
.bn-actionsheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg2, #1a1d27);
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: bn-actionsheet-slide-in 0.18s ease-out;
}
@keyframes bn-actionsheet-slide-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.bn-actionsheet-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  text-align: center;
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border, #333);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bn-actionsheet-btn {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  background: var(--bg3, #222536);
  color: var(--text, #e8eaf6);
  border: 1px solid var(--border, #333);
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}
.bn-actionsheet-btn:active { background: var(--bg4, #2a2e42); }
.bn-actionsheet-btn.bn-actionsheet-danger { color: #ff6b6b; }
.bn-actionsheet-btn.bn-actionsheet-cancel {
  text-align: center;
  margin-top: 4px;
  background: transparent;
  border-color: transparent;
  color: var(--text3);
}

/* ヘッダ */
.bn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.bn-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.bn-header-icon { font-size: 22px; }
.bn-header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text1);
}
.bn-label-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.bn-label-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.bn-label-red    { background: #ffcdd2; color: #b71c1c; border-color: #ef9a9a; }
.bn-label-orange { background: #ffe0b2; color: #e65100; border-color: #ffcc80; }
.bn-label-yellow { background: #fff9c4; color: #827717; border-color: #fff176; }
.bn-label-green  { background: #c8e6c9; color: #1b5e20; border-color: #a5d6a7; }
.bn-label-blue   { background: #bbdefb; color: #0d47a1; border-color: #90caf9; }

/* ----- 付箋グリッド ----- */
.bn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  min-height: 80px;
}

.bn-empty {
  grid-column: 1 / -1;
  padding: 30px 18px;
  background: var(--bg2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text3);
  text-align: center;
  font-size: 13px;
}

/* ----- 付箋カード ----- */
.bn-card {
  position: relative;
  padding: 14px 14px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10), 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: grab;
  transition: transform 0.12s, box-shadow 0.12s;
  color: #1f2937;
  /* v1.7.7: overflow を visible に（⋮メニューが下にはみ出してもクリップされないように） */
  overflow: visible;
}
.bn-card:active { cursor: grabbing; }
.bn-card.is-dragging {
  opacity: 0.45;
  transform: rotate(-1deg);
}
.bn-card:hover {
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16), 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  transform: translateY(-1px);
}
.bn-card.is-overdue {
  border: 2px solid #d32f2f;
}
.bn-card.is-done {
  opacity: 0.78;
}

/* 5色（少しくすんだ付箋色） */
.bn-color-red    { background: linear-gradient(180deg, #ffadad 0%, #ff8c8c 100%); }
.bn-color-orange { background: linear-gradient(180deg, #ffd29a 0%, #ffb774 100%); }
.bn-color-yellow { background: linear-gradient(180deg, #fff5a8 0%, #ffea7a 100%); }
.bn-color-green  { background: linear-gradient(180deg, #b9e7b9 0%, #98d695 100%); }
.bn-color-blue   { background: linear-gradient(180deg, #b6d8ff 0%, #93c2fa 100%); }

/* カード上のラベル（小） */
.bn-card-label {
  position: absolute;
  top: 8px;
  right: 36px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.55);
  color: #2c2c2c;
  letter-spacing: 0.5px;
  white-space: nowrap;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ⋮ メニューボタン */
.bn-menu-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  z-index: 5;
  touch-action: manipulation;
}
.bn-menu-btn:hover,
.bn-menu-btn:active { background: rgba(0, 0, 0, 0.12); }

/* v1.7.6: スマホでさらに押しやすく */
@media (max-width: 768px) {
  .bn-menu-btn { width: 40px; height: 40px; font-size: 22px; top: 2px; right: 2px; }
}

/* ⋮ メニュー */
.bn-menu {
  position: absolute;
  top: 30px;
  right: 6px;
  display: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  z-index: 10;
  min-width: 130px;
  padding: 4px;
}
.bn-menu.open { display: block; }
.bn-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #2c2c2c;
  border-radius: 5px;
}
.bn-menu button:hover { background: #f4f4f4; }
.bn-menu .bn-menu-danger { color: #c62828; }

/* タイトル */
.bn-title {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.3;
  padding-right: 64px; /* メニューと被らないよう */
  margin-bottom: 2px;
  word-break: break-word;
}
.bn-empty-title { color: rgba(0, 0, 0, 0.4); font-weight: 500; }

/* 本文 */
.bn-body {
  font-size: 12.5px;
  color: rgba(0, 0, 0, 0.78);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.bn-carlink {
  color: #1565c0;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.bn-carlink:hover { color: #0d47a1; }

/* 画像 */
.bn-img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* 期限 */
.bn-deadline {
  font-size: 11px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.7);
  background: rgba(255, 255, 255, 0.5);
  padding: 3px 8px;
  border-radius: 4px;
  align-self: flex-start;
}
.bn-deadline.is-overdue {
  background: #d32f2f;
  color: #fff;
}

/* フッター（メンバー＋作成者） */
.bn-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.18);
}
.bn-members {
  display: flex;
  gap: -4px;
  flex-wrap: wrap;
}
.bn-members .bn-av { margin-right: -4px; }
.bn-members .bn-av:last-child { margin-right: 0; }
.bn-no-member {
  font-size: 10px;
  color: rgba(0, 0, 0, 0.45);
  font-style: italic;
}
.bn-author {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: rgba(0, 0, 0, 0.55);
}
.bn-author-name {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* アバター（共通） */
.bn-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #6abf6a, #378ADD);
  color: #fff;
  font-weight: 700;
  border: 1.5px solid #fff;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* 「済」スタンプ */
.bn-done-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  font-size: 90px;
  font-weight: 900;
  color: rgba(211, 47, 47, 0.85);
  border: 6px solid rgba(211, 47, 47, 0.85);
  border-radius: 50%;
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  letter-spacing: -4px;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
  z-index: 5;
  font-family: serif;
}

/* ----- 編集モーダル ----- */
#modal-board-note .modal { max-width: 560px; }
.bn-modal-body {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 70vh;
  overflow-y: auto;
}
.bn-modal-body label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  display: block;
  margin-bottom: 4px;
}
.bn-modal-body input[type="text"],
.bn-modal-body input[type="date"],
.bn-modal-body textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text1);
  font-size: 13px;
  box-sizing: border-box;
  font-family: inherit;
}
.bn-modal-body textarea { resize: vertical; min-height: 80px; }

/* 色選択 */
.bn-color-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.bn-color-picker label {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  border: 2px solid transparent;
  border-radius: 8px;
  transition: 0.12s;
  background: var(--bg2);
  margin-bottom: 0;
}
.bn-color-picker label:hover { background: var(--bg3); }
.bn-color-picker input[type="radio"] { display: none; }
.bn-color-picker input[type="radio"]:checked + .bn-color-swatch {
  outline: 3px solid var(--accent, #378ADD);
  outline-offset: 1px;
}
.bn-color-swatch {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.bn-color-swatch.bn-sw-red    { background: linear-gradient(180deg, #ffadad, #ff8c8c); }
.bn-color-swatch.bn-sw-orange { background: linear-gradient(180deg, #ffd29a, #ffb774); }
.bn-color-swatch.bn-sw-yellow { background: linear-gradient(180deg, #fff5a8, #ffea7a); }
.bn-color-swatch.bn-sw-green  { background: linear-gradient(180deg, #b9e7b9, #98d695); }
.bn-color-swatch.bn-sw-blue   { background: linear-gradient(180deg, #b6d8ff, #93c2fa); }
.bn-color-pick-label {
  font-size: 10px;
  color: var(--text3);
}

/* メンバー選択（マルチチェック） */
.bn-member-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-height: 160px;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.bn-member-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  color: var(--text1);
  cursor: pointer;
  margin-bottom: 0;
}
.bn-member-pick.is-checked,
.bn-member-pick:has(input:checked) {
  background: var(--accent, #378ADD);
  color: #fff;
  border-color: var(--accent, #378ADD);
}
/* v1.7.7: display:none だと iOS Safari でラベル経由のチェックが効かないので opacity 0 で隠す */
.bn-member-pick input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* ----- 画像プレビューモーダル ----- */
#modal-image-preview {
  background: rgba(0, 0, 0, 0.92);
}
#modal-image-preview .modal {
  background: transparent;
  box-shadow: none;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal-image-preview img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  cursor: zoom-out;
}
.image-preview-close {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  z-index: 100;
}

/* ----- 設定の色ラベル編集 ----- */
.bn-labels-editor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.bn-labels-editor-row:last-child { border-bottom: none; }
.bn-labels-editor-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}
.bn-labels-editor-row input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text1);
  font-size: 12px;
}

/* モバイル */
@media (max-width: 768px) {
  .bn-grid { grid-template-columns: 1fr; }
  .bn-card { min-height: 140px; }
  .bn-done-stamp { font-size: 70px; width: 100px; height: 100px; }
}
