/*
 * memo-editor.css — お気に入りメモ (本文 + 価格通知条件) の編集 UI。
 *
 * 全 6 アプリ共通。 spec: docs/superpowers/specs/2026-09-05-favorite-memo-inline-editor-design.md
 *
 * 収録するもの:
 *   1. カード上の ✏️/📝 ボタン + 💰 バッジ (favorites.js が動的に挿入する)
 *   2. モーダル (一覧/詳細/ハブ/ランキングのカードから開く器)
 *   3. ★追加トースト
 *   4. 本文エディタ (.dlc-fav-memo-*) と 通知価格パネル (.dlc-cond-*)
 *      — 2026-09-05 に top/templates/favorites.html のインライン <style> から移設。
 *        /favorites (インライン器) と モーダル器 の両方がこの CSS を使う。
 */

/* ===== 1. カード上のボタン ===== */
.dlc-fav-memo-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 2px 6px;
  font-size: 14px;
  line-height: 1;
}
.dlc-fav-memo-btn:hover { color: #333; }
.dlc-fav-memo-btn.dlc-fav-memo-has { color: #c2185b; }

/* overlay 版: サムネ上に置かれたハート (.dlc-fav-btn-overlay) の隣。
   ハートは right:4px 付近に絶対配置されるので、その左に並べる。 */
.dlc-fav-memo-btn-overlay {
  position: absolute;
  top: 4px;
  right: 38px;
  z-index: 5;
  background: rgba(255, 255, 255, .88);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

/* 条件達成バッジ (💰)。 判定は単品価格ベース (セット割/クーポンは含めない)。 */
.dlc-memo-hit-badge {
  display: inline-block;
  background: #FB02FF;
  color: #fff;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  vertical-align: middle;
}
.dlc-memo-hit-badge-overlay {
  position: absolute;
  top: 36px;
  right: 38px;
  z-index: 5;
}

/* ===== 2. モーダル ===== */
.dlc-memo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dlc-memo-modal {
  background: #fff;
  color: #212529;
  border-radius: 10px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .3);
}
.dlc-memo-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f3f5;
  font-size: 13px;
  font-weight: 700;
}
.dlc-memo-modal-title {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.dlc-memo-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #868e96;
  padding: 0 4px;
}
.dlc-memo-modal-body { padding: 10px 12px; overflow-y: auto; }
.dlc-memo-modal-cond-head {
  font-size: 12px;
  color: #c2185b;
  font-weight: 700;
  border-top: 1px solid #f1f3f5;
  margin-top: 10px;
  padding-top: 8px;
}
.dlc-memo-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border-top: 1px solid #f1f3f5;
}
.dlc-memo-modal-foot .dlc-fav-memo-error { margin-right: auto; }
.dlc-memo-modal-cancel {
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
}
.dlc-memo-modal-save {
  background: #c2185b;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 18px;
  font-size: 13px;
  cursor: pointer;
}
/* モーダル内の通知価格パネルは常時展開 (アコーディオンの折りたたみ枠を使わない) */
.dlc-memo-modal .dlc-cond-panel { border: none; padding: 0; }

