/* ── ICONA COMMENTI nella riga ── */

.col-commenti { width: 48px; text-align: center; }

.comment-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--gray-light);
  cursor: pointer;
  transition: background var(--duration-sm) ease, color var(--duration-sm) ease, transform var(--duration-xs) var(--ease-spring);
  font-family: var(--font);
}

.comment-btn:hover {
  background: rgba(42,109,144,0.10);
  color: var(--blue);
  transform: scale(1.1);
}

.comment-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.comment-btn .comment-count {
  position: absolute;
  top: 0; right: 0;
  width: 16px; height: 16px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
  line-height: 1;
}

/* Stato con commenti — icona piena */
.comment-btn.has-comments {
  color: var(--blue);
}

.comment-btn.has-comments:hover { transform: scale(1.12); }

/* ── PANNELLO LATERALE ── */

#comments-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 360px;
  max-width: 95vw;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  border-left: 1px solid rgba(255,255,255,0.55);
  box-shadow: -8px 0 40px rgba(13,46,64,0.14), inset 1px 0 0 rgba(255,255,255,0.70);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font);
}

#comments-panel.open { transform: translateX(0); }

/* Header */
.cp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  gap: 10px;
  flex-shrink: 0;
}

.cp-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cp-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cp-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue-deep);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--gray);
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--duration-sm) ease, color var(--duration-sm) ease;
}

.cp-close:hover { background: rgba(0,0,0,0.07); color: var(--black); }

/* Comment list */
.cp-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}

.cp-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  color: var(--gray-light);
}

.cp-empty p { font-size: 13px; line-height: 1.6; }

.cp-comment {
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.70);
  animation: cp-comment-in 0.2s var(--ease-out) both;
}

@keyframes cp-comment-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cp-comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.cp-comment-date {
  font-size: 11px;
  color: var(--gray-light);
  font-weight: 500;
  margin-top: 6px;
}

.cp-comment-author {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.cp-author-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.6);
}

.cp-author-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-comment-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--duration-sm) ease;
}

.cp-comment:hover .cp-comment-actions { opacity: 1; }

.cp-action {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--gray-light);
  border-radius: 5px;
  cursor: pointer;
  transition: color var(--duration-sm) ease, background var(--duration-sm) ease;
}

.cp-action svg { width: 13px; height: 13px; }
.cp-action:hover { color: var(--blue); background: rgba(42,109,144,0.10); }
.cp-action-del:hover { color: #b83030; background: rgba(184,48,48,0.10); }

/* Editor inline commento */
.cp-edit-input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--blue);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--black);
  background: rgba(255,255,255,0.90);
  outline: none;
  resize: vertical;
  min-height: 60px;
  box-shadow: 0 0 0 3px rgba(42,109,144,0.10);
}

.cp-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.cp-edit-cancel, .cp-edit-save {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  border: 1px solid transparent;
}

.cp-edit-cancel {
  background: rgba(0,0,0,0.06);
  color: var(--gray);
  border-color: rgba(0,0,0,0.10);
}
.cp-edit-cancel:hover { background: rgba(0,0,0,0.10); }

.cp-edit-save {
  background: var(--blue);
  color: #fff;
}
.cp-edit-save:hover { background: var(--blue-dark); }

.cp-comment-text {
  font-size: 13px;
  color: var(--black);
  line-height: 1.55;
  word-break: break-word;
}

/* Form */
.cp-form {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.cp-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid rgba(0,0,0,0.10);
  border-radius: 9px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--black);
  background: rgba(255,255,255,0.70);
  backdrop-filter: blur(8px);
  resize: none;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.5;
}

.cp-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(42,109,144,0.10);
  background: rgba(255,255,255,0.90);
}

.cp-input::placeholder { color: var(--gray-light); }

.cp-form-actions {
  display: flex;
  justify-content: flex-end;
}

.cp-send {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--duration-sm) ease;
  font-family: var(--font);
  box-shadow: 0 2px 8px rgba(42,109,144,0.25), inset 0 1px 0 rgba(255,255,255,0.18);
}

.cp-send:hover {
  background: linear-gradient(135deg, var(--blue-dark), #174060);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(42,109,144,0.32);
}

.cp-send:active { transform: scale(0.97); }

/* Mobile */
@media (max-width: 600px) {
  #comments-panel { width: 100%; }
}
