/**
 * Estilos dos Marcadores e Caixas de Comentários em Inputs de Formulário
 * Benchmarking Sinergy 2026 - Conforme especificação em campo-memoria.txt (Estilo Excel)
 */

/* Container relativo para posicionamento do indicador */
.excel-comment-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  vertical-align: middle;
  box-sizing: border-box;
}

/* Indicador triangular vermelho no canto superior direito (Estilo Excel) */
.excel-comment-indicator {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 0;
  height: 0;
  border-top: 9px solid #dc2626; /* Vermelho Excel */
  border-left: 9px solid transparent;
  cursor: pointer;
  z-index: 15;
  transition: transform 0.15s ease, border-top-color 0.15s;
  display: none;
}

.excel-comment-wrapper.has-comment .excel-comment-indicator {
  display: block;
}

.excel-comment-indicator:hover {
  border-top-color: #991b1b;
  transform: scale(1.3);
}

/* Caixa flutuante de comentário (estilo Post-it Excel) */
.excel-comment-box {
  position: fixed;
  width: 280px;
  max-width: 90vw;
  background-color: #ffffe1; /* Amarelo clássico de post-it / célula do Excel */
  border: 1px solid #7f7f7f;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  padding: 8px 10px;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, sans-serif;
  font-size: 12px;
  color: #1e293b;
  z-index: 99999;
  display: none;
  box-sizing: border-box;
  animation: excelCommentFadeIn 0.15s ease-out;
}

@keyframes excelCommentFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.excel-comment-box .excel-comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #713f12;
  border-bottom: 1px solid rgba(202, 138, 4, 0.3);
  padding-bottom: 4px;
}

.excel-comment-box .excel-comment-title {
  display: flex;
  align-items: center;
  gap: 4px;
}

.excel-comment-box .btn-header-edit {
  background: #fef08a;
  border: 1px solid #ca8a04;
  color: #854d0e;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.excel-comment-box .btn-header-edit:hover {
  background: #fde047;
  color: #713f12;
}

.excel-comment-box .excel-comment-close {
  background: transparent;
  border: none;
  font-size: 13px;
  line-height: 1;
  color: #854d0e;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 2px;
}

.excel-comment-box .excel-comment-close:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

/* Área de Prévia do Comentário */
.excel-comment-preview {
  cursor: pointer;
  padding: 4px 2px;
}

.excel-comment-preview-text {
  font-size: 12px;
  line-height: 1.45;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
}

.excel-comment-preview-hint {
  font-size: 10px;
  color: #854d0e;
  margin-top: 6px;
  opacity: 0.8;
  font-style: italic;
}

/* Área de Edição */
.excel-comment-edit-area textarea.excel-comment-textarea {
  width: 100%;
  height: 80px;
  resize: vertical;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-size: 12px;
  font-family: inherit;
  color: #1e293b;
  padding: 6px 8px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.excel-comment-edit-area textarea.excel-comment-textarea:focus {
  border-color: #ca8a04;
  box-shadow: 0 0 0 2px rgba(202, 138, 4, 0.25);
}

.excel-comment-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.excel-comment-box button.btn-save-comment {
  background-color: #15803d;
  color: #ffffff;
  border: none;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.excel-comment-box button.btn-save-comment:hover {
  background-color: #166534;
}

.excel-comment-box button.btn-save-comment:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.excel-comment-box button.btn-delete-comment {
  background-color: #ef4444;
  color: #ffffff;
  border: none;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.excel-comment-box button.btn-delete-comment:hover {
  background-color: #dc2626;
}

.excel-comment-box button.btn-cancel-comment {
  background-color: #e2e8f0;
  color: #475569;
  border: none;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.excel-comment-box button.btn-cancel-comment:hover {
  background-color: #cbd5e1;
}

.excel-comment-hint {
  font-size: 10px;
  color: #854d0e;
  margin-top: 4px;
  text-align: left;
  opacity: 0.85;
}

/* Toast de Notificação */
.excel-comment-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlideUp 0.25s ease-out;
  pointer-events: none;
  border-left: 4px solid #16a34a;
}

.excel-comment-toast.toast-info {
  border-left-color: #3b82f6;
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