/* ===== 3. ★追加トースト ===== */
.dlc-memo-toast {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  z-index: 2100;
  background: #212529;
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
  max-width: calc(100vw - 24px);
}
.dlc-memo-toast-btn {
  background: none;
  border: 1px solid #f8bbd0;
  color: #f8bbd0;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.dlc-memo-toast-close {
  background: none;
  border: none;
  color: #adb5bd;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

/* ===== 4. 本文エディタ / 通知価格パネル (favorites.html から移設) ===== */
.dlc-fav-memo-display {
  padding: 4px 8px;
  margin: 4px 0;
  background: #f7f7f8;
  border-left: 3px solid #c0c0c8;
  border-radius: 0 4px 4px 0;
  color: #555;
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.dlc-fav-memo-icon { opacity: 0.6; margin-right: 4px; }
.dlc-fav-memo-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 2px 6px;
  font-size: 14px;
}
.dlc-fav-memo-edit-btn:hover { color: #333; }
.dlc-fav-memo-edit-form {
  margin: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dlc-fav-memo-edit-form textarea,
.dlc-memo-textarea {
  width: 100%;
  min-height: 3em;
  font: inherit;
  resize: vertical;
  padding: 4px 6px;
  box-sizing: border-box;
}
.dlc-fav-memo-edit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dlc-fav-memo-cancel {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
}
.dlc-fav-memo-error {
  color: #c62828;
  font-size: 0.85rem;
}
.dlc-memo-counter {
  font-size: 0.8rem;
  color: #888;
}
.dlc-memo-counter.overflow {
  color: #c62828;
  font-weight: bold;
}
.dlc-memo-syntax-hint {
  font-size: 0.72rem;
  color: #86868b;
  margin-top: 4px;
  line-height: 1.4;
}
.dlc-memo-syntax-hint code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.92em;
}
.dlc-memo-cond-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.4;
  white-space: nowrap;
}
.dlc-memo-cond-pill--ok {
  background: #d1e7dd;
  color: #0a6644;
  border: 1px solid #a3cfbb;
}
.dlc-memo-cond-pill--err {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}
.dlc-memo-cond-pill-icon { font-size: 0.9em; }

.dlc-cond-accordion { margin: 6px 0; }
.dlc-cond-card { margin: 6px 0 2px; }
.dlc-cond-card .dlc-cond-summary { font-size: 12.5px; }
.dlc-cond-summary { width: 100%; text-align: left; border: 1px solid #f06595; background: #fff0f6;
  border-radius: 8px; padding: 7px 12px; font-size: 13px; color: #c2185b; cursor: pointer; }
.dlc-cond-panel { border: 1px dashed #f06595; border-top: none; border-radius: 0 0 8px 8px; padding: 10px; }
.dlc-cond-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dlc-cond-chip { border: 1px solid #ced4da; border-radius: 16px; padding: 5px 12px; font-size: 12.5px;
  background: #fff; color: #495057; cursor: pointer; min-height: 32px; }
.dlc-cond-chip.on { background: #c2185b; border-color: #c2185b; color: #fff; font-weight: 700; }
.dlc-cond-chip--mine { border-style: dashed; }
.dlc-cond-chip-x { margin-left: 6px; color: #adb5bd; }
.dlc-cond-chip.on .dlc-cond-chip-x { color: #f8bbd0; }
.dlc-cond-free { margin-top: 10px; padding-top: 8px; border-top: 1px solid #f1f3f5; }
.dlc-cond-free-toggle button { border: 1px solid #ced4da; background: #fff; padding: 3px 12px; font-size: 12px; cursor: pointer; }
.dlc-cond-free-toggle button.on { background: #c2185b; color: #fff; }
.dlc-cond-free-val { font-size: 17px; font-weight: 800; color: #c2185b; margin: 8px 0 4px; }
.dlc-cond-slider { width: 100%; }
.dlc-cond-free-btns { margin-top: 8px; display: flex; gap: 8px; }
.dlc-cond-free-btns button { border-radius: 8px; padding: 6px 16px; font-size: 13px; cursor: pointer; }
.dlc-cond-apply { background: #c2185b; color: #fff; border: none; }
.dlc-cond-save { background: #fff; color: #c2185b; border: 1px solid #f06595; }

@media (prefers-color-scheme: dark) {
  .dlc-fav-memo-display {
    background: #2d2d2f;
    border-left-color: #555;
    color: #ccc;
  }
  .dlc-fav-memo-edit-btn { color: #aaa; }
  .dlc-fav-memo-edit-btn:hover { color: #fff; }
  .dlc-fav-memo-btn { color: #aaa; }
  .dlc-fav-memo-btn:hover { color: #fff; }
  .dlc-fav-memo-btn.dlc-fav-memo-has { color: #f48fb1; }
  .dlc-fav-memo-btn-overlay { background: rgba(40, 40, 40, .88); }
  .dlc-fav-memo-edit-form textarea,
  .dlc-memo-textarea {
    background: #1d1d1f;
    color: #ddd;
    border-color: #555;
  }
  .dlc-fav-memo-cancel {
    background: none;
    border-color: #555;
    color: #ccc;
  }
  .dlc-memo-syntax-hint { color: #9a9a9e; }
  .dlc-memo-syntax-hint code { background: rgba(255, 255, 255, 0.08); }
  .dlc-memo-cond-pill--ok {
    background: rgba(46, 160, 67, 0.18);
    color: #6ed896;
    border-color: rgba(110, 216, 150, 0.35);
  }
  .dlc-memo-cond-pill--err {
    background: rgba(245, 159, 0, 0.18);
    color: #f0c674;
    border-color: rgba(240, 198, 116, 0.35);
  }
  .dlc-cond-summary { background: #3a2530; }
  .dlc-cond-panel { border-color: #a24d6e; }
  .dlc-cond-chip { background: #2b2b2b; color: #ddd; border-color: #555; }
  .dlc-cond-free { border-top-color: #444; }
  .dlc-cond-free-toggle button { background: #2b2b2b; color: #ddd; border-color: #555; }
  .dlc-cond-free-toggle button.on { background: #c2185b; color: #fff; }
  .dlc-cond-save { background: #2b2b2b; color: #f48fb1; border-color: #a24d6e; }

  .dlc-memo-modal { background: #1d1d1f; color: #ddd; }
  .dlc-memo-modal-head { border-bottom-color: #333; }
  .dlc-memo-modal-foot { border-top-color: #333; }
  .dlc-memo-modal-cond-head { border-top-color: #333; }
  .dlc-memo-modal-cancel { background: #2b2b2b; color: #ddd; border-color: #555; }
}
