/* ============ Comment badge on thumbnail ============ */
.comment-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(201, 86, 60, .95);
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 900;
  font-family: monospace;
  letter-spacing: .03em;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
  pointer-events: none;
}
.comment-badge.empty { display: none; }
.comment-badge.resolved-only {
  background: rgba(123, 196, 127, .85);
}

/* ============ Inline comment input (grid & scroll) ============ */
.comment-box {
  margin-top: 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  padding: 8px 10px;
  transition: all .15s;
  position: relative;
}
.comment-box:focus-within {
  border-color: rgba(91, 155, 213, .6);
  background: rgba(255, 255, 255, .06);
}
.comment-box.drag-over {
  border-color: #5B9BD5;
  background: rgba(91, 155, 213, .12);
  box-shadow: 0 0 0 2px rgba(91, 155, 213, .3);
}
.comment-box.fully-resolved {
  opacity: .5;
  background: rgba(120, 200, 120, .05);
  border-color: rgba(120, 200, 120, .3);
}
.comment-box.fully-resolved .resolved-stamp { display: inline-block; }

.resolved-history {
  display: block;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: rgba(120, 200, 120, .06);
  border-left: 3px solid rgba(120, 200, 120, .4);
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(245, 242, 237, .45);
  text-decoration: line-through;
  text-decoration-color: rgba(245, 242, 237, .4);
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
  user-select: text;
}
.resolved-history::before {
  content: '✓ 解消済み（履歴）';
  display: block;
  font-family: monospace;
  font-size: 9px;
  font-weight: 900;
  color: #7BC47F;
  letter-spacing: .05em;
  margin-bottom: 4px;
  text-decoration: none;
  opacity: .8;
}
.resolved-history:empty { display: none; }

.resolved-stamp {
  display: none;
  font-size: 10px;
  color: #7BC47F;
  font-family: monospace;
  font-weight: 900;
  padding: 2px 6px;
  border: 1px solid #7BC47F;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: .05em;
}

.comment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed rgba(255,255,255,.06);
}
.resolve-btn {
  padding: 3px 8px;
  background: rgba(123, 196, 127, .15);
  border: 1px solid rgba(123, 196, 127, .4);
  color: #7BC47F;
  font-family: monospace;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: .04em;
}
.resolve-btn:hover { background: rgba(123, 196, 127, .3); }

body.hide-resolved .comment-box.resolved { display: none; }
body.hide-resolved .comment-badge.resolved-only { display: none; }

.comment-box textarea {
  width: 100%;
  min-height: 50px;
  background: transparent;
  border: none;
  color: #F5F2ED;
  font-family: -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.comment-box textarea::placeholder {
  color: rgba(245, 242, 237, .3);
  font-size: 12px;
}

/* ============ Image attachments ============ */
.attachment-hint {
  font-size: 10px;
  color: rgba(245, 242, 237, .3);
  font-family: monospace;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed rgba(255,255,255,.06);
}
.attachment-hint::before { content: '📎 画像をドラッグ&ドロップ'; }
.attachments {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.attachments:empty { display: none; }
.attachment-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.15);
}
.attachment-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.attachment-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: rgba(0,0,0,.8);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.attachment-remove:hover { background: rgba(201, 86, 60, .9); }

/* ============ Scroll view sidebar ============ */
.scroll-view .comment-sidebar {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  padding: 16px;
  position: sticky;
  top: 160px;
}
.scroll-view .comment-sidebar .sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.scroll-view .comment-sidebar .sidebar-title {
  font-family: monospace;
  font-size: 12px;
  color: #5B9BD5;
  letter-spacing: .05em;
  font-weight: 700;
  text-transform: uppercase;
}
.scroll-view .comment-sidebar textarea {
  width: 100%;
  min-height: 140px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 6px;
  color: #F5F2ED;
  font-family: -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.scroll-view .comment-sidebar textarea:focus {
  border-color: rgba(91, 155, 213, .6);
}
.scroll-view .comment-sidebar textarea::placeholder {
  color: rgba(245, 242, 237, .3);
}
