/* ============================================================
   shareHistory.css — 履歴の選択共有 (master 仕様 2026-09-02)
   - #sharedHistPanel: 履歴タブ ソート行の自動共有ボタン (v1.21.1、パネルは撤去)
   - #shareHistoryModal: 宛先選択モーダル
   - .hist-share-btn: 履歴カードの共有ボタン (hist-del-btn と並ぶ)
   - #nhistShareBadge: 履歴タブ nav の未読バッジ
   ============================================================ */

/* ── 履歴カードの共有ボタン (hist-del-btn と同系) ── */
.hist-share-btn {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background .12s;
}
.hist-share-btn:hover { background: #e0e7ff; }

/* ── nav 未読バッジ ── */
.nhist-share-badge {
  display: inline-block;
  margin-left: 5px;
  min-width: 16px;
  padding: 1px 4px;
  border-radius: 9px;
  background: #4f46e5;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  vertical-align: middle;
}

/* ── 受信パネル ── */
.shared-hist-panel {
  background: #f5f7ff;
  border: 1px solid #dbe2f5;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.shp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.shp-title { font-size: 13px; font-weight: 700; color: #1e293b; }
.shp-unread {
  background: #4f46e5;
  color: #fff;
  border-radius: 9px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
}
.shp-refresh {
  background: transparent;
  border: 1px solid #c7d2e8;
  border-radius: 8px;
  color: #475569;
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
}
.shp-refresh:hover { background: #eef2ff; }
.shp-auto {
  margin-left: auto;
  background: transparent;
  border: 1px solid #c7d2e8;
  border-radius: 8px;
  color: #475569;
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
}
.shp-auto:hover { background: #eef2ff; }
.shp-auto.is-on {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
  font-weight: 700;
}
.shp-auto.is-on:hover { background: #4338ca; }
.shp-empty-line {
  font-size: 12px;
  color: #94a3b8;
  padding: 2px 0 0;
}
.shp-list { display: flex; flex-direction: column; gap: 8px; }
.shp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}
.shp-item.is-unread { border-color: #a5b4fc; background: #fafbff; }
.shp-item-main { flex: 1; min-width: 0; }
.shp-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 3px;
}
.shp-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4f46e5;
  flex-shrink: 0;
}
.shp-from { font-weight: 600; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shp-date { flex-shrink: 0; }
.shp-item-title {
  font-size: 13px;
  color: #1e293b;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shp-type {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.shp-item-note {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
  white-space: pre-wrap;
  word-break: break-word;
}
.shp-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.shp-btn {
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
}
.shp-btn-del {
  background: #fff;
  border-color: #e2e8f0;
  color: #94a3b8;
}
.shp-btn-del:hover { color: #b91c1c; border-color: #fecaca; }

@media (max-width: 640px) {
  .shp-item { flex-direction: column; align-items: stretch; gap: 8px; }
  .shp-item-actions { justify-content: flex-end; }
}

/* ── 宛先選択モーダル ── */
#shareHistoryModal { position: fixed; inset: 0; z-index: 1300; }
#shareHistoryModal[hidden] { display: none; }
.shm-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .45);
}
.shm-card {
  position: relative;
  max-width: 440px;
  margin: 9vh auto 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.shm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #eef1f6;
}
.shm-title { font-size: 15px; font-weight: 700; color: #1a1a2e; }
.shm-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
.shm-close:hover { color: #1e293b; }
.shm-body {
  padding: 14px 18px 18px;
  overflow-y: auto;
  font-size: 13px;
}
.shm-loading { color: #64748b; padding: 14px 0; }
.shm-empty { color: #64748b; line-height: 1.7; padding: 6px 0; }
.shm-lead {
  margin: 0 0 10px;
  color: #475569;
  font-size: 12.5px;
  line-height: 1.7;
}
.shm-stop {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #b91c1c;
  font-size: 13px;
  padding: 9px 0;
  cursor: pointer;
  font-family: inherit;
}
.shm-stop:hover { border-color: #fecaca; background: #fef2f2; }
.shm-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  min-width: 0;
}
.shm-entry-type {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.shm-entry-title {
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shm-entry-date { color: #94a3b8; font-size: 11px; flex-shrink: 0; }
.shm-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin: 10px 0 6px;
}
.shm-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background .12s;
}
.shm-member:hover { background: #f8fafc; }
.shm-member--all { background: #f5f7ff; border-color: #dbe2f5; font-weight: 600; }
.shm-member input { accent-color: #4f46e5; }
.shm-member-list.is-disabled { opacity: .45; pointer-events: none; }
.shm-owner-tag {
  background: #fef3c7;
  color: #92400e;
  border-radius: 5px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
}
.shm-note {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.shm-note:focus { outline: none; border-color: #a5b4fc; }
.shm-err {
  display: none;
  color: #b91c1c;
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.6;
}
.shm-err.is-shown { display: block; }
.shm-send {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: #4f46e5;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 0;
  cursor: pointer;
  font-family: inherit;
}
.shm-send:hover { background: #4338ca; }
.shm-send:disabled { opacity: .6; cursor: default; }

@media (max-width: 640px) {
  .shm-card { margin: 6vh 12px 0; max-width: none; }
}

/* v1.20.0: 受信は自動取り込みに変更。パネルは「自分が送った共有」と owner 管理のみ */
.shp-sub {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  margin: 8px 0 6px;
}

/* v1.21.1: 履歴タブ上部パネル撤去 → ソート行の小ボタン + 設定モーダル内の送信済み一覧 */
.shared-hist-toolbar { display: inline-flex; align-items: center; }
.shared-hist-toolbar[hidden] { display: none; }
.shared-hist-toolbar .shp-auto { margin-left: 0; height: 28px; padding: 0 10px; font-size: 11px; }
.shm-sent-note { font-size: 11px; color: #94a3b8; margin: 0 0 8px; line-height: 1.6; }
#shareHistoryModal .shp-item { padding: 8px 10px; }
